diff options
author | Not Zed <NotZed@Ximian.com> | 2004-04-08 16:00:06 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2004-04-08 16:00:06 +0800 |
commit | 60f26ddd1a06fc251a56b34c4fc7aac0d0171cec (patch) | |
tree | 71fedcf8e6729cf66ce018dccd39ae8c33af39cb /mail | |
parent | 313439d717171d45c9e2444e2128939c524f2d9c (diff) | |
download | gsoc2013-evolution-60f26ddd1a06fc251a56b34c4fc7aac0d0171cec.tar.gz gsoc2013-evolution-60f26ddd1a06fc251a56b34c4fc7aac0d0171cec.tar.zst gsoc2013-evolution-60f26ddd1a06fc251a56b34c4fc7aac0d0171cec.zip |
VJUNK_FOLDER's dont exist, they're VTRASH folders now.
2004-04-08 Not Zed <NotZed@Ximian.com>
* mail-folder-cache.c:
(update_1folder): VJUNK_FOLDER's dont exist, they're VTRASH
folders now.
* em-folder-view.c: remove message_changed stuff from camel folder
stuff.
* mail-component.c (mail_component_init): don't setup the search
context here, wait till its requested. Fixes #56672.
2004-04-07 Not Zed <NotZed@Ximian.com>
* mail-component.c (view_changed_cb): hook to update the info
label when the folderview changes.
* em-folder-view.c (emfv_class_init): added 2 signals 'loaded' and
'changed'. For when a folder is set/cleared or when some state
changes.
(emfv_set_folder): emit LOADED signal when we set the folder.
(emfv_list_message_selected): emit changed event.
(emfv_gui_folder_changed): emit changed event.
svn path=/trunk/; revision=25369
Diffstat (limited to 'mail')
-rw-r--r-- | mail/ChangeLog | 24 | ||||
-rw-r--r-- | mail/em-folder-view.c | 42 | ||||
-rw-r--r-- | mail/em-folder-view.h | 3 | ||||
-rw-r--r-- | mail/mail-component.c | 43 | ||||
-rw-r--r-- | mail/mail-folder-cache.c | 21 | ||||
-rw-r--r-- | mail/message-list.c | 23 |
6 files changed, 95 insertions, 61 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 2b90eb8889..7614b2cbcb 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,27 @@ +2004-04-08 Not Zed <NotZed@Ximian.com> + + * mail-folder-cache.c: + (update_1folder): VJUNK_FOLDER's dont exist, they're VTRASH + folders now. + + * em-folder-view.c: remove message_changed stuff from camel folder + stuff. + + * mail-component.c (mail_component_init): don't setup the search + context here, wait till its requested. Fixes #56672. + +2004-04-07 Not Zed <NotZed@Ximian.com> + + * mail-component.c (view_changed_cb): hook to update the info + label when the folderview changes. + + * em-folder-view.c (emfv_class_init): added 2 signals 'loaded' and + 'changed'. For when a folder is set/cleared or when some state + changes. + (emfv_set_folder): emit LOADED signal when we set the folder. + (emfv_list_message_selected): emit changed event. + (emfv_gui_folder_changed): emit changed event. + 2004-04-07 Jeffrey Stedfast <fejj@ximian.com> * em-folder-tree.c (emft_tree_button_press): Check that diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c index 418d8f0446..0d041d0117 100644 --- a/mail/em-folder-view.c +++ b/mail/em-folder-view.c @@ -82,7 +82,6 @@ #include "evolution-shell-component-utils.h" /* Pixmap stuff, sigh */ static void emfv_folder_changed(CamelFolder *folder, CamelFolderChangeInfo *changes, EMFolderView *emfv); -static void emfv_message_changed(CamelFolder *folder, const char *uid, EMFolderView *emfv); static void emfv_list_message_selected(MessageList *ml, const char *uid, EMFolderView *emfv); static int emfv_list_right_click(ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, EMFolderView *emfv); @@ -114,7 +113,7 @@ struct _EMFolderViewPrivate { guint seen_id; guint setting_notify_id; - CamelObjectHookID folder_changed_id, message_changed_id; + CamelObjectHookID folder_changed_id; GtkWidget *invisible; char *selection_uri; @@ -124,6 +123,8 @@ static GtkVBoxClass *emfv_parent; enum { EMFV_ON_URL, + EMFV_LOADED, + EMFV_CHANGED, LAST_SIGNAL }; @@ -187,8 +188,6 @@ emfv_finalise(GObject *o) if (emfv->folder) { if (p->folder_changed_id) camel_object_remove_event(emfv->folder, p->folder_changed_id); - if (p->message_changed_id) - camel_object_remove_event(emfv->folder, p->message_changed_id); camel_object_unref(emfv->folder); g_free(emfv->folder_uri); } @@ -257,6 +256,24 @@ emfv_class_init(GObjectClass *klass) em_marshal_VOID__STRING_STRING, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING); + + signals[EMFV_LOADED] = g_signal_new("loaded", + G_OBJECT_CLASS_TYPE(klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(EMFolderViewClass, loaded), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, + 0); + + signals[EMFV_CHANGED] = g_signal_new("changed", + G_OBJECT_CLASS_TYPE(klass), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(EMFolderViewClass, on_url), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, + 0); } GType @@ -369,7 +386,6 @@ emfv_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri) if (emfv->folder) { mail_sync_folder (emfv->folder, NULL, NULL); camel_object_remove_event(emfv->folder, emfv->priv->folder_changed_id); - camel_object_remove_event(emfv->folder, emfv->priv->message_changed_id); camel_object_unref(emfv->folder); } @@ -377,12 +393,13 @@ emfv_set_folder(EMFolderView *emfv, CamelFolder *folder, const char *uri) if (folder) { emfv->priv->folder_changed_id = camel_object_hook_event(folder, "folder_changed", (CamelObjectEventHookFunc)emfv_folder_changed, emfv); - emfv->priv->message_changed_id = camel_object_hook_event(folder, "message_changed", - (CamelObjectEventHookFunc)emfv_message_changed, emfv); camel_object_ref(folder); } emfv_enable_menus(emfv); + + /* TODO: should probably be called after all processing, not just this class's impl */ + g_signal_emit(emfv, signals[EMFV_LOADED], 0); } static void @@ -1803,6 +1820,8 @@ emfv_list_message_selected(MessageList *ml, const char *uid, EMFolderView *emfv) } emfv_enable_menus(emfv); + + g_signal_emit(emfv, signals[EMFV_CHANGED], 0); } static void @@ -1965,6 +1984,8 @@ static void emfv_gui_folder_changed(CamelFolder *folder, void *dummy, EMFolderView *emfv) { emfv_enable_menus(emfv); + + g_signal_emit(emfv, signals[EMFV_LOADED], 0); g_object_unref(emfv); } @@ -1975,13 +1996,6 @@ emfv_folder_changed(CamelFolder *folder, CamelFolderChangeInfo *changes, EMFolde mail_async_event_emit(emfv->async, MAIL_ASYNC_GUI, (MailAsyncFunc)emfv_gui_folder_changed, folder, NULL, emfv); } -static void -emfv_message_changed(CamelFolder *folder, const char *uid, EMFolderView *emfv) -{ - g_object_ref(emfv); - mail_async_event_emit(emfv->async, MAIL_ASYNC_GUI, (MailAsyncFunc)emfv_gui_folder_changed, folder, NULL, emfv); -} - /* keep these two tables in sync */ enum { EMFV_ANIMATE_IMAGES = 1, diff --git a/mail/em-folder-view.h b/mail/em-folder-view.h index 31dd8a13dd..bae624a6fc 100644 --- a/mail/em-folder-view.h +++ b/mail/em-folder-view.h @@ -101,6 +101,9 @@ struct _EMFolderViewClass { /* Signals */ void (*on_url)(EMFolderView *emfv, const char *uri, const char *nice_uri); + + void (*loaded)(EMFolderView *emfv); + void (*changed)(EMFolderView *emfv); }; GType em_folder_view_get_type(void); diff --git a/mail/mail-component.c b/mail/mail-component.c index bb7c19979f..ee1bfccc74 100644 --- a/mail/mail-component.c +++ b/mail/mail-component.c @@ -44,6 +44,8 @@ #include "em-folder-selection.h" #include "em-migrate.h" +#include "widgets/misc/e-info-label.h" + #include "filter/rule-context.h" #include "mail-config.h" #include "mail-component.h" @@ -448,6 +450,24 @@ view_on_url (GObject *emitter, const char *url, const char *nice_url, MailCompon e_activity_handler_set_message (priv->activity_handler, nice_url); } +static void +view_changed_cb(EMFolderView *emfv, EInfoLabel *el) +{ + if (emfv->folder) { + char *tmp, *name; + guint32 total, unread; + + camel_object_get(emfv->folder, NULL, CAMEL_FOLDER_NAME, &name, CAMEL_FOLDER_TOTAL, &total, CAMEL_FOLDER_UNREAD, &unread, NULL); + /* Format of text for component information area */ + tmp = g_strdup_printf(_("%d total, %d unread"), total, unread); + e_info_label_set_info(el, name, tmp); + g_free(tmp); + camel_object_free(emfv->folder, CAMEL_FOLDER_NAME, name); + } else { + e_info_label_set_info(el, _("Mail"), ""); + } +} + /* Evolution::Component CORBA methods. */ static void @@ -462,7 +482,7 @@ impl_createControls (PortableServer_Servant servant, BonoboControl *tree_control; BonoboControl *view_control; BonoboControl *statusbar_control; - GtkWidget *tree_widget; + GtkWidget *tree_widget, *vbox, *info; GtkWidget *view_widget; GtkWidget *statusbar_widget; @@ -484,8 +504,19 @@ impl_createControls (PortableServer_Servant servant, gtk_widget_show (tree_widget); gtk_widget_show (view_widget); gtk_widget_show (statusbar_widget); - - tree_control = bonobo_control_new (tree_widget); + + printf("setting up info area\n"); + + vbox = gtk_vbox_new(FALSE, 0); + info = e_info_label_new("evolution-inbox-mini.png"); + e_info_label_set_info((EInfoLabel *)info, _("Mail"), ""); + gtk_box_pack_start((GtkBox *)vbox, info, FALSE, TRUE, 0); + gtk_box_pack_start((GtkBox *)vbox, tree_widget, TRUE, TRUE, 0); + + gtk_widget_show(info); + gtk_widget_show(vbox); + + tree_control = bonobo_control_new (vbox); view_control = bonobo_control_new (view_widget); statusbar_control = bonobo_control_new (statusbar_widget); @@ -494,8 +525,10 @@ impl_createControls (PortableServer_Servant servant, *corba_statusbar_control = CORBA_Object_duplicate (BONOBO_OBJREF (statusbar_control), ev); g_signal_connect (view_control, "activate", G_CALLBACK (view_control_activate_cb), view_widget); - g_signal_connect (tree_widget, "folder-selected", G_CALLBACK (folder_selected_cb), view_widget); + + g_signal_connect(view_widget, "changed", G_CALLBACK(view_changed_cb), info); + g_signal_connect(view_widget, "loaded", G_CALLBACK(view_changed_cb), info); } static CORBA_boolean @@ -731,8 +764,6 @@ mail_component_init (MailComponent *component) mail_autoreceive_setup(); - setup_search_context (component); - offline = mail_offline_handler_new(); bonobo_object_add_interface((BonoboObject *)component, (BonoboObject *)offline); } diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c index b6b0f86b4b..799d909890 100644 --- a/mail/mail-folder-cache.c +++ b/mail/mail-folder-cache.c @@ -109,7 +109,6 @@ struct _store_info { static void folder_changed(CamelObject *o, gpointer event_data, gpointer user_data); static void folder_renamed(CamelObject *o, gpointer event_data, gpointer user_data); static void folder_finalised(CamelObject *o, gpointer event_data, gpointer user_data); -static void message_changed (CamelObject *o, gpointer event_data, gpointer user_data); static guint ping_id = 0; static gboolean ping_cb (gpointer user_data); @@ -269,7 +268,6 @@ unset_folder_info(struct _folder_info *mfi, int delete, int unsub) CamelFolder *folder = mfi->folder; camel_object_unhook_event(folder, "folder_changed", folder_changed, mfi); - camel_object_unhook_event(folder, "message_changed", message_changed, mfi); camel_object_unhook_event(folder, "renamed", folder_renamed, mfi); camel_object_unhook_event(folder, "finalize", folder_finalised, mfi); } @@ -307,8 +305,7 @@ free_folder_info(struct _folder_info *mfi) * one folder at a time.) But it doesn't have any way to know when * it's lying, so it's only safe to call it when you know for sure * that the store is paying attention to the folder, such as when it's - * just been created, or you get a folder_changed or message_changed - * signal on it. + * just been created, or you get a folder_changed signal on it. * * camel_store_get_folder_info() always gives correct answers for the * folders it checks, but it can also return -1 for a folder, meaning @@ -336,7 +333,7 @@ update_1folder(struct _folder_info *mfi, int new, CamelFolderInfo *info) folder = mfi->folder; if (folder) { d(printf("update 1 folder '%s'\n", folder->full_name)); - if ((count_trash && (CAMEL_IS_VTRASH_FOLDER (folder) || CAMEL_IS_VJUNK_FOLDER (folder))) + if ((count_trash && (CAMEL_IS_VTRASH_FOLDER (folder))) || folder == mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_OUTBOX) || (count_sent && folder == mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_SENT))) { d(printf(" total count\n")); @@ -448,19 +445,6 @@ folder_changed (CamelObject *o, gpointer event_data, gpointer user_data) } static void -message_changed (CamelObject *o, gpointer event_data, gpointer user_data) -{ - struct _folder_info *mfi = user_data; - - if (mfi->folder != CAMEL_FOLDER (o)) - return; - - LOCK(info_lock); - update_1folder(mfi, 0, NULL); - UNLOCK(info_lock); -} - -static void folder_finalised(CamelObject *o, gpointer event_data, gpointer user_data) { struct _folder_info *mfi = user_data; @@ -512,7 +496,6 @@ void mail_note_folder(CamelFolder *folder) mfi->folder = folder; camel_object_hook_event(folder, "folder_changed", folder_changed, mfi); - camel_object_hook_event(folder, "message_changed", message_changed, mfi); camel_object_hook_event(folder, "renamed", folder_renamed, mfi); camel_object_hook_event(folder, "finalize", folder_finalised, mfi); diff --git a/mail/message-list.c b/mail/message-list.c index f29971dfa2..002b50c0bd 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -22,7 +22,6 @@ * */ - #ifdef HAVE_CONFIG_H #include <config.h> #endif @@ -154,7 +153,6 @@ static char *filter_date (time_t date); static char *filter_size (int size); static void folder_changed (CamelObject *o, gpointer event_data, gpointer user_data); -static void message_changed (CamelObject *o, gpointer event_data, gpointer user_data); static void save_hide_state(MessageList *ml); static void load_hide_state(MessageList *ml); @@ -1650,7 +1648,6 @@ message_list_destroy(GtkObject *object) save_tree_state(message_list); save_hide_state(message_list); camel_object_unhook_event(message_list->folder, "folder_changed", folder_changed, message_list); - camel_object_unhook_event(message_list->folder, "message_changed", message_changed, message_list); camel_object_unref (message_list->folder); message_list->folder = NULL; } @@ -2506,19 +2503,6 @@ folder_changed (CamelObject *o, gpointer event_data, gpointer user_data) mail_async_event_emit(ml->async_event, MAIL_ASYNC_GUI, (MailAsyncFunc)main_folder_changed, o, changes, user_data); } -static void -message_changed (CamelObject *o, gpointer event_data, gpointer user_data) -{ - CamelFolderChangeInfo *changes; - MessageList *ml = MESSAGE_LIST (user_data); - - changes = camel_folder_change_info_new(); - camel_folder_change_info_change_uid(changes, (char *)event_data); - - mail_async_event_emit(ml->async_event, MAIL_ASYNC_GUI, (MailAsyncFunc)main_folder_changed, o, changes, user_data); -} - - /** * message_list_set_folder: * @message_list: Message List widget @@ -2569,8 +2553,6 @@ message_list_set_folder (MessageList *message_list, CamelFolder *folder, const c save_hide_state(message_list); camel_object_unhook_event((CamelObject *)message_list->folder, "folder_changed", folder_changed, message_list); - camel_object_unhook_event((CamelObject *)message_list->folder, "message_changed", - message_changed, message_list); camel_object_unref (message_list->folder); message_list->folder = NULL; } @@ -2618,10 +2600,7 @@ message_list_set_folder (MessageList *message_list, CamelFolder *folder, const c /* Build the etree suitable for this folder */ message_list_setup_etree (message_list, outgoing); - camel_object_hook_event (folder, "folder_changed", - folder_changed, message_list); - camel_object_hook_event (folder, "message_changed", - message_changed, message_list); + camel_object_hook_event (folder, "folder_changed", folder_changed, message_list); gconf = mail_config_get_gconf_client (); hide_deleted = !gconf_client_get_bool (gconf, "/apps/evolution/mail/display/show_deleted", NULL); |