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.



git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@4241 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Nick Treleaven 2009-09-27 12:01:36 +00:00
parent 5bb28825aa
commit ce104016c9
2 changed files with 54 additions and 11 deletions

View File

@ -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>

View File

@ -1140,6 +1140,52 @@ static void pm_prepare_treeview(GtkWidget *tree, GtkListStore *store)
}
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,23 +1202,15 @@ static void configure_plugins(Plugin *current_plugin)
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))
{
geany_debug("Invalid widget returned from plugin_configure() in plugin \"%s\"!",
p->info.name);
}
else
if (page)
{
GtkWidget *label = gtk_label_new(p->info.name);
gint n = gtk_notebook_append_page(GTK_NOTEBOOK(nb), page, label);