SF.net SVN: geany:[4234] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Thu Sep 24 16:54:08 UTC 2009


Revision: 4234
          http://geany.svn.sourceforge.net/geany/?rev=4234&view=rev
Author:   ntrel
Date:     2009-09-24 16:54:08 +0000 (Thu, 24 Sep 2009)

Log Message:
-----------
Show multiple plugins in the 'Configure Plugins' dialog.

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

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2009-09-24 16:28:59 UTC (rev 4233)
+++ trunk/ChangeLog	2009-09-24 16:54:08 UTC (rev 4234)
@@ -10,6 +10,8 @@
    Add plugin_configure_single() plugin symbol which is easier to
    implement than plugin_configure() but won't support a
    multiple-plugin configure dialog.
+ * src/plugins.c:
+   Show multiple plugins in the 'Configure Plugins' dialog.
 
 
 2009-09-22  Nick Treleaven  <nick(dot)treleaven(at)btinternet(dot)com>

Modified: trunk/src/plugins.c
===================================================================
--- trunk/src/plugins.c	2009-09-24 16:28:59 UTC (rev 4233)
+++ trunk/src/plugins.c	2009-09-24 16:54:08 UTC (rev 4234)
@@ -1140,12 +1140,14 @@
 }
 
 
-static void configure_plugins(Plugin *p)
+static void configure_plugins(Plugin *current_plugin)
 {
 	GtkWidget *parent = pm_widgets.dialog;
-	GtkWidget *prefs_page, *dialog, *vbox;
+	GtkWidget *dialog, *vbox, *nb;
+	GList *node;
+	gint cur_page = -1;
 
-	dialog = gtk_dialog_new_with_buttons(p->info.name,
+	dialog = gtk_dialog_new_with_buttons(_("Configure Plugins"),
 		GTK_WINDOW(parent), GTK_DIALOG_DESTROY_WITH_PARENT,
 		GTK_STOCK_APPLY, GTK_RESPONSE_APPLY,
 		GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
@@ -1153,19 +1155,37 @@
 	gtk_widget_set_name(dialog, "GeanyDialog");
 
 	vbox = ui_dialog_vbox_new(GTK_DIALOG(dialog));
-	gtk_widget_show(vbox);
+	nb = gtk_notebook_new();
+	gtk_container_add(GTK_CONTAINER(vbox), nb);
 
-	prefs_page = p->configure(GTK_DIALOG(dialog));
+	foreach_list(node, active_plugin_list)
+	{
+		Plugin *p = node->data;
+		GtkWidget *page;
 
-	if (! GTK_IS_WIDGET(prefs_page))
-	{
-		geany_debug("Invalid widget returned from plugin_configure() in plugin \"%s\"!",
-			p->info.name);
+		if (!p->configure)
+			continue;
+		page = p->configure(GTK_DIALOG(dialog));
+
+		if (! GTK_IS_WIDGET(page))
+		{
+			geany_debug("Invalid widget returned from plugin_configure() in plugin \"%s\"!",
+				p->info.name);
+		}
+		else
+		{
+			GtkWidget *label = gtk_label_new(p->info.name);
+			gint n = gtk_notebook_append_page(GTK_NOTEBOOK(nb), page, label);
+
+			if (p == current_plugin)
+				cur_page = n;
+		}
 	}
-	else
+	if (cur_page >= 0)
 	{
-		gtk_container_add(GTK_CONTAINER(vbox), prefs_page);
+		gtk_notebook_set_current_page(GTK_NOTEBOOK(nb), cur_page);
 
+		gtk_widget_show_all(vbox);
 		/* run the dialog */
 		while (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_APPLY);
 	}


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