SF.net SVN: geany:[4241] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Sun Sep 27 12:01:36 UTC 2009


Revision: 4241
          http://geany.svn.sourceforge.net/geany/?rev=4241&view=rev
Author:   ntrel
Date:     2009-09-27 12:01:36 +0000 (Sun, 27 Sep 2009)

Log Message:
-----------
Show plugins that only implement plugin_configure_single() in the
multiple-configure dialog as a page with a configure button on it.
Add padding for multiple-configure dialog.
Make the multiple-configure dialog notebook tabs scrollable.

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

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2009-09-27 11:20:12 UTC (rev 4240)
+++ trunk/ChangeLog	2009-09-27 12:01:36 UTC (rev 4241)
@@ -8,6 +8,11 @@
  * configure.in:
    Use AC_PATH_PROG instead of which for portability (patch by Erik
    Southworth, thanks).
+ * src/plugins.c:
+   Show plugins that only implement plugin_configure_single() in the
+   multiple-configure dialog as a page with a configure button on it.
+   Add padding for multiple-configure dialog.
+   Make the multiple-configure dialog notebook tabs scrollable.
 
 
 2009-09-24  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>

Modified: trunk/src/plugins.c
===================================================================
--- trunk/src/plugins.c	2009-09-27 11:20:12 UTC (rev 4240)
+++ trunk/src/plugins.c	2009-09-27 12:01:36 UTC (rev 4241)
@@ -1140,6 +1140,52 @@
 }
 
 
+static void on_pref_btn_clicked(gpointer btn, Plugin *p)
+{
+	p->configure_single(main_widgets.window);
+}
+
+
+static GtkWidget *create_pref_page(Plugin *p, GtkWidget *dialog)
+{
+	GtkWidget *page = NULL;	/* some plugins don't have prefs */
+
+	if (p->configure)
+	{
+		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);
+			return NULL;
+		}
+		else
+		{
+			GtkWidget *align = gtk_alignment_new(0.5, 0.5, 1, 1);
+
+			gtk_alignment_set_padding(GTK_ALIGNMENT(align), 6, 6, 6, 6);
+			gtk_container_add(GTK_CONTAINER(align), page);
+			page = align;
+		}
+	}
+	else if (p->configure_single)
+	{
+		GtkWidget *align = gtk_alignment_new(0.5, 0.5, 0, 0);
+		GtkWidget *btn;
+
+		gtk_alignment_set_padding(GTK_ALIGNMENT(align), 6, 6, 6, 6);
+
+		btn = gtk_button_new_from_stock(GTK_STOCK_PREFERENCES);
+		g_signal_connect(btn, "clicked", G_CALLBACK(on_pref_btn_clicked), p);
+		gtk_container_add(GTK_CONTAINER(align), btn);
+		page = align;
+	}
+	return page;
+}
+
+
+/* multiple plugin configure dialog */
 static void configure_plugins(Plugin *current_plugin)
 {
 	GtkWidget *parent = pm_widgets.dialog;
@@ -1156,24 +1202,16 @@
 
 	vbox = ui_dialog_vbox_new(GTK_DIALOG(dialog));
 	nb = gtk_notebook_new();
+	gtk_notebook_set_scrollable(GTK_NOTEBOOK(nb), TRUE);
 	gtk_container_add(GTK_CONTAINER(vbox), nb);
 
 	foreach_list(node, active_plugin_list)
 	{
 		Plugin *p = node->data;
-		GtkWidget *page;
+		GtkWidget *page = create_pref_page(p, dialog);
 
-		if (!p->configure)
-			continue;
-		page = p->configure(GTK_DIALOG(dialog));
-
-		if (! GTK_IS_WIDGET(page))
+		if (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);
 


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