aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--calendar/gui/e-cal-model.c2
-rw-r--r--e-util/e-config.c92
-rw-r--r--modules/calendar/e-cal-shell-sidebar.c3
-rw-r--r--modules/calendar/e-memo-shell-sidebar.c3
-rw-r--r--modules/calendar/e-task-shell-sidebar.c3
-rw-r--r--plugins/bogo-junk-plugin/bf-junk-filter.c12
-rw-r--r--plugins/sa-junk-plugin/em-junk-filter.c12
7 files changed, 108 insertions, 19 deletions
diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c
index eaa5df68e1..c075e95c13 100644
--- a/calendar/gui/e-cal-model.c
+++ b/calendar/gui/e-cal-model.c
@@ -2142,6 +2142,8 @@ add_new_client (ECalModel *model, ECal *client, gboolean do_query)
e_cal_model_update_status_message (model, msg, -1.0);
g_free (msg);
+ e_cal_set_default_timezone (client, e_cal_model_get_timezone (model), NULL);
+
g_signal_connect (client, "cal_opened", G_CALLBACK (cal_opened_cb), model);
e_cal_open_async (client, TRUE);
}
diff --git a/e-util/e-config.c b/e-util/e-config.c
index 613971fba5..e8eedffef8 100644
--- a/e-util/e-config.c
+++ b/e-util/e-config.c
@@ -41,6 +41,8 @@
#define d(x)
+typedef GtkWidget * (*EConfigItemSectionFactoryFunc)(EConfig *ec, EConfigItem *, GtkWidget *parent, GtkWidget *old, gpointer data, GtkWidget **real_frame);
+
struct _EConfigFactory {
gchar *id;
EConfigFactoryFunc func;
@@ -62,6 +64,7 @@ struct _widget_node {
EConfigItem *item;
GtkWidget *widget; /* widget created by the factory, if any */
GtkWidget *frame; /* if created by us */
+ GtkWidget *real_frame; /* used for sections and section tables, this is the real GtkFrame (whereas "frame" above is the internal vbox/table) */
guint empty:1; /* set if empty (i.e. hidden) */
};
@@ -87,6 +90,8 @@ struct _EConfigPrivate {
static gpointer parent_class;
+static GtkWidget *ech_config_section_factory (EConfig *config, EConfigItem *item, GtkWidget *parent, GtkWidget *old, gpointer data, GtkWidget **real_frame);
+
static void
config_finalize (GObject *object)
{
@@ -94,7 +99,7 @@ config_finalize (GObject *object)
EConfigPrivate *p = emp->priv;
GList *link;
- d(printf("finalising EConfig %p\n", o));
+ d(printf("finalising EConfig %p\n", object));
g_free(emp->id);
@@ -519,6 +524,7 @@ ec_rebuild (EConfig *emp)
struct _widget_node *sectionnode = NULL, *pagenode = NULL;
GtkWidget *book = NULL, *page = NULL, *section = NULL, *root = NULL, *assistant = NULL;
gint pageno = 0, sectionno = 0, itemno = 0;
+ gint n_visible_widgets = 0;
struct _widget_node *last_active_page = NULL;
gboolean is_assistant;
GList *link;
@@ -550,7 +556,7 @@ ec_rebuild (EConfig *emp)
if (item->label != NULL)
translated_label = gettext (item->label);
- /* If the last section doesn't contain anything, hide it */
+ /* If the last section doesn't contain any visible widgets, hide it */
if (sectionnode != NULL
&& sectionnode->frame != NULL
&& (item->type == E_CONFIG_PAGE_START
@@ -558,11 +564,22 @@ ec_rebuild (EConfig *emp)
|| item->type == E_CONFIG_PAGE
|| item->type == E_CONFIG_SECTION
|| item->type == E_CONFIG_SECTION_TABLE)) {
- if ((sectionnode->empty = itemno == 0)) {
- gtk_widget_hide(sectionnode->frame);
+ if ((sectionnode->empty = (itemno == 0 || n_visible_widgets == 0))) {
+ if (sectionnode->real_frame)
+ gtk_widget_hide(sectionnode->real_frame);
+
+ if (sectionnode->frame)
+ gtk_widget_hide(sectionnode->frame);
+
sectionno--;
- } else
- gtk_widget_show(sectionnode->frame);
+ } else {
+ if (sectionnode->real_frame)
+ gtk_widget_show(sectionnode->real_frame);
+
+ if (sectionnode->frame)
+ gtk_widget_show(sectionnode->frame);
+ }
+
d(printf("%s section '%s' [sections=%d]\n", sectionnode->empty?"hiding":"showing", sectionnode->item->path, sectionno));
}
@@ -791,12 +808,35 @@ ec_rebuild (EConfig *emp)
}
itemno = 0;
+ n_visible_widgets = 0;
+
+ d(printf("Building section %s - '%s' - %s factory\n", item->path, item->label, item->factory ? "with" : "without"));
+
if (item->factory) {
- section = item->factory(emp, item, page, wn->widget, wn->context->data);
+ /* For sections, we pass an extra argument to the usual EConfigItemFactoryFunc.
+ * If this is an automatically-generated section, that extra argument (real_frame from
+ * EConfigItemSectionFactoryFunc) will contain the actual GtkFrame upon returning.
+ */
+ EConfigItemSectionFactoryFunc factory = (EConfigItemSectionFactoryFunc) item->factory;
+
+ section = factory(emp, item, page, wn->widget, wn->context->data, &wn->real_frame);
wn->frame = section;
if (section)
itemno = 1;
+ if (factory != ech_config_section_factory) {
+ /* This means there is a section that came from a user-specified factory,
+ * so we don't know what is inside the section. In that case, we increment
+ * n_visible_widgets so that the section will not get hidden later (we don't know
+ * if the section is empty or not, so we cannot decide to hide it).
+ *
+ * For automatically-generated sections, we use a special ech_config_section_factory() -
+ * see emph_construct_item().
+ */
+ n_visible_widgets++;
+ d(printf (" n_visible_widgets++ because there is a section factory -> frame=%p\n", section));
+ }
+
if (section
&& ((item->type == E_CONFIG_SECTION && !GTK_IS_BOX(section))
|| (item->type == E_CONFIG_SECTION_TABLE && !GTK_IS_TABLE(section))))
@@ -878,6 +918,11 @@ ec_rebuild (EConfig *emp)
d(printf("item %d:%s widget %p\n", itemno, item->path, w));
+ d(printf (" item %s: (%s - %s)\n",
+ item->path,
+ g_type_name_from_instance ((GTypeInstance *) w),
+ gtk_widget_get_visible (w) ? "visible" : "invisible"));
+
if (wn->widget && wn->widget != w) {
d(printf("destroy old widget for item '%s'\n", item->path));
gtk_widget_destroy(wn->widget);
@@ -887,18 +932,32 @@ ec_rebuild (EConfig *emp)
if (w) {
g_signal_connect(w, "destroy", G_CALLBACK(gtk_widget_destroyed), &wn->widget);
itemno++;
+
+ if (gtk_widget_get_visible (w))
+ n_visible_widgets++;
}
break;
}
}
- /* If the last section doesn't contain anything, hide it */
+ /* If the last section doesn't contain any visible widgets, hide it */
if (sectionnode != NULL && sectionnode->frame != NULL) {
- if ((sectionnode->empty = itemno == 0)) {
- gtk_widget_hide(sectionnode->frame);
+ d(printf ("Section %s - %d visible widgets (frame=%p)\n", sectionnode->item->path, n_visible_widgets, sectionnode->frame));
+ if ((sectionnode->empty = (itemno == 0 || n_visible_widgets == 0))) {
+ if (sectionnode->real_frame)
+ gtk_widget_hide(sectionnode->real_frame);
+
+ if (sectionnode->frame)
+ gtk_widget_hide(sectionnode->frame);
+
sectionno--;
- } else
- gtk_widget_show(sectionnode->frame);
+ } else {
+ if (sectionnode->real_frame)
+ gtk_widget_show(sectionnode->real_frame);
+
+ if (sectionnode->frame)
+ gtk_widget_show(sectionnode->frame);
+ }
d(printf("%s section '%s' [sections=%d]\n", sectionnode->empty?"hiding":"showing", sectionnode->item->path, sectionno));
}
@@ -1585,7 +1644,8 @@ ech_config_section_factory (EConfig *config,
EConfigItem *item,
GtkWidget *parent,
GtkWidget *old,
- gpointer data)
+ gpointer data,
+ GtkWidget **real_frame)
{
struct _EConfigHookGroup *group = data;
GtkWidget *label = NULL;
@@ -1612,6 +1672,8 @@ ech_config_section_factory (EConfig *config,
gtk_frame_set_shadow_type (GTK_FRAME (widget), GTK_SHADOW_NONE);
gtk_box_pack_start (GTK_BOX (parent), widget, FALSE, FALSE, 0);
+ *real_frame = widget;
+
/* This is why we have a custom factory for sections.
* When the plugin is disabled the frame is invisible. */
plugin = group->hook->hook.plugin;
@@ -1667,9 +1729,9 @@ emph_construct_item(EPluginHook *eph, EConfigHookGroup *menu, xmlNodePtr root, E
if (item->user_data)
item->factory = ech_config_widget_factory;
else if (item->type == E_CONFIG_SECTION)
- item->factory = ech_config_section_factory;
+ item->factory = (EConfigItemFactoryFunc) ech_config_section_factory;
else if (item->type == E_CONFIG_SECTION_TABLE)
- item->factory = ech_config_section_factory;
+ item->factory = (EConfigItemFactoryFunc) ech_config_section_factory;
d(printf(" path=%s label=%s factory=%s\n", item->path, item->label, (gchar *)item->user_data));
diff --git a/modules/calendar/e-cal-shell-sidebar.c b/modules/calendar/e-cal-shell-sidebar.c
index abe4132fa4..eb28868ce6 100644
--- a/modules/calendar/e-cal-shell-sidebar.c
+++ b/modules/calendar/e-cal-shell-sidebar.c
@@ -36,6 +36,7 @@
#include "e-cal-shell-view.h"
#include "e-cal-shell-backend.h"
+#include "e-cal-shell-content.h"
#define E_CAL_SHELL_SIDEBAR_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
@@ -303,6 +304,7 @@ cal_shell_sidebar_set_default (ECalShellSidebar *cal_shell_sidebar,
G_CALLBACK (cal_shell_sidebar_default_opened_cb),
cal_shell_sidebar);
+ e_cal_set_default_timezone (client, e_cal_model_get_timezone (e_cal_shell_content_get_model (E_CAL_SHELL_CONTENT (e_shell_view_get_shell_content (e_shell_sidebar_get_shell_view (E_SHELL_SIDEBAR (cal_shell_sidebar)))))), NULL);
e_cal_open_async (client, FALSE);
}
@@ -956,6 +958,7 @@ e_cal_shell_sidebar_add_source (ECalShellSidebar *cal_shell_sidebar,
G_CALLBACK (cal_shell_sidebar_client_opened_cb),
cal_shell_sidebar);
+ e_cal_set_default_timezone (client, e_cal_model_get_timezone (e_cal_shell_content_get_model (E_CAL_SHELL_CONTENT (e_shell_view_get_shell_content (e_shell_sidebar_get_shell_view (E_SHELL_SIDEBAR (cal_shell_sidebar)))))), NULL);
e_cal_open_async (client, FALSE);
}
diff --git a/modules/calendar/e-memo-shell-sidebar.c b/modules/calendar/e-memo-shell-sidebar.c
index 8a840f760e..3e14f6a9c0 100644
--- a/modules/calendar/e-memo-shell-sidebar.c
+++ b/modules/calendar/e-memo-shell-sidebar.c
@@ -34,6 +34,7 @@
#include "e-memo-shell-view.h"
#include "e-memo-shell-backend.h"
+#include "e-memo-shell-content.h"
#define E_MEMO_SHELL_SIDEBAR_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
@@ -298,6 +299,7 @@ memo_shell_sidebar_set_default (EMemoShellSidebar *memo_shell_sidebar,
G_CALLBACK (memo_shell_sidebar_default_opened_cb),
memo_shell_sidebar);
+ e_cal_set_default_timezone (client, e_cal_model_get_timezone (e_memo_shell_content_get_memo_model (E_MEMO_SHELL_CONTENT (e_shell_view_get_shell_content (e_shell_sidebar_get_shell_view (E_SHELL_SIDEBAR (memo_shell_sidebar)))))), NULL);
e_cal_open_async (client, FALSE);
}
@@ -874,6 +876,7 @@ e_memo_shell_sidebar_add_source (EMemoShellSidebar *memo_shell_sidebar,
G_CALLBACK (memo_shell_sidebar_client_opened_cb),
memo_shell_sidebar);
+ e_cal_set_default_timezone (client, e_cal_model_get_timezone (e_memo_shell_content_get_memo_model (E_MEMO_SHELL_CONTENT (e_shell_view_get_shell_content (e_shell_sidebar_get_shell_view (E_SHELL_SIDEBAR (memo_shell_sidebar)))))), NULL);
e_cal_open_async (client, FALSE);
}
diff --git a/modules/calendar/e-task-shell-sidebar.c b/modules/calendar/e-task-shell-sidebar.c
index 102553136f..87127ba634 100644
--- a/modules/calendar/e-task-shell-sidebar.c
+++ b/modules/calendar/e-task-shell-sidebar.c
@@ -34,6 +34,7 @@
#include "e-task-shell-view.h"
#include "e-task-shell-backend.h"
+#include "e-task-shell-content.h"
#define E_TASK_SHELL_SIDEBAR_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE \
@@ -298,6 +299,7 @@ task_shell_sidebar_set_default (ETaskShellSidebar *task_shell_sidebar,
G_CALLBACK (task_shell_sidebar_default_opened_cb),
task_shell_sidebar);
+ e_cal_set_default_timezone (client, e_cal_model_get_timezone (e_task_shell_content_get_task_model (E_TASK_SHELL_CONTENT (e_shell_view_get_shell_content (e_shell_sidebar_get_shell_view (E_SHELL_SIDEBAR (task_shell_sidebar)))))), NULL);
e_cal_open_async (client, FALSE);
}
@@ -874,6 +876,7 @@ e_task_shell_sidebar_add_source (ETaskShellSidebar *task_shell_sidebar,
G_CALLBACK (task_shell_sidebar_client_opened_cb),
task_shell_sidebar);
+ e_cal_set_default_timezone (client, e_cal_model_get_timezone (e_task_shell_content_get_task_model (E_TASK_SHELL_CONTENT (e_shell_view_get_shell_content (e_shell_sidebar_get_shell_view (E_SHELL_SIDEBAR (task_shell_sidebar)))))), NULL);
e_cal_open_async (client, FALSE);
}
diff --git a/plugins/bogo-junk-plugin/bf-junk-filter.c b/plugins/bogo-junk-plugin/bf-junk-filter.c
index 6d315da575..4190eebe86 100644
--- a/plugins/bogo-junk-plugin/bf-junk-filter.c
+++ b/plugins/bogo-junk-plugin/bf-junk-filter.c
@@ -51,6 +51,7 @@
#include <camel/camel-stream-fs.h>
#include <camel/camel-debug.h>
#include <gconf/gconf-client.h>
+#include "shell/e-shell.h"
#ifndef BOGOFILTER_BINARY
#define BOGOFILTER_BINARY "/usr/bin/bogofilter"
@@ -388,6 +389,7 @@ convert_unicode_cb (GtkWidget *widget, gpointer data)
GtkWidget *
org_gnome_bogo_convert_unicode (struct _EPlugin *epl, struct _EConfigHookItemFactoryData *data)
{
+ EShell *shell;
GtkWidget *check;
guint i = ((GtkTable *)data->parent)->nrows;
@@ -399,7 +401,13 @@ org_gnome_bogo_convert_unicode (struct _EPlugin *epl, struct _EConfigHookItemFac
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), em_junk_bf_unicode);
g_signal_connect (GTK_TOGGLE_BUTTON (check), "toggled", G_CALLBACK (convert_unicode_cb), (gpointer) "/apps/evolution/mail/junk/bogofilter/unicode");
gtk_table_attach((GtkTable *)data->parent, check, 0, 1, i, i+1, 0, 0, 0, 0);
- gtk_widget_show (check);
- return (GtkWidget *)check;
+
+ shell = e_shell_get_default ();
+ if (e_shell_get_express_mode (shell))
+ gtk_widget_hide (check);
+ else
+ gtk_widget_show (check);
+
+ return check;
}
diff --git a/plugins/sa-junk-plugin/em-junk-filter.c b/plugins/sa-junk-plugin/em-junk-filter.c
index c0b59891a1..c8c53c6169 100644
--- a/plugins/sa-junk-plugin/em-junk-filter.c
+++ b/plugins/sa-junk-plugin/em-junk-filter.c
@@ -47,6 +47,7 @@
#include <gtk/gtk.h>
#include "mail/em-config.h"
+#include "shell/e-shell.h"
#include <gconf/gconf-client.h>
@@ -926,6 +927,7 @@ use_remote_tests_cb (GtkWidget *widget, gpointer data)
GtkWidget *
org_gnome_sa_use_remote_tests (struct _EPlugin *epl, struct _EConfigHookItemFactoryData *data)
{
+ EShell *shell;
GtkWidget *check, *vbox, *label;
gchar *text = g_strdup_printf (" <small>%s</small>", _("This will make SpamAssassin more reliable, but slower"));
guint i = ((GtkTable *)data->parent)->nrows;
@@ -944,7 +946,13 @@ org_gnome_sa_use_remote_tests (struct _EPlugin *epl, struct _EConfigHookItemFact
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), !em_junk_sa_local_only);
g_signal_connect (GTK_TOGGLE_BUTTON (check), "toggled", G_CALLBACK (use_remote_tests_cb), (gpointer) "/apps/evolution/mail/junk/sa/local_only");
gtk_table_attach((GtkTable *)data->parent, vbox, 0, 1, i, i+1, 0, 0, 0, 0);
- gtk_widget_show_all (vbox);
- return (GtkWidget *)vbox;
+
+ shell = e_shell_get_default ();
+ if (e_shell_get_express_mode (shell))
+ gtk_widget_hide (vbox);
+ else
+ gtk_widget_show_all (vbox);
+
+ return vbox;
}