Ejemplo n.º 1
0
/**
 * gegl_module_db_get_load_inhibit:
 * @db: A #GeglModuleDB.
 *
 * Return the #G_SEARCHPATH_SEPARATOR selimited list of module filenames
 * which are excluded from auto-loading.
 *
 * Return value: the @db's @load_inhibit string.
 **/
const gchar *
gegl_module_db_get_load_inhibit (GeglModuleDB *db)
{
  g_return_val_if_fail (GEGL_IS_MODULE_DB (db), NULL);

  return db->load_inhibit;
}
Ejemplo n.º 2
0
/**
 * gegl_module_db_load:
 * @db:          A #GeglModuleDB.
 * @module_path: A #G_SEARCHPATH_SEPARATOR delimited list of directories
 *               to load modules from.
 *
 * Scans the directories contained in @module_path using
 * gegl_datafiles_read_directories() and creates a #GeglModule
 * instance for every loadable module contained in the directories.
 **/
void
gegl_module_db_load (GeglModuleDB *db,
                     const gchar  *module_path)
{
  g_return_if_fail (GEGL_IS_MODULE_DB (db));
  g_return_if_fail (module_path != NULL);

  if (g_module_supported ())
    gegl_datafiles_read_directories (module_path,
                                     G_FILE_TEST_EXISTS,
                                     gegl_module_db_module_initialize,
                                     db);

#ifdef DUMP_DB
  g_list_foreach (db->modules, gegl_module_db_dump_module, NULL);
#endif
}
Ejemplo n.º 3
0
/**
 * gegl_module_db_set_load_inhibit:
 * @db:           A #GeglModuleDB.
 * @load_inhibit: A #G_SEARCHPATH_SEPARATOR delimited list of module
 *                filenames to exclude from auto-loading.
 *
 * Sets the @load_inhibit flag for all #GeglModule's which are kept
 * by @db (using gegl_module_set_load_inhibit()).
 **/
void
gegl_module_db_set_load_inhibit (GeglModuleDB *db,
                                 const gchar  *load_inhibit)
{
  GList *list;

  g_return_if_fail (GEGL_IS_MODULE_DB (db));

  g_free (db->load_inhibit);
  db->load_inhibit = g_strdup (load_inhibit);

  for (list = db->modules; list; list = g_list_next (list))
    {
      GeglModule *module = list->data;

      gegl_module_set_load_inhibit (module,
                                    is_in_inhibit_list (module->filename,
                                                        load_inhibit));
    }
}
Ejemplo n.º 4
0
/**
 * gegl_module_db_refresh:
 * @db:          A #GeglModuleDB.
 * @module_path: A #G_SEARCHPATH_SEPARATOR delimited list of directories
 *               to load modules from.
 *
 * Does the same as gegl_module_db_load(), plus removes all #GeglModule
 * instances whose modules have been deleted from disk.
 *
 * Note that the #GeglModule's will just be removed from the internal
 * list and not freed as this is not possible with #GTypeModule
 * instances which actually implement types.
 **/
void
gegl_module_db_refresh (GeglModuleDB *db,
                        const gchar  *module_path)
{
  GList *kill_list = NULL;

  g_return_if_fail (GEGL_IS_MODULE_DB (db));
  g_return_if_fail (module_path != NULL);

  /* remove modules we don't have on disk anymore */
  g_list_foreach (db->modules,
                  gegl_module_db_module_on_disk_func,
                  &kill_list);
  g_list_foreach (kill_list,
                  gegl_module_db_module_remove_func,
                  db);
  g_list_free (kill_list);

  /* walk filesystem and add new things we find */
  gegl_datafiles_read_directories (module_path,
                                   G_FILE_TEST_EXISTS,
                                   gegl_module_db_module_initialize,
                                   db);
}