diff options
-rw-r--r-- | mail/ChangeLog | 14 | ||||
-rw-r--r-- | mail/folder-browser-factory.c | 11 | ||||
-rw-r--r-- | mail/folder-browser.c | 47 | ||||
-rw-r--r-- | mail/folder-browser.h | 23 |
4 files changed, 63 insertions, 32 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index ea598afafc..288d345a5f 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,17 @@ +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?). + 2002-08-27 Peter Williams <peterw@ximian.com> * mail-format.c (handle_text_plain_flowed): Fix bug #29493. diff --git a/mail/folder-browser-factory.c b/mail/folder-browser-factory.c index fa09a3e059..d99bbe2628 100644 --- a/mail/folder-browser-factory.c +++ b/mail/folder-browser-factory.c @@ -94,12 +94,11 @@ control_activate (BonoboControl *control, folder_browser_ui_add_message (fb); /*bonobo_ui_component_thaw (uic, NULL);*/ - - folder_browser_set_shell_view(fb, fb_get_svi (control)); - - if (fb->folder) - mail_refresh_folder (fb->folder, NULL, NULL); - + + folder_browser_set_shell_view (fb, fb_get_svi (control)); + + folder_browser_reload (fb); + e_search_bar_set_ui_component (E_SEARCH_BAR (fb->search), uic); } 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); } diff --git a/mail/folder-browser.h b/mail/folder-browser.h index 349dbb987b..dfd6ec89dd 100644 --- a/mail/folder-browser.h +++ b/mail/folder-browser.h @@ -52,12 +52,13 @@ struct _FolderBrowser { int unread_count; /* last known unread message count */ /* async loading stuff */ - char *loading_uid;/* what uid am i loading now */ - char *pending_uid; /* what uid should i load next */ - char *new_uid; /* place to save the next uid during idle timeout */ - char *loaded_uid; /* what we have loaded */ - guint loading_id, seen_id; - + char *loading_uid; /* what uid am i loading now */ + char *pending_uid; /* what uid should i load next */ + char *new_uid; /* place to save the next uid during idle timeout */ + char *loaded_uid; /* what we have loaded */ + guint loading_id; + guint seen_id; + /* a folder we are expunging, dont use other than to compare the pointer value */ CamelFolder *expunging; @@ -68,9 +69,9 @@ struct _FolderBrowser { EFilterBar *search; FilterRule *search_full; /* if we have a full search active */ - gboolean preview_shown; - gboolean threaded; - gboolean pref_master; + guint32 preview_shown : 1; + guint32 threaded : 1; + guint32 pref_master : 1; FolderBrowserSelectionState selection_state; GSList *sensitize_changes; @@ -89,7 +90,7 @@ struct _FolderBrowser { struct _MailAsyncEvent *async_event; int get_id; /* for getting folder op */ - + /* info used by popup for filter/vfolder */ struct _popup_filter_data *popup; }; @@ -125,6 +126,8 @@ void folder_browser_cut (GtkWidget *widget, FolderBrowser void folder_browser_copy (GtkWidget *widget, FolderBrowser *fb); void folder_browser_paste (GtkWidget *widget, FolderBrowser *fb); +void folder_browser_reload (FolderBrowser *fb); + /* callbacks for functions on the folder-browser */ void vfolder_subject (GtkWidget *w, FolderBrowser *fb); void vfolder_sender (GtkWidget *w, FolderBrowser *fb); |