diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2002-08-28 02:04:00 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2002-08-28 02:04:00 +0800 |
commit | 31a783d875c662650ee650afc6927d5751253194 (patch) | |
tree | 050fe3bdf72250d1f4f5608387086a4fb1d5e39c /mail/folder-browser.c | |
parent | f60610933f5b69c5dda03a3aa6dfa239d225e79d (diff) | |
download | gsoc2013-evolution-31a783d875c662650ee650afc6927d5751253194.tar.gz gsoc2013-evolution-31a783d875c662650ee650afc6927d5751253194.tar.zst gsoc2013-evolution-31a783d875c662650ee650afc6927d5751253194.zip |
Fixes for bug #4480
2002-08-27 Jeffrey Stedfast <fejj@ximian.com>
Fixes for bug #4480
* folder-browser-factory.c (control_activate): Call
folder_browser_reload() instead of refreshing the folder
ourselves.
* folder-browser.c (folder_browser_reload): New convenience
function. If the folder-browser's folder is already loaded,
refresh the contents, otherwise if the folder has not been loaded
- try loading the folder again (it may have failed to open last
time for some reason?).
svn path=/trunk/; revision=17876
Diffstat (limited to 'mail/folder-browser.c')
-rw-r--r-- | mail/folder-browser.c | 47 |
1 files changed, 31 insertions, 16 deletions
diff --git a/mail/folder-browser.c b/mail/folder-browser.c index 381b48c47c..1ef7039d7c 100644 --- a/mail/folder-browser.c +++ b/mail/folder-browser.c @@ -21,6 +21,7 @@ * */ + #ifdef HAVE_CONFIG_H #include <config.h> #endif @@ -833,12 +834,12 @@ static void folder_changed(CamelObject *o, void *event_data, void *data) } static void -got_folder(char *uri, CamelFolder *folder, void *data) +got_folder (char *uri, CamelFolder *folder, void *data) { FolderBrowser *fb = data; - + fb->get_id = -1; - + d(printf ("got folder '%s' = %p, previous folder was %p\n", uri, folder, fb->folder)); if (fb->message_list == NULL) @@ -855,27 +856,41 @@ got_folder(char *uri, CamelFolder *folder, void *data) folder_browser_is_drafts (fb) || folder_browser_is_sent (fb) || folder_browser_is_outbox (fb)); - - camel_object_hook_event(CAMEL_OBJECT(fb->folder), "folder_changed", - folder_changed, fb); - camel_object_hook_event(CAMEL_OBJECT(fb->folder), "message_changed", - folder_changed, fb); - + + camel_object_hook_event (CAMEL_OBJECT (fb->folder), "folder_changed", + folder_changed, fb); + camel_object_hook_event (CAMEL_OBJECT (fb->folder), "message_changed", + folder_changed, fb); + if (fb->view_instance != NULL && fb->view_menus != NULL) folder_browser_ui_discard_view_menus (fb); - + folder_browser_ui_setup_view_menus (fb); - + /* when loading a new folder, nothing is selected initially */ - + if (fb->uicomp) folder_browser_ui_set_selection_state (fb, FB_SELSTATE_NONE); - + done: gtk_signal_emit (GTK_OBJECT (fb), folder_browser_signals [FOLDER_LOADED], fb->uri); gtk_object_unref (GTK_OBJECT (fb)); } + +void +folder_browser_reload (FolderBrowser *fb) +{ + g_return_if_fail (IS_FOLDER_BROWSER (fb)); + + if (fb->folder) { + mail_refresh_folder (fb->folder, NULL, NULL); + } else if (fb->uri) { + gtk_object_ref (GTK_OBJECT (fb)); + fb->get_id = mail_get_folder (fb->uri, 0, got_folder, fb, mail_thread_new); + } +} + void folder_browser_set_folder (FolderBrowser *fb, CamelFolder *folder, const char *uri) { @@ -2433,9 +2448,9 @@ my_folder_browser_init (GtkObject *object) fb->view_instance = NULL; fb->view_menus = NULL; - + fb->pref_master = FALSE; - + /* * Setup parent class fields. */ @@ -2538,7 +2553,7 @@ folder_browser_new (const GNOME_Evolution_Shell shell, const char *uri) folder_browser->get_id = mail_get_folder (folder_browser->uri, 0, got_folder, folder_browser, mail_thread_new); } - + return GTK_WIDGET (folder_browser); } |