grim/guifications3

8043a768b025
Parents b26ba86dd2f3
Children 1f195d42369a
Creating a new branch for dealing with the majority of the plugin problem

refs #68
--- a/gflib/doc/gflib/tmpl/gf_plugin_info.sgml Sun Nov 15 02:22:37 2009 -0600
+++ b/gflib/doc/gflib/tmpl/gf_plugin_info.sgml Sun Dec 06 12:56:54 2009 -0600
@@ -24,6 +24,7 @@
</para>
@abi_version:
+@flags:
@name:
@version:
@summary:
--- a/gflib/gflib/gf_plugin_manager.c Sun Nov 15 02:22:37 2009 -0600
+++ b/gflib/gflib/gf_plugin_manager.c Sun Dec 06 12:56:54 2009 -0600
@@ -136,6 +136,44 @@
g_dir_rewind(pmld->dir);
}
+static GNode *
+gf_plugin_manager_refresh_filenames(void) {
+ GError *error = NULL;
+ GList *l = NULL;
+ GNode *root = NULL;
+
+ root = g_node_new(NULL);
+
+ for(l = paths; l; l = l->next) {
+ GDir *dir = NULL;
+ GNode *child = NULL;
+ const gchar *path = l->data;
+ const gchar *basename = NULL;
+
+ child = g_node_prepend_data(root, g_strdup(path));
+
+ if(!g_file_test(path, G_FILE_TEST_IS_DIR))
+ g_mkdir_with_parents(path, S_IRUSR | S_IWUSR | S_IXUSR);
+
+ dir = g_dir_open(path, 0, &error);
+
+ if(error) {
+ gf_log_warning("GfPluginManager", "Failed to open %s: %s\n",
+ path,
+ (error->message) ? error->message :
+ "(unknown error)");
+ continue;
+ }
+
+ while((basename = g_dir_read_name(dir)))
+ g_node_prepend_data(child, g_strdup(basename));
+
+ g_dir_close(dir);
+ }
+
+ return root;
+}
+
/******************************************************************************
* API
*****************************************************************************/
@@ -182,6 +220,14 @@
}
}
+
+static gboolean
+gf_plugin_manager_refresh_filenames_free(GNode *node, gpointer data) {
+ g_free(node->data);
+
+ return FALSE;
+}
+
/**
* gf_plugin_manager_refresh:
* @path_str : A #G_SEARCHPATH_SEPARATOR delimited list of directories to
@@ -192,32 +238,16 @@
*/
void
gf_plugin_manager_refresh(void) {
- GfPluginManagerLoadData pmld;
- GList *p = NULL;
-
- for(p = paths; p; p = p->next) {
- GError *error = NULL;
+ GNode *file_tree = NULL;
- pmld.path = p->data;
-
- if(!g_file_test(pmld.path, G_FILE_TEST_IS_DIR)) {
- g_mkdir_with_parents(pmld.path, S_IRUSR | S_IWUSR | S_IXUSR);
- }
+ file_tree = gf_plugin_manager_refresh_filenames();
- pmld.dir = g_dir_open(pmld.path, 0, &error);
-
- if(error) {
- gf_log_warning("GfPluginManager", "Failed to open %s: %s\n",
- pmld.path,
- (error->message) ? error->message :
- "(unknown error)");
- continue;
- }
+ /* free the data associated with the nodes */
+ g_node_traverse(file_tree, G_PRE_ORDER, G_TRAVERSE_ALL, -1,
+ gf_plugin_manager_refresh_filenames_free, NULL);
- g_hash_table_foreach(loaders, gf_plugin_manager_loader_refresh, &pmld);
-
- g_dir_close(pmld.dir);
- }
+ /* free the nodes themselves */
+ g_node_destroy(file_tree);
}
/**