Show multiple plugins in the 'Configure Plugins' dialog.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@4234 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
20a5fb25f6
commit
83f0cdbec0
@ -10,6 +10,8 @@
|
|||||||
Add plugin_configure_single() plugin symbol which is easier to
|
Add plugin_configure_single() plugin symbol which is easier to
|
||||||
implement than plugin_configure() but won't support a
|
implement than plugin_configure() but won't support a
|
||||||
multiple-plugin configure dialog.
|
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>
|
2009-09-22 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
|
||||||
|
|||||||
@ -1140,12 +1140,14 @@ static void pm_prepare_treeview(GtkWidget *tree, GtkListStore *store)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void configure_plugins(Plugin *p)
|
static void configure_plugins(Plugin *current_plugin)
|
||||||
{
|
{
|
||||||
GtkWidget *parent = pm_widgets.dialog;
|
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_WINDOW(parent), GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||||
GTK_STOCK_APPLY, GTK_RESPONSE_APPLY,
|
GTK_STOCK_APPLY, GTK_RESPONSE_APPLY,
|
||||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||||
@ -1153,19 +1155,37 @@ static void configure_plugins(Plugin *p)
|
|||||||
gtk_widget_set_name(dialog, "GeanyDialog");
|
gtk_widget_set_name(dialog, "GeanyDialog");
|
||||||
|
|
||||||
vbox = ui_dialog_vbox_new(GTK_DIALOG(dialog));
|
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)
|
||||||
|
|
||||||
if (! GTK_IS_WIDGET(prefs_page))
|
|
||||||
{
|
{
|
||||||
geany_debug("Invalid widget returned from plugin_configure() in plugin \"%s\"!",
|
Plugin *p = node->data;
|
||||||
p->info.name);
|
GtkWidget *page;
|
||||||
|
|
||||||
|
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 */
|
/* run the dialog */
|
||||||
while (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_APPLY);
|
while (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_APPLY);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user