diff options
-rw-r--r-- | mail/ChangeLog | 16 | ||||
-rw-r--r-- | mail/em-folder-browser.c | 40 | ||||
-rw-r--r-- | mail/em-folder-view.c | 63 | ||||
-rw-r--r-- | mail/em-folder-view.h | 5 | ||||
-rw-r--r-- | mail/mail-account-editor.c | 2 |
5 files changed, 63 insertions, 63 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 664b809101..e8d3f7869b 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,17 @@ +2004-05-10 Not Zed <NotZed@Ximian.com> + + * em-folder-view.c (emfv_activate): cleanup the view menus if they + were created. + + * em-folder-view.h: added list_active bit, means the view is + showing the list and needs e.g. view menus. + + * em-folder-view.c (emfv_setup_view_instance): was + create_view_instance. Now also setup the menu's if we're showing the list. + + * em-folder-browser.c (emfb_create_view_menus): removed. moved + functionality into emfolderview. + 2004-05-07 Jeffrey Stedfast <fejj@ximian.com> Fix for bug #57152. @@ -25,6 +39,8 @@ 2004-05-07 Not Zed <NotZed@Ximian.com> + * mail-account-editor.c: include missing header. + ** See bug #57935. * em-folder-view.c (emfv_set_message): add new arg, nomarkseen, diff --git a/mail/em-folder-browser.c b/mail/em-folder-browser.c index df15cb9230..d512351b9f 100644 --- a/mail/em-folder-browser.c +++ b/mail/em-folder-browser.c @@ -66,9 +66,6 @@ #include <widgets/misc/e-filter-bar.h> #include <camel/camel-search-private.h> -/* gal view crap */ -#include "widgets/menus/gal-view-menus.h" - #include "e-util/e-dialog-utils.h" #include "em-utils.h" #include "em-composer-utils.h" @@ -91,8 +88,6 @@ struct _EMFolderBrowserPrivate { GtkWidget *subscribe_editor; - GalViewMenus *view_menus; - guint search_menu_activated_id; guint search_activated_id; guint search_query_changed_id; @@ -169,6 +164,7 @@ emfb_init(GObject *o) p = emfb->priv = g_malloc0(sizeof(struct _EMFolderBrowserPrivate)); emfb->view.preview_active = TRUE; + emfb->view.list_active = TRUE; g_slist_free(emfb->view.ui_files); emfb->view.ui_files = g_slist_append(NULL, EVOLUTION_UIDIR "/evolution-mail-global.xml"); @@ -861,25 +857,6 @@ emfb_list_built (MessageList *ml, EMFolderBrowser *emfb) emfb->priv->idle_scroll_id = g_timeout_add_full (G_PRIORITY_LOW, 250, (GSourceFunc) scroll_idle_cb, emfb, NULL); } -/* TODO: All this mess should sit directly on MessageList, but it would - need to become BonoboUIComponent aware ... */ -static void -emfb_create_view_menus(EMFolderBrowser *emfb, BonoboUIComponent *uic) -{ - struct _EMFolderBrowserPrivate *p = emfb->priv; - - if (emfb->view.view_instance == NULL) - return; - - if (p->view_menus) { - g_object_unref(p->view_menus); - p->view_menus = NULL; - } - - p->view_menus = gal_view_menus_new (emfb->view.view_instance); - gal_view_menus_apply(p->view_menus, uic, NULL); -} - static void emfb_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri) { @@ -950,10 +927,6 @@ emfb_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri) if (emfv->list->cursor_uid == NULL && emfb->priv->list_built_id == 0) p->list_built_id = g_signal_connect(emfv->list, "message_list_built", G_CALLBACK (emfb_list_built), emfv); - - /* NOTE: This relies on our parent class setting up emfv->view_instance */ - if (emfv->uic) - emfb_create_view_menus (emfb, emfv->uic); } message_list_thaw(emfv->list); @@ -962,8 +935,6 @@ emfb_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri) static void emfb_activate(EMFolderView *emfv, BonoboUIComponent *uic, int act) { - struct _EMFolderBrowserPrivate *p = ((EMFolderBrowser *)emfv)->priv; - if (act) { GConfClient *gconf; gboolean state; @@ -1038,21 +1009,12 @@ emfb_activate(EMFolderView *emfv, BonoboUIComponent *uic, int act) if (((EMFolderBrowser *)emfv)->search) e_search_bar_set_ui_component((ESearchBar *)((EMFolderBrowser *)emfv)->search, uic); - - /* NOTE: This relies on our parent class setting up emfv->view_instance */ - if (emfv->folder) - emfb_create_view_menus((EMFolderBrowser *)emfv, uic); } else { const BonoboUIVerb *v; for (v = &emfb_verbs[0]; v->cname; v++) bonobo_ui_component_remove_verb(uic, v->cname); - if (p->view_menus) { - g_object_unref(p->view_menus); - p->view_menus = NULL; - } - if (((EMFolderBrowser *)emfv)->search) e_search_bar_set_ui_component((ESearchBar *)((EMFolderBrowser *)emfv)->search, NULL); diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c index cb55b049fc..fae2f6f11f 100644 --- a/mail/em-folder-view.c +++ b/mail/em-folder-view.c @@ -42,6 +42,8 @@ #include <gal/menus/gal-view-etable.h> #include <gal/menus/gal-view-factory-etable.h> +#include <gal/menus/gal-view-instance.h> +#include "widgets/menus/gal-view-menus.h" #include <camel/camel-mime-message.h> #include <camel/camel-stream.h> @@ -127,6 +129,9 @@ struct _EMFolderViewPrivate { GtkWidget *invisible; char *selection_uri; + + GalViewInstance *view_instance; + GalViewMenus *view_menus; }; static GtkVBoxClass *emfv_parent; @@ -155,6 +160,7 @@ emfv_init(GObject *o) p = emfv->priv = g_malloc0(sizeof(struct _EMFolderViewPrivate)); emfv->statusbar_active = TRUE; + emfv->list_active = FALSE; emfv->ui_files = g_slist_append(NULL, EVOLUTION_UIDIR "/evolution-mail-message.xml"); emfv->ui_app_name = "evolution-mail"; @@ -378,8 +384,6 @@ em_folder_view_open_selected(EMFolderView *emfv) } /* ******************************************************************************** */ -static GalViewCollection *collection = NULL; - static void emfv_list_display_view(GalViewInstance *instance, GalView *view, EMFolderView *emfv) { @@ -388,10 +392,12 @@ emfv_list_display_view(GalViewInstance *instance, GalView *view, EMFolderView *e } static void -emfv_create_view_instance(EMFolderView *emfv) +emfv_setup_view_instance(EMFolderView *emfv) { + struct _EMFolderViewPrivate *p = emfv->priv; gboolean outgoing; char *id; + static GalViewCollection *collection = NULL; g_assert(emfv->folder); g_assert(emfv->folder_uri); @@ -421,27 +427,32 @@ emfv_create_view_instance(EMFolderView *emfv) gal_view_collection_load (collection); } - - if (emfv->view_instance) { - g_object_unref(emfv->view_instance); - emfv->view_instance = NULL; + + if (p->view_instance) { + g_object_unref(p->view_instance); + p->view_instance = NULL; } - + + if (p->view_menus) { + g_object_unref(p->view_menus); + p->view_menus = NULL; + } + outgoing = em_utils_folder_is_drafts (emfv->folder, emfv->folder_uri) || em_utils_folder_is_sent (emfv->folder, emfv->folder_uri) || em_utils_folder_is_outbox (emfv->folder, emfv->folder_uri); /* TODO: should this go through mail-config api? */ id = mail_config_folder_to_safe_url (emfv->folder); - emfv->view_instance = gal_view_instance_new (collection, id); + p->view_instance = gal_view_instance_new (collection, id); g_free (id); if (outgoing) - gal_view_instance_set_default_view (emfv->view_instance, "As_Sent_Folder"); + gal_view_instance_set_default_view(p->view_instance, "As_Sent_Folder"); - gal_view_instance_load (emfv->view_instance); + gal_view_instance_load(p->view_instance); - if (!gal_view_instance_exists (emfv->view_instance)) { + if (!gal_view_instance_exists(p->view_instance)) { struct stat st; char *path; @@ -461,15 +472,20 @@ emfv_create_view_instance(EMFolderView *emfv) gal_view_etable_set_state (GAL_VIEW_ETABLE (view), state); g_object_unref (state); - gal_view_instance_set_custom_view (emfv->view_instance, view); + gal_view_instance_set_custom_view(p->view_instance, view); g_object_unref (view); } g_free (path); } + + g_signal_connect(p->view_instance, "display_view", G_CALLBACK(emfv_list_display_view), emfv); + emfv_list_display_view(p->view_instance, gal_view_instance_get_current_view(p->view_instance), emfv); - g_signal_connect (emfv->view_instance, "display_view", G_CALLBACK (emfv_list_display_view), emfv); - emfv_list_display_view (emfv->view_instance, gal_view_instance_get_current_view (emfv->view_instance), emfv); + if (emfv->list_active && emfv->uic) { + p->view_menus = gal_view_menus_new(p->view_instance); + gal_view_menus_apply(p->view_menus, emfv->uic, NULL); + } } /* ********************************************************************** */ @@ -506,7 +522,7 @@ emfv_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri) camel_object_ref(folder); mail_refresh_folder(folder, NULL, NULL); /* We need to set this up to get the right view options for the message-list, even if we're not showing it */ - emfv_create_view_instance(emfv); + emfv_setup_view_instance(emfv); } emfv_enable_menus(emfv); @@ -1708,6 +1724,8 @@ emfv_charset_changed(BonoboUIComponent *uic, const char *path, Bonobo_UIComponen static void emfv_activate(EMFolderView *emfv, BonoboUIComponent *uic, int act) { + struct _EMFolderViewPrivate *p = emfv->priv; + if (act) { em_format_mode_t style; gboolean state; @@ -1744,7 +1762,7 @@ emfv_activate(EMFolderView *emfv, BonoboUIComponent *uic, int act) /* We need to set this up to get the right view options for the message-list, even if we're not showing it */ if (emfv->folder) - emfv_create_view_instance(emfv); + emfv_setup_view_instance(emfv); } else { const BonoboUIVerb *v; @@ -1752,9 +1770,14 @@ emfv_activate(EMFolderView *emfv, BonoboUIComponent *uic, int act) for (v = &emfv_message_verbs[0]; v->cname; v++) bonobo_ui_component_remove_verb(uic, v->cname); - if (emfv->view_instance) { - g_object_unref(emfv->view_instance); - emfv->view_instance = NULL; + if (p->view_instance) { + g_object_unref(p->view_instance); + p->view_instance = NULL; + } + + if (p->view_menus) { + g_object_unref(p->view_menus); + p->view_menus = NULL; } if (emfv->folder) diff --git a/mail/em-folder-view.h b/mail/em-folder-view.h index 4a84eadf33..279e9ab0ea 100644 --- a/mail/em-folder-view.h +++ b/mail/em-folder-view.h @@ -32,9 +32,6 @@ extern "C" { #pragma } #endif /* __cplusplus */ -/* @#$@#$Q@#$@Q!EQ#@$!~!!! GAL, defines its structs anonymously so we need to include this directly, sigh */ -#include <gal/menus/gal-view-instance.h> - struct _MessageList; struct _EMFormatHTMLDisplay; struct _CamelFolder; @@ -64,7 +61,6 @@ struct _EMFolderView { struct _EMFolderViewPrivate *priv; struct _MessageList *list; - GalViewInstance *view_instance; struct _EMFormatHTMLDisplay *preview; @@ -89,6 +85,7 @@ struct _EMFolderView { int preview_active:1; /* is preview being used */ int statusbar_active:1; /* should we manage the statusbar messages ourselves? */ int hide_deleted:1; + int list_active:1; /* we actually showing the list? */ }; struct _EMFolderViewClass { diff --git a/mail/mail-account-editor.c b/mail/mail-account-editor.c index 963ba36498..8b2b5a8861 100644 --- a/mail/mail-account-editor.c +++ b/mail/mail-account-editor.c @@ -37,6 +37,8 @@ #include <gtk/gtknotebook.h> #include <gtk/gtkstock.h> +#include "widgets/misc/e-error.h" + #include "em-account-prefs.h" #include "mail-config.h" #include "mail-account-editor.h" |