SF.net SVN: geany: [2330] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Thu Mar 13 09:18:42 UTC 2008


Revision: 2330
          http://geany.svn.sourceforge.net/geany/?rev=2330&view=rev
Author:   eht16
Date:     2008-03-13 02:18:41 -0700 (Thu, 13 Mar 2008)

Log Message:
-----------
Don't load all available plugins on startup, it's only necessary opening the plugin manager.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/plugins.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2008-03-13 08:45:20 UTC (rev 2329)
+++ trunk/ChangeLog	2008-03-13 09:18:41 UTC (rev 2330)
@@ -1,3 +1,12 @@
+2008-03-13  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>
+
+ * doc/geany.html, doc/geany.txt, src/search.c:
+   Use monospace font for text entry fields in search dialogs and add
+   a notice how to change the used font (#1907117).
+ * src/plugins.c: Don't load all available plugins on startup, it's only
+                  necessary opening the plugin manager.
+
+
 2008-03-12  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>
 
  * src/build.c, src/keybindings.c, src/keybindings.h,

Modified: trunk/src/plugins.c
===================================================================
--- trunk/src/plugins.c	2008-03-13 08:45:20 UTC (rev 2329)
+++ trunk/src/plugins.c	2008-03-13 09:18:41 UTC (rev 2330)
@@ -398,8 +398,12 @@
 }
 
 
+/* Load and init a plugin.
+ * init_plugin decides whether the plugin's init() function should be called or not. If it is
+ * called, the plugin will be started, if not the plugin will be read only (for the list of
+ * available plugins in the plugin manager). */
 static Plugin*
-plugin_new(const gchar *fname)
+plugin_new(const gchar *fname, gboolean init_plugin)
 {
 	Plugin *plugin;
 	GModule *module;
@@ -454,6 +458,8 @@
 	plugin->filename = g_strdup(fname);
 	plugin->module = module;
 
+	plugin_list = g_list_append(plugin_list, plugin);
+
 	g_module_symbol(module, "geany_data", (void *) &p_geany_data);
 	if (p_geany_data)
 		*p_geany_data = &geany_data;
@@ -472,7 +478,7 @@
 	}
 
 	/* only initialise the plugin if it should be loaded */
-	if (is_active_plugin(fname))
+	if (init_plugin)
 	{
 		plugin_init(plugin);
 	}
@@ -532,7 +538,24 @@
 }
 
 
+/* load active plugins at startup */
 static void
+load_active_plugins()
+{
+	guint i, len;
+
+	if (app->active_plugins == NULL || (len = g_strv_length(app->active_plugins)) == 0)
+		return;
+
+	for (i = 0; i < len; i++)
+	{
+		if (NZV(app->active_plugins[i]))
+			plugin_new(app->active_plugins[i], TRUE);
+	}
+}
+
+
+static void
 load_plugins(const gchar *path)
 {
 	GSList *list, *item;
@@ -548,11 +571,7 @@
 			continue;
 
 		fname = g_strconcat(path, G_DIR_SEPARATOR_S, item->data, NULL);
-		plugin = plugin_new(fname);
-		if (plugin != NULL)
-		{
-			plugin_list = g_list_append(plugin_list, plugin);
-		}
+		plugin = plugin_new(fname, FALSE);
 		g_free(fname);
 	}
 
@@ -608,7 +627,7 @@
 	separator = gtk_separator_menu_item_new();
 	gtk_container_add(GTK_CONTAINER(geany_data.tools_menu), separator);
 
-	load_plugin_paths();
+	load_active_plugins();
 
 	plugins_update_tools_menu();
 }
@@ -863,7 +882,15 @@
 static void pm_show_dialog(GtkMenuItem *menuitem, gpointer user_data)
 {
 	GtkWidget *vbox, *vbox2, *label_vbox, *hbox, *swin, *label, *label2;
+	static gboolean plugin_list_loaded = FALSE;
 
+	/* before showing the dialog, we need to create the list of available plugins */
+	if (! plugin_list_loaded)
+	{
+		load_plugin_paths();
+		plugin_list_loaded = TRUE;
+	}
+
 	pm_widgets.dialog = gtk_dialog_new_with_buttons(_("Plugins"), GTK_WINDOW(app->window),
 						GTK_DIALOG_DESTROY_WITH_PARENT,
 						GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL);


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