示例#1
0
static void load_workflow_config(const char *name,
                           GList *available_wfs,
                           GHashTable *wf_list)
{
    GList *wf_file = g_list_find_custom(available_wfs, name, (GCompareFunc)file_obj_cmp);
    if (wf_file)
    {
        file_obj_t *file = (file_obj_t *)wf_file->data;
        workflow_t *workflow = new_workflow(file->filename);
        load_workflow_description_from_file(workflow, file->fullpath);
        VERB1 log("Adding '%s' to workflows\n", file->filename);
        g_hash_table_insert(wf_list, file->filename, workflow);
    }
}
示例#2
0
GHashTable *load_workflow_config_data(const char *path)
{
    if (g_workflow_list)
        return g_workflow_list;

    if (g_workflow_list == NULL)
    {
        g_workflow_list = g_hash_table_new_full(
                                        g_str_hash,
                                        g_str_equal,
                                        g_free,
                                        (GDestroyNotify) free_workflow
        );
    }

    if (path == NULL)
        path = WORKFLOWS_DIR;

    GList *workflow_files = get_file_list(path, "xml");
    while (workflow_files)
    {
        file_obj_t *file = (file_obj_t *)workflow_files->data;

        workflow_t *workflow = get_workflow(file->filename);
        bool nw_workflow = (!workflow);
        if (nw_workflow)
            workflow = new_workflow(file->filename);

        load_workflow_description_from_file(workflow, file->fullpath);

        if (nw_workflow)
            g_hash_table_replace(g_workflow_list, xstrdup(wf_get_name(workflow)), workflow);

        free_file_obj(file);
        workflow_files = g_list_delete_link(workflow_files, workflow_files);
    }

    return g_workflow_list;
}