diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2003-01-09 04:34:53 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2003-01-09 04:34:53 +0800 |
commit | 5c49bda7d167c71419950f0dc081a5b8ec56ee68 (patch) | |
tree | 079448c5aa4e91b39e43db079a672c712f9d8e0f | |
parent | ac80365c860bc263b183a76a5f035779b60f100f (diff) | |
download | gsoc2013-evolution-5c49bda7d167c71419950f0dc081a5b8ec56ee68.tar gsoc2013-evolution-5c49bda7d167c71419950f0dc081a5b8ec56ee68.tar.gz gsoc2013-evolution-5c49bda7d167c71419950f0dc081a5b8ec56ee68.tar.bz2 gsoc2013-evolution-5c49bda7d167c71419950f0dc081a5b8ec56ee68.tar.lz gsoc2013-evolution-5c49bda7d167c71419950f0dc081a5b8ec56ee68.tar.xz gsoc2013-evolution-5c49bda7d167c71419950f0dc081a5b8ec56ee68.tar.zst gsoc2013-evolution-5c49bda7d167c71419950f0dc081a5b8ec56ee68.zip |
Removed. (mail_config_set_show_preview): Removed.
2003-01-08 Jeffrey Stedfast <fejj@ximian.com>
* mail-config.c (mail_config_get_show_preview): Removed.
(mail_config_set_show_preview): Removed.
* folder-browser.c (folder_browser_toggle_preview): Simply set the
gconf show_preview setting and let the code in folder-browser-ui.c
detect it and update the UI.
* folder-browser-ui.c (folder_browser_ui_add_global): Listen for
changed events on the show_preview setting.
svn path=/trunk/; revision=19288
-rw-r--r-- | mail/ChangeLog | 10 | ||||
-rw-r--r-- | mail/folder-browser-ui.c | 34 | ||||
-rw-r--r-- | mail/folder-browser.c | 16 | ||||
-rw-r--r-- | mail/mail-config.c | 75 | ||||
-rw-r--r-- | mail/mail-config.h | 6 |
5 files changed, 48 insertions, 93 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 61723a00c8..845a641120 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,5 +1,15 @@ 2003-01-08 Jeffrey Stedfast <fejj@ximian.com> + * mail-config.c (mail_config_get_show_preview): Removed. + (mail_config_set_show_preview): Removed. + + * folder-browser.c (folder_browser_toggle_preview): Simply set the + gconf show_preview setting and let the code in folder-browser-ui.c + detect it and update the UI. + + * folder-browser-ui.c (folder_browser_ui_add_global): Listen for + changed events on the show_preview setting. + * mail-config.c (mail_config_set_default_account): Save the setting via gconf. (mail_config_add_account): Immediately save the list of accounts. diff --git a/mail/folder-browser-ui.c b/mail/folder-browser-ui.c index e9e56c1c93..0c8ecfd0d8 100644 --- a/mail/folder-browser-ui.c +++ b/mail/folder-browser-ui.c @@ -602,12 +602,24 @@ folder_browser_ui_rm_list (FolderBrowser *fb) folder_browser_ui_discard_view_menus (fb); } +static void +show_preview_changed (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data) +{ + FolderBrowser *fb = user_data; + gboolean show_preview; + + show_preview = gconf_client_get_bool (client, "/apps/evolution/mail/display/show_preview", NULL); + bonobo_ui_component_set_prop (fb->uicomp, "/commands/ViewPreview", "state", show_preview ? "1" : "0", NULL); + folder_browser_set_message_preview (fb, show_preview); +} + void folder_browser_ui_add_global (FolderBrowser *fb) { - int state; BonoboUIComponent *uic = fb->uicomp; - + gboolean show_preview; + GConfClient *gconf; + if (fb->sensitise_state) { g_hash_table_destroy (fb->sensitise_state); fb->sensitise_state = NULL; @@ -615,13 +627,25 @@ folder_browser_ui_add_global (FolderBrowser *fb) ui_add (fb, "global", global_verbs, global_pixcache); + gconf = gconf_client_get_default (); + /* (Pre)view toggle */ - state = mail_config_get_show_preview (FOLDER_BROWSER (fb)->uri); - bonobo_ui_component_set_prop (uic, "/commands/ViewPreview", "state", state ? "1" : "0", NULL); + /* watch the show_preview setting */ + gconf_client_add_dir (gconf, "/apps/evolution/mail/display/show_preview", + GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); + + /* listen for changed events to the show_preview setting */ + gconf_client_notify_add (gconf, "/apps/evolution/mail/display/show_preview", + show_preview_changed, fb, NULL, NULL); + + show_preview = gconf_client_get_bool (gconf, "/apps/evolution/mail/display/show_preview", NULL); + bonobo_ui_component_set_prop (uic, "/commands/ViewPreview", "state", show_preview ? "1" : "0", NULL); + + /* listen for user-changes */ bonobo_ui_component_add_listener (uic, "ViewPreview", folder_browser_toggle_preview, fb); /* FIXME: this kind of bypasses bonobo but seems the only way when we change components */ - folder_browser_toggle_preview (uic, "", Bonobo_UIComponent_STATE_CHANGED, state ? "1" : "0", fb); + folder_browser_toggle_preview (uic, "", Bonobo_UIComponent_STATE_CHANGED, show_preview ? "1" : "0", fb); /* Stop button */ /* TODO: Go through cache, but we can't becaus eof mail-mt.c:set_stop at the moment */ diff --git a/mail/folder-browser.c b/mail/folder-browser.c index 10ef9190fd..ee23c54c0b 100644 --- a/mail/folder-browser.c +++ b/mail/folder-browser.c @@ -1106,21 +1106,21 @@ set_cursor_pos (FolderBrowser *fb, int y) static gboolean do_message_selected(FolderBrowser *fb); void -folder_browser_set_message_preview (FolderBrowser *folder_browser, gboolean show_message_preview) +folder_browser_set_message_preview (FolderBrowser *folder_browser, gboolean show_preview) { GConfClient *gconf; int paned_size, y; - if (folder_browser->preview_shown == show_message_preview + if (folder_browser->preview_shown == show_preview || folder_browser->message_list == NULL) return; - folder_browser->preview_shown = show_message_preview; + folder_browser->preview_shown = show_preview; gconf = gconf_client_get_default (); paned_size = gconf_client_get_int (gconf, "/apps/evolution/mail/display/paned_size", NULL); - if (show_message_preview) { + if (show_preview) { y = save_cursor_pos (folder_browser); e_paned_set_position (E_PANED (folder_browser->vpaned), paned_size); gtk_widget_show (GTK_WIDGET (folder_browser->mail_display)); @@ -1261,13 +1261,13 @@ folder_browser_toggle_preview (BonoboUIComponent *component, gpointer user_data) { FolderBrowser *fb = user_data; + GConfClient *gconf; - if (type != Bonobo_UIComponent_STATE_CHANGED - || fb->message_list == NULL) + if (type != Bonobo_UIComponent_STATE_CHANGED || fb->message_list == NULL) return; - mail_config_set_show_preview (fb->uri, atoi (state)); - folder_browser_set_message_preview (fb, atoi (state)); + gconf = gconf_client_get_default (); + gconf_client_set_bool (gconf, "/apps/evolution/mail/display/show_preview", atoi (state), NULL); } void diff --git a/mail/mail-config.c b/mail/mail-config.c index 1c1783b8bd..78bea6fd29 100644 --- a/mail/mail-config.c +++ b/mail/mail-config.c @@ -80,7 +80,6 @@ typedef struct { GSList *accounts; GHashTable *threaded_hash; - GHashTable *preview_hash; GList *signature_list; int signatures; @@ -845,10 +844,6 @@ mail_config_write_on_exit (void) if (config->threaded_hash) g_hash_table_foreach_remove (config->threaded_hash, hash_save_state, "Threads"); - /* Message Preview */ - if (config->preview_hash) - g_hash_table_foreach_remove (config->preview_hash, hash_save_state, "Preview"); - /* Passwords */ /* then we make sure the ones we want to remember are in the @@ -921,65 +916,6 @@ uri_to_key (const char *uri) } gboolean -mail_config_get_show_preview (const char *uri) -{ -#warning "FIXME: need to rework how we save state, probably shouldn't use gconf" -#if 0 - if (uri && *uri) { - gpointer key, val; - char *dbkey; - - dbkey = uri_to_key (uri); - - if (!config->preview_hash) - config->preview_hash = g_hash_table_new (g_str_hash, g_str_equal); - - if (!g_hash_table_lookup_extended (config->preview_hash, dbkey, &key, &val)) { - gboolean value; - char *str; - - str = g_strdup_printf ("/apps/Evolution/Mail/Preview/%s", dbkey); - value = e_config_listener_get_boolean_with_default (config->db, str, TRUE, NULL); - g_free (str); - - g_hash_table_insert (config->preview_hash, dbkey, - GINT_TO_POINTER (value)); - - return value; - } else { - g_free (dbkey); - return GPOINTER_TO_INT (val); - } - } -#endif - - /* return the default value */ - - return gconf_client_get_bool (config->gconf, "/apps/evolution/mail/display/show_preview", NULL); -} - -void -mail_config_set_show_preview (const char *uri, gboolean value) -{ - if (uri && *uri) { - char *dbkey = uri_to_key (uri); - gpointer key, val; - - if (!config->preview_hash) - config->preview_hash = g_hash_table_new (g_str_hash, g_str_equal); - - if (g_hash_table_lookup_extended (config->preview_hash, dbkey, &key, &val)) { - g_hash_table_insert (config->preview_hash, dbkey, - GINT_TO_POINTER (value)); - g_free (dbkey); - } else { - g_hash_table_insert (config->preview_hash, dbkey, - GINT_TO_POINTER (value)); - } - } -} - -gboolean mail_config_get_thread_list (const char *uri) { #warning "FIXME: need to rework how we save state, probably shouldn't use gconf" @@ -1389,16 +1325,7 @@ mail_config_uri_renamed(GCompareFunc uri_cmp, const char *old, const char *new) g_hash_table_insert (config->threaded_hash, g_strdup(newkey), val); work = 2; } - - /* ditto */ - mail_config_get_show_preview (old); - if (g_hash_table_lookup_extended (config->preview_hash, oldkey, &hashkey, &val)) { - /*printf ("changing key in preview_hash\n");*/ - g_hash_table_remove (config->preview_hash, hashkey); - g_hash_table_insert (config->preview_hash, g_strdup(newkey), val); - work = 2; - } - + g_free (oldkey); g_free (newkey); diff --git a/mail/mail-config.h b/mail/mail-config.h index b0f6042d84..ab16c992f6 100644 --- a/mail/mail-config.h +++ b/mail/mail-config.h @@ -161,12 +161,6 @@ gboolean mail_config_is_corrupt (void); gboolean mail_config_get_thread_list (const char *uri); void mail_config_set_thread_list (const char *uri, gboolean value); -gboolean mail_config_get_thread_subject (void); -void mail_config_set_thread_subject (gboolean thread_subject); - -gboolean mail_config_get_show_preview (const char *uri); -void mail_config_set_show_preview (const char *uri, gboolean value); - const char *mail_config_get_label_name (int label); void mail_config_set_label_name (int label, const char *name); guint32 mail_config_get_label_color (int label); |