aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2003-01-14 05:58:25 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2003-01-14 05:58:25 +0800
commit724b28b7ad3ab1c966400b008a793e50327ff1c0 (patch)
treedf5a955e487a1eed2162202de95d483c126e5026
parent3c89e1aa0252c6f558cf1573b39ab3a366cd4516 (diff)
downloadgsoc2013-evolution-724b28b7ad3ab1c966400b008a793e50327ff1c0.tar.gz
gsoc2013-evolution-724b28b7ad3ab1c966400b008a793e50327ff1c0.tar.zst
gsoc2013-evolution-724b28b7ad3ab1c966400b008a793e50327ff1c0.zip
Check the state of message_style in gconf and set the menus accordingly.
2003-01-13 Jeffrey Stedfast <fejj@ximian.com> * folder-browser-ui.c (folder_browser_ui_add_message): Check the state of message_style in gconf and set the menus accordingly. * folder-browser.c (folder_browser_destroy): Remove listener for message_style change notification. (folder_browser_gui_init): Connect a listener for changes to message_style. svn path=/trunk/; revision=19432
-rw-r--r--mail/ChangeLog8
-rw-r--r--mail/folder-browser-ui.c21
-rw-r--r--mail/folder-browser.c32
-rw-r--r--mail/folder-browser.h3
4 files changed, 52 insertions, 12 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index c0ef75e560..ef15999f3b 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,5 +1,13 @@
2003-01-13 Jeffrey Stedfast <fejj@ximian.com>
+ * folder-browser-ui.c (folder_browser_ui_add_message): Check the
+ state of message_style in gconf and set the menus accordingly.
+
+ * folder-browser.c (folder_browser_destroy): Remove listener for
+ message_style change notification.
+ (folder_browser_gui_init): Connect a listener for changes to
+ message_style.
+
* mail-config.c (account_to_xml): Save the auto-check timeout
value.
(account_new_from_xml): Load the auto-check-timeout value.
diff --git a/mail/folder-browser-ui.c b/mail/folder-browser-ui.c
index cf5a689304..b5d76a5fb6 100644
--- a/mail/folder-browser-ui.c
+++ b/mail/folder-browser-ui.c
@@ -511,9 +511,10 @@ char *message_display_styles[] = {
void
folder_browser_ui_add_message (FolderBrowser *fb)
{
- int state;
BonoboUIComponent *uic = fb->uicomp;
FolderBrowserSelectionState prev_state;
+ GConfClient *gconf;
+ int style;
if (fb->sensitise_state) {
g_hash_table_destroy(fb->sensitise_state);
@@ -522,16 +523,19 @@ folder_browser_ui_add_message (FolderBrowser *fb)
ui_add (fb, "message", message_verbs, message_pixcache);
+ gconf = gconf_client_get_default ();
+
/* Display Style */
- state = fb->mail_display->display_style;
- bonobo_ui_component_set_prop (uic, message_display_styles[state],
- "state", "1", NULL);
+ style = gconf_client_get_int (gconf, "/apps/evolution/mail/display/message_style", NULL);
+ style = style >= 0 && style < MAIL_CONFIG_DISPLAY_MAX ? style : 0;
+ bonobo_ui_component_set_prop (uic, message_display_styles[style], "state", "1", NULL);
bonobo_ui_component_add_listener (uic, "ViewNormal", folder_browser_set_message_display_style, fb);
bonobo_ui_component_add_listener (uic, "ViewFullHeaders", folder_browser_set_message_display_style, fb);
bonobo_ui_component_add_listener (uic, "ViewSource", folder_browser_set_message_display_style, fb);
- /* FIXME: this kind of bypasses bonobo but seems the only way when we change components */
- folder_browser_set_message_display_style (uic, strrchr (message_display_styles[state], '/') + 1,
- Bonobo_UIComponent_STATE_CHANGED, "1", fb);
+ if (fb->mail_display->display_style != style) {
+ fb->mail_display->display_style = style;
+ mail_display_redisplay (fb->mail_display, TRUE);
+ }
/* Resend Message */
if (fb->folder && !folder_browser_is_sent (fb))
@@ -544,8 +548,7 @@ folder_browser_ui_add_message (FolderBrowser *fb)
/* Charset picker */
e_charset_picker_bonobo_ui_populate (uic, "/menu/View", FB_DEFAULT_CHARSET,
- folder_browser_charset_changed,
- fb);
+ folder_browser_charset_changed, fb);
}
void
diff --git a/mail/folder-browser.c b/mail/folder-browser.c
index 074bdd5f6e..4c4c29bc3d 100644
--- a/mail/folder-browser.c
+++ b/mail/folder-browser.c
@@ -213,6 +213,11 @@ folder_browser_destroy (GtkObject *object)
folder_browser->hide_deleted_notify_id = 0;
}
+ if (folder_browser->message_style_notify_id != 0) {
+ gconf_client_notify_remove (gconf, folder_browser->message_style_notify_id);
+ folder_browser->message_style_notify_id = 0;
+ }
+
/* wait for all outstanding async events against us */
mail_async_event_destroy (folder_browser->async_event);
@@ -1344,8 +1349,6 @@ folder_browser_set_message_display_style (BonoboUIComponent *component
GConfClient *gconf;
int i;
- /* FIXME: we should listen for changes to this, so when it changes for one folder all folders get updated */
-
if (type != Bonobo_UIComponent_STATE_CHANGED
|| atoi (state) == 0
|| fb->message_list == NULL)
@@ -1353,6 +1356,8 @@ folder_browser_set_message_display_style (BonoboUIComponent *component
gconf = gconf_client_get_default ();
+ printf ("message display style: %s\n", path);
+
for (i = 0; i < MAIL_CONFIG_DISPLAY_MAX; i++) {
if (strstr (message_display_styles[i], path)) {
fb->mail_display->display_style = i;
@@ -2384,6 +2389,22 @@ hide_deleted_changed (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpo
}
static void
+message_style_changed (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data)
+{
+ extern char *message_display_styles[];
+ FolderBrowser *fb = user_data;
+ const char *uipath;
+ int style;
+
+ if (fb->uicomp) {
+ style = gconf_client_get_int (client, "/apps/evolution/mail/display/message_style", NULL);
+ style = style >= 0 && style < MAIL_CONFIG_DISPLAY_MAX ? style : 0;
+ uipath = message_display_styles[style];
+ bonobo_ui_component_set_prop (fb->uicomp, uipath, "state", "1", NULL);
+ }
+}
+
+static void
folder_browser_gui_init (FolderBrowser *fb)
{
extern RuleContext *search_context;
@@ -2453,6 +2474,13 @@ folder_browser_gui_init (FolderBrowser *fb)
fb->show_preview_notify_id = gconf_client_notify_add (gconf, "/apps/evolution/mail/display/show_preview",
show_preview_changed, fb, NULL, NULL);
+ /* message display style */
+ gconf_client_add_dir (gconf, "/apps/evolution/mail/display/message_style",
+ GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
+
+ fb->message_style_notify_id = gconf_client_notify_add (gconf, "/apps/evolution/mail/display/message_style",
+ message_style_changed, fb, NULL, NULL);
+
/* paned size */
gconf_client_add_dir (gconf, "/apps/evolution/mail/display/paned_size",
GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
diff --git a/mail/folder-browser.h b/mail/folder-browser.h
index f9d0f1df3e..69aca02f9c 100644
--- a/mail/folder-browser.h
+++ b/mail/folder-browser.h
@@ -60,10 +60,11 @@ struct _FolderBrowser {
guint seen_id;
gulong paned_resize_id;
- guint paned_size_notify_id;
+ guint paned_size_notify_id;
guint show_preview_notify_id;
guint hide_deleted_notify_id;
+ guint message_style_notify_id;
/* a folder we are expunging, dont use other than to compare the pointer value */
CamelFolder *expunging;