aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2008-06-19 04:54:38 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2008-06-19 04:54:38 +0800
commitb8c155683a49425cacacaf062176427d058b51d7 (patch)
treea7e68fecf812cd6edbeb4e3b33b28682865a19ae /plugins
parent058584357ec854d2c09663c65cf7760904ab4696 (diff)
downloadgsoc2013-evolution-b8c155683a49425cacacaf062176427d058b51d7.tar.gz
gsoc2013-evolution-b8c155683a49425cacacaf062176427d058b51d7.tar.zst
gsoc2013-evolution-b8c155683a49425cacacaf062176427d058b51d7.zip
** Fixes bug #530069
2008-06-18 Matthew Barnes <mbarnes@redhat.com> ** Fixes bug #530069 * plugins/plugin-manager/plugin-manager.c: Don't show the configuration tab unless the selected plugin actually has configuration options (excluding options that get crammed into the Preferences dialog). svn path=/trunk/; revision=35651
Diffstat (limited to 'plugins')
-rw-r--r--plugins/plugin-manager/ChangeLog9
-rw-r--r--plugins/plugin-manager/plugin-manager.c43
2 files changed, 42 insertions, 10 deletions
diff --git a/plugins/plugin-manager/ChangeLog b/plugins/plugin-manager/ChangeLog
index 7c20b9b23d..9e1292570c 100644
--- a/plugins/plugin-manager/ChangeLog
+++ b/plugins/plugin-manager/ChangeLog
@@ -1,3 +1,12 @@
+2008-06-18 Matthew Barnes <mbarnes@redhat.com>
+
+ ** Fixes bug #530069
+
+ * plugin-manager.c:
+ Don't show the configuration tab unless the selected plugin
+ actually has configuration options (excluding options that get
+ crammed into the Preferences dialog).
+
2008-05-23 Johnny Jacob <jjohnny@novell.com>
** Fixes Bug 496476.
diff --git a/plugins/plugin-manager/plugin-manager.c b/plugins/plugin-manager/plugin-manager.c
index 61db73cd1b..ba3722abfa 100644
--- a/plugins/plugin-manager/plugin-manager.c
+++ b/plugins/plugin-manager/plugin-manager.c
@@ -60,6 +60,10 @@ struct _Manager {
/* for tracking if we're shown */
static GtkDialog *dialog;
+static GtkWidget *notebook;
+static GtkWidget *configure_page;
+static gint last_selected_page;
+static gulong switch_page_handler_id;
void org_gnome_plugin_manager_manage(void *ep, ESMenuTargetShell *t);
@@ -70,6 +74,14 @@ eppm_set_label (GtkLabel *l, const char *v)
}
static void
+eppm_switch_page_cb (GtkNotebook *notebook,
+ GtkNotebookPage *page,
+ guint page_num)
+{
+ last_selected_page = page_num;
+}
+
+static void
eppm_show_plugin (Manager *m, EPlugin *ep, GtkWidget *cfg_widget)
{
if (ep) {
@@ -112,6 +124,11 @@ eppm_show_plugin (Manager *m, EPlugin *ep, GtkWidget *cfg_widget)
gtk_label_set_label (m->items[i], "");
}
+ if (cfg_widget != NULL)
+ gtk_notebook_append_page_menu (
+ GTK_NOTEBOOK (notebook), configure_page,
+ gtk_label_new (_("Configuration")), NULL);
+
if (m->active_cfg_widget != cfg_widget) {
if (m->active_cfg_widget)
gtk_widget_hide (m->active_cfg_widget);
@@ -129,6 +146,10 @@ eppm_selection_changed (GtkTreeSelection *selection, Manager *m)
GtkTreeModel *model;
GtkTreeIter iter;
+ g_signal_handler_block (notebook, switch_page_handler_id);
+ gtk_notebook_remove_page (GTK_NOTEBOOK (notebook), 1);
+ g_signal_handler_unblock (notebook, switch_page_handler_id);
+
if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
EPlugin *ep;
GtkWidget *cfg_widget = NULL;
@@ -139,6 +160,11 @@ eppm_selection_changed (GtkTreeSelection *selection, Manager *m)
} else {
eppm_show_plugin (m, NULL, NULL);
}
+
+ g_signal_handler_block (notebook, switch_page_handler_id);
+ gtk_notebook_set_current_page (
+ GTK_NOTEBOOK (notebook), last_selected_page);
+ g_signal_handler_unblock (notebook, switch_page_handler_id);
}
static void
@@ -191,7 +217,7 @@ org_gnome_plugin_manager_manage (void *ep, ESMenuTargetShell *t)
Manager *m;
int i;
GtkWidget *hbox, *w;
- GtkWidget *notebook, *overview_page, *configure_page, *def_configure_label;
+ GtkWidget *overview_page;
GtkListStore *store;
GtkTreeSelection *selection;
GtkCellRenderer *renderer;
@@ -236,14 +262,17 @@ org_gnome_plugin_manager_manage (void *ep, ESMenuTargetShell *t)
gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), TRUE);
gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook), FALSE);
gtk_notebook_set_scrollable (GTK_NOTEBOOK (notebook), TRUE);
- gtk_notebook_set_homogeneous_tabs (GTK_NOTEBOOK (notebook), TRUE);
+
+ switch_page_handler_id = g_signal_connect (
+ notebook, "switch-page",
+ G_CALLBACK (eppm_switch_page_cb), NULL);
overview_page = gtk_vbox_new (FALSE, 0);
configure_page = gtk_vbox_new (FALSE, 0);
+ g_object_ref_sink (configure_page);
gtk_container_set_border_width (GTK_CONTAINER (overview_page), 10);
gtk_container_set_border_width (GTK_CONTAINER (configure_page), 10);
gtk_notebook_append_page_menu (GTK_NOTEBOOK (notebook), overview_page, gtk_label_new (_("Overview")), NULL);
- gtk_notebook_append_page_menu (GTK_NOTEBOOK (notebook), configure_page, gtk_label_new (_("Configuration")), NULL);
gtk_widget_show (notebook);
gtk_widget_show (overview_page);
@@ -259,10 +288,6 @@ org_gnome_plugin_manager_manage (void *ep, ESMenuTargetShell *t)
gtk_widget_show (m->config_plugin_label);
gtk_box_pack_start (GTK_BOX (configure_page), m->config_plugin_label, FALSE, FALSE, 6);
- def_configure_label = gtk_label_new (_("There is no configuration option for this plugin."));
- gtk_widget_hide (def_configure_label);
- gtk_box_pack_start (GTK_BOX (configure_page), def_configure_label, FALSE, FALSE, 6);
-
store = gtk_list_store_new (4, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_POINTER);
/* fill store */
@@ -285,9 +310,7 @@ org_gnome_plugin_manager_manage (void *ep, ESMenuTargetShell *t)
}
cfg_widget = e_plugin_get_configure_widget (ep);
- if (!cfg_widget) {
- cfg_widget = def_configure_label;
- } else {
+ if (cfg_widget) {
gtk_widget_hide (cfg_widget);
gtk_box_pack_start (GTK_BOX (configure_page), cfg_widget, TRUE, TRUE, 6);
}