SF.net SVN: geany: [2492] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Wed Apr 16 15:45:18 UTC 2008


Revision: 2492
          http://geany.svn.sourceforge.net/geany/?rev=2492&view=rev
Author:   ntrel
Date:     2008-04-16 08:44:29 -0700 (Wed, 16 Apr 2008)

Log Message:
-----------
Remove active_plugins from GeanyApp.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/geany.h
    trunk/src/main.c
    trunk/src/plugindata.h
    trunk/src/plugins.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-04-16 15:09:52 UTC (rev 2491)
+++ trunk/ChangeLog	2008-04-16 15:44:29 UTC (rev 2492)
@@ -9,6 +9,8 @@
    Fix geany_debug() warnings with Close All.
  * src/keyfile.c, src/plugins.c, src/plugins.h:
    Move plugin keyfile pref saving and loading to plugins.c.
+ * src/plugindata.h, src/geany.h, src/plugins.c, src/main.c:
+   Remove active_plugins from GeanyApp.
 
 
 2008-04-15  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>

Modified: trunk/src/geany.h
===================================================================
--- trunk/src/geany.h	2008-04-16 15:09:52 UTC (rev 2491)
+++ trunk/src/geany.h	2008-04-16 15:44:29 UTC (rev 2492)
@@ -92,7 +92,6 @@
 	gchar				*configdir;
 	gchar				*datadir;
 	gchar				*docdir;
-	gchar			   **active_plugins; 	/* list of plugin filenames to load at startup */
 	const TMWorkspace	*tm_workspace;
 	GeanyProject		*project;			/* currently active project or NULL if none is open */
 	gboolean			ignore_callback;	/* should not be used in new code

Modified: trunk/src/main.c
===================================================================
--- trunk/src/main.c	2008-04-16 15:09:52 UTC (rev 2491)
+++ trunk/src/main.c	2008-04-16 15:44:29 UTC (rev 2492)
@@ -278,7 +278,6 @@
 	/* inits */
 	app->window				= NULL;
 	app->project			= NULL;
-	app->active_plugins		= NULL;
 	ui_widgets.open_fontsel		= NULL;
 	ui_widgets.open_colorsel	= NULL;
 	ui_widgets.open_filesel		= NULL;
@@ -964,7 +963,6 @@
 	g_free(printing_prefs.external_print_cmd);
 	g_free(printing_prefs.page_header_datefmt);
 	g_strfreev(ui_prefs.custom_commands);
-	g_strfreev(app->active_plugins);
 	while (! g_queue_is_empty(ui_prefs.recent_queue))
 	{
 		g_free(g_queue_pop_tail(ui_prefs.recent_queue));

Modified: trunk/src/plugindata.h
===================================================================
--- trunk/src/plugindata.h	2008-04-16 15:09:52 UTC (rev 2491)
+++ trunk/src/plugindata.h	2008-04-16 15:44:29 UTC (rev 2492)
@@ -40,7 +40,7 @@
 /* The ABI version should be incremented whenever existing fields in the plugin
  * data types below have to be changed or reordered. It should stay the same if fields
  * are only appended, as this doesn't affect existing fields. */
-static const gint abi_version = 23;
+static const gint abi_version = 24;
 
 /** Check the plugin can be loaded by Geany.
  * This performs runtime checks that try to ensure:

Modified: trunk/src/plugins.c
===================================================================
--- trunk/src/plugins.c	2008-04-16 15:09:52 UTC (rev 2491)
+++ trunk/src/plugins.c	2008-04-16 15:44:29 UTC (rev 2492)
@@ -84,6 +84,7 @@
  * opened, afterwards it will be destroyed */
 static GList *plugin_list = NULL;
 static GList *active_plugin_list = NULL; /* list of only actually loaded plugins, always valid */
+static gchar **active_plugins_pref = NULL; 	/* list of plugin filenames to load at startup */
 static GtkWidget *separator = NULL;
 static void pm_show_dialog(GtkMenuItem *menuitem, gpointer user_data);
 
@@ -596,13 +597,13 @@
 {
 	guint i, len;
 
-	if (app->active_plugins == NULL || (len = g_strv_length(app->active_plugins)) == 0)
+	if (active_plugins_pref == NULL || (len = g_strv_length(active_plugins_pref)) == 0)
 		return;
 
 	for (i = 0; i < len; i++)
 	{
-		if (NZV(app->active_plugins[i]))
-			plugin_new(app->active_plugins[i], TRUE, FALSE);
+		if (NZV(active_plugins_pref[i]))
+			plugin_new(active_plugins_pref[i], TRUE, FALSE);
 	}
 }
 
@@ -690,36 +691,37 @@
 }
 
 
-static void create_active_list(void)
+static void update_active_plugins_pref(void)
 {
 	gint i = 0;
 	GList *list;
 
-	g_strfreev(app->active_plugins);
+	g_strfreev(active_plugins_pref);
 
 	if (active_plugin_list == NULL)
 	{
-		app->active_plugins = NULL;
+		active_plugins_pref = NULL;
 		return;
 	}
 
-	app->active_plugins = g_new0(gchar*, g_list_length(active_plugin_list) + 1);
+	active_plugins_pref = g_new0(gchar*, g_list_length(active_plugin_list) + 1);
 	for (list = g_list_first(active_plugin_list); list != NULL; list = list->next)
 	{
-		app->active_plugins[i] = g_strdup(((Plugin*)list->data)->filename);
+		active_plugins_pref[i] = g_strdup(((Plugin*)list->data)->filename);
 		i++;
 	}
-	app->active_plugins[i] = NULL;
+	active_plugins_pref[i] = NULL;
 }
 
 
 void plugins_save_prefs(GKeyFile *config)
 {
 	g_key_file_set_boolean(config, "plugins", "load_plugins", prefs.load_plugins);
-	create_active_list();
-	if (app->active_plugins != NULL)
+
+	update_active_plugins_pref();
+	if (active_plugins_pref != NULL)
 		g_key_file_set_string_list(config, "plugins", "active_plugins",
-			(const gchar**)app->active_plugins, g_strv_length(app->active_plugins));
+			(const gchar**)active_plugins_pref, g_strv_length(active_plugins_pref));
 	else
 	{
 		/* use an empty dummy array to override maybe exisiting value */
@@ -732,17 +734,18 @@
 void plugins_load_prefs(GKeyFile *config)
 {
 	prefs.load_plugins = utils_get_setting_boolean(config, "plugins", "load_plugins", TRUE);
-	app->active_plugins = g_key_file_get_string_list(config, "plugins", "active_plugins", NULL, NULL);
+	active_plugins_pref = g_key_file_get_string_list(config, "plugins", "active_plugins", NULL, NULL);
 }
 
 
-void plugins_free()
+void plugins_free(void)
 {
 	if (active_plugin_list != NULL)
 	{
 		g_list_foreach(active_plugin_list, (GFunc) plugin_free,	GINT_TO_POINTER(PLUGIN_FREE_ALL));
 		g_list_free(active_plugin_list);
 	}
+	g_strfreev(active_plugins_pref);
 
 	g_object_unref(geany_object);
 	geany_object = NULL; /* to mark the object as invalid for any code which tries to emit signals */


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list