diff options
author | Not Zed <NotZed@Ximian.com> | 2003-03-24 21:27:32 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2003-03-24 21:27:32 +0800 |
commit | 33e87f5331e8cbdd3b3b9713bbe7446882e3ca37 (patch) | |
tree | aedcf6d61636003f743d2b37fa905a7f6315b266 /mail/folder-browser.c | |
parent | ed0a0ca71623bdfdca4afe145038995c4bf83560 (diff) | |
download | gsoc2013-evolution-33e87f5331e8cbdd3b3b9713bbe7446882e3ca37.tar gsoc2013-evolution-33e87f5331e8cbdd3b3b9713bbe7446882e3ca37.tar.gz gsoc2013-evolution-33e87f5331e8cbdd3b3b9713bbe7446882e3ca37.tar.bz2 gsoc2013-evolution-33e87f5331e8cbdd3b3b9713bbe7446882e3ca37.tar.lz gsoc2013-evolution-33e87f5331e8cbdd3b3b9713bbe7446882e3ca37.tar.xz gsoc2013-evolution-33e87f5331e8cbdd3b3b9713bbe7446882e3ca37.tar.zst gsoc2013-evolution-33e87f5331e8cbdd3b3b9713bbe7446882e3ca37.zip |
Load per-folder setting of show_preview from meta data.
2003-03-25 Not Zed <NotZed@Ximian.com>
* folder-browser-ui.c (folder_browser_ui_add_global): Load
per-folder setting of show_preview from meta data.
(folder_browser_ui_add_list): Same, for thread_list.
* mail-tools.c (mail_tool_get_meta_data)
(mail_tool_delete_meta_data): helpers to lookup/delete meta data.
* mail-config.c (mail_config_uri_deleted): delete the meta-data
for the folder.
* folder-browser.c (folder_browser_reload): dont reload the uri if
we're in the process of loading it still.
(folder_browser_new): load the folder meta data before loading the
folder.
(folder_browser_toggle_preview):
(folder_browser_toggle_threads): save change to meta-data.
(got_folder): Load the metadata if we have a folder to set, and
the meta-data has changed from initislisation.
svn path=/trunk/; revision=20478
Diffstat (limited to 'mail/folder-browser.c')
-rw-r--r-- | mail/folder-browser.c | 55 |
1 files changed, 36 insertions, 19 deletions
diff --git a/mail/folder-browser.c b/mail/folder-browser.c index 3f6930cd10..eeb464803a 100644 --- a/mail/folder-browser.c +++ b/mail/folder-browser.c @@ -56,6 +56,7 @@ #include "e-util/e-sexp.h" #include "e-util/e-mktemp.h" +#include "e-util/e-meta.h" #include "folder-browser.h" #include "e-searching-tokenizer.h" #include "mail.h" @@ -865,7 +866,8 @@ static void got_folder (char *uri, CamelFolder *folder, void *user_data) { FolderBrowser *fb = user_data; - + EMeta *meta; + fb->get_id = -1; d(printf ("got folder '%s' = %p, previous folder was %p\n", uri, folder, fb->folder)); @@ -878,12 +880,26 @@ got_folder (char *uri, CamelFolder *folder, void *user_data) camel_object_unhook_event (fb->folder, "message_changed", folder_changed, fb); camel_object_unref (fb->folder); } - - fb->folder = folder; - if (folder == NULL) + + if (folder) { + fb->folder = folder; + camel_object_ref (folder); + meta = mail_tool_get_meta_data(fb->uri); + if (meta != fb->meta) { + g_object_unref(fb->meta); + fb->meta = meta; + } else { + g_object_unref(meta); + } + } else { + fb->folder = NULL; + if (fb->meta) { + g_object_unref(fb->meta); + fb->meta = NULL; + } goto done; - - camel_object_ref (folder); + } + gtk_widget_set_sensitive (GTK_WIDGET (fb->search), camel_folder_has_search_capability (folder)); message_list_set_folder (fb->message_list, folder, @@ -919,7 +935,7 @@ folder_browser_reload (FolderBrowser *fb) if (fb->folder) { mail_refresh_folder (fb->folder, NULL, NULL); - } else if (fb->uri) { + } else if (fb->uri && fb->get_id == -1) { g_object_ref (fb); fb->get_id = mail_get_folder (fb->uri, 0, got_folder, fb, mail_thread_new); } @@ -1280,14 +1296,15 @@ folder_browser_toggle_preview (BonoboUIComponent *component, gpointer user_data) { FolderBrowser *fb = user_data; - GConfClient *gconf; - + gboolean bstate; + if (type != Bonobo_UIComponent_STATE_CHANGED || fb->message_list == NULL) return; - gconf = gconf_client_get_default (); - gconf_client_set_bool (gconf, "/apps/evolution/mail/display/show_preview", atoi (state), NULL); - folder_browser_set_message_preview (fb, atoi (state)); + bstate = atoi(state); + e_meta_set_bool(fb->meta, "show_preview", bstate); + gconf_client_set_bool (gconf_client_get_default(), "/apps/evolution/mail/display/show_preview", bstate, NULL); + folder_browser_set_message_preview (fb, bstate); } void @@ -1298,17 +1315,16 @@ folder_browser_toggle_threads (BonoboUIComponent *component, gpointer user_data) { FolderBrowser *fb = user_data; - GConfClient *gconf; int prev_state; + gboolean bstate; if (type != Bonobo_UIComponent_STATE_CHANGED || fb->message_list == NULL) return; - - gconf = gconf_client_get_default (); - gconf_client_set_bool (gconf, "/apps/evolution/mail/display/thread_list", - atoi (state), NULL); - - message_list_set_threaded (fb->message_list, atoi (state)); + + bstate = atoi(state); + e_meta_set_bool(fb->meta, "thread_list", bstate); + gconf_client_set_bool (gconf_client_get_default (), "/apps/evolution/mail/display/thread_list", bstate, NULL); + message_list_set_threaded (fb->message_list, bstate); prev_state = fb->selection_state; fb->selection_state = FB_SELSTATE_UNDEFINED; @@ -2608,6 +2624,7 @@ folder_browser_new (const GNOME_Evolution_Shell shell, const char *uri) if (uri) { folder_browser->uri = g_strdup (uri); + folder_browser->meta = mail_tool_get_meta_data(uri); g_object_ref (folder_browser); folder_browser->get_id = mail_get_folder (folder_browser->uri, 0, got_folder, folder_browser, mail_thread_new); |