/* search for binaries in the plug-in directory path */
static void
gimp_plug_in_manager_search (GimpPlugInManager  *manager,
                             GimpInitStatusFunc  status_callback)
{
  gchar       *path;
  const gchar *pathext = g_getenv ("PATHEXT");

  /*  If PATHEXT is set, we are likely on Windows and need to add
   *  the known file extensions.
   */
  if (pathext)
    {
      gchar *exts;

      exts = gimp_interpreter_db_get_extensions (manager->interpreter_db);

      if (exts)
        {
          gchar *value;

          value = g_strconcat (pathext, G_SEARCHPATH_SEPARATOR_S, exts, NULL);

          g_setenv ("PATHEXT", value, TRUE);

          g_free (value);
          g_free (exts);
        }
    }

  status_callback (_("Searching Plug-Ins"), "", 0.0);

  /* Give automatic tests a chance to use plug-ins from the build
   * dir
   */
  path = g_strdup(g_getenv("GIMP_TESTING_PLUGINDIRS"));

  if (! path) 
    path = gimp_config_path_expand (manager->gimp->config->plug_in_path,
                                    TRUE, NULL);

  gimp_datafiles_read_directories (path,
                                   G_FILE_TEST_IS_EXECUTABLE,
                                   gimp_plug_in_manager_add_from_file,
                                   manager);

  g_free (path);
}
Esempio n. 2
0
/**
 * gimp_module_db_load:
 * @db:          A #GimpModuleDB.
 * @module_path: A #G_SEARCHPATH_SEPARATOR delimited list of directories
 *               to load modules from.
 *
 * Scans the directories contained in @module_path using
 * gimp_datafiles_read_directories() and creates a #GimpModule
 * instance for every loadable module contained in the directories.
 **/
void
gimp_module_db_load (GimpModuleDB *db,
                     const gchar  *module_path)
{
    g_return_if_fail (GIMP_IS_MODULE_DB (db));
    g_return_if_fail (module_path != NULL);

    if (g_module_supported ())
        gimp_datafiles_read_directories (module_path,
                                         G_FILE_TEST_EXISTS,
                                         gimp_module_db_module_initialize,
                                         db);

#ifdef DUMP_DB
    g_list_foreach (db->modules, gimp_module_db_dump_module, NULL);
#endif
}
Esempio n. 3
0
void
themes_init (Gimp *gimp)
{
  GimpGuiConfig *config;
  gchar         *themerc;

  g_return_if_fail (GIMP_IS_GIMP (gimp));

  config = GIMP_GUI_CONFIG (gimp->config);

  themes_hash = g_hash_table_new_full (g_str_hash,
                                       g_str_equal,
                                       g_free,
                                       g_free);

  if (config->theme_path)
    {
      gchar *path;

      path = gimp_config_path_expand (config->theme_path, TRUE, NULL);

      gimp_datafiles_read_directories (path,
                                       G_FILE_TEST_IS_DIR,
                                       themes_directories_foreach,
                                       gimp);

      g_free (path);
    }

  themes_apply_theme (gimp, config->theme);

  themerc = gimp_personal_rc_file ("themerc");
  gtk_rc_parse (themerc);
  g_free (themerc);

  g_signal_connect (config, "notify::theme",
                    G_CALLBACK (themes_theme_change_notify),
                    gimp);
}
Esempio n. 4
0
/**
 * gimp_module_db_refresh:
 * @db:          A #GimpModuleDB.
 * @module_path: A #G_SEARCHPATH_SEPARATOR delimited list of directories
 *               to load modules from.
 *
 * Does the same as gimp_module_db_load(), plus removes all #GimpModule
 * instances whose modules have been deleted from disk.
 *
 * Note that the #GimpModule'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
gimp_module_db_refresh (GimpModuleDB *db,
                        const gchar  *module_path)
{
    GList *kill_list = NULL;

    g_return_if_fail (GIMP_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,
                    gimp_module_db_module_on_disk_func,
                    &kill_list);
    g_list_foreach (kill_list,
                    gimp_module_db_module_remove_func,
                    db);
    g_list_free (kill_list);

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