diff options
-rw-r--r-- | mail/ChangeLog | 16 | ||||
-rw-r--r-- | mail/message-browser.c | 15 | ||||
-rw-r--r-- | mail/message-list.c | 24 | ||||
-rw-r--r-- | mail/message-list.h | 1 |
4 files changed, 47 insertions, 9 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index e7d5535db6..a917121f0e 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,19 @@ +2001-05-22 Jeffrey Stedfast <fejj@ximian.com> + + * message-browser.c (message_browser_folder_loaded): Instead of + calling message_list_select_uid() here, instead connect to the + "message_list_loaded" signal since the message-list is not built + yet at this point. + (message_browser_message_list_built): Call + message_list_select_uid() here instead. + + * message-list.c: Lets have a new signal, MESSAGE_LIST_BUILT, that + gets emitted when the message-list has finished being built by one + of the built_*() functions. + (message_list_class_init): Setup the signal stuff. + (regen_list_regened): Emit the signal here (should this perhaps be + moved into each of the build_*() functions instead?). + 2001-05-21 Kjartan Maraas <kmaraas@gnome.org> * mail-local.c: Mark a string for translation. diff --git a/mail/message-browser.c b/mail/message-browser.c index 0a63c49c91..71d3065914 100644 --- a/mail/message-browser.c +++ b/mail/message-browser.c @@ -171,13 +171,22 @@ message_browser_message_loaded (FolderBrowser *fb, const char *uid, MessageBrows } static void -message_browser_folder_loaded (FolderBrowser *fb, const char *uri, MessageBrowser *mb) +message_browser_message_list_built (MessageList *ml, MessageBrowser *mb) { const char *uid = gtk_object_get_data (GTK_OBJECT (mb), "uid"); - g_warning ("got 'folder_loaded' event"); + g_warning ("got 'message_list_built' event"); + + message_list_select_uid (ml, uid); +} + +static void +message_browser_folder_loaded (FolderBrowser *fb, const char *uri, MessageBrowser *mb) +{ + g_warning ("got 'folder_loaded' event for '%s'", uri); - message_list_select_uid (fb->message_list, uid); + gtk_signal_connect (GTK_OBJECT (fb->message_list), "message_list_built", + message_browser_message_list_built, mb); } static GnomeUIInfo message_browser_toolbar [] = { diff --git a/mail/message-list.c b/mail/message-list.c index f4235a5642..9d87ad65ae 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -124,6 +124,7 @@ static void clear_info(char *key, ETreePath *node, MessageList *ml); enum { MESSAGE_SELECTED, + MESSAGE_LIST_BUILT, LAST_SIGNAL }; @@ -443,7 +444,7 @@ message_list_select_uid (MessageList *message_list, const char *uid) } else { g_free (message_list->cursor_uid); message_list->cursor_uid = NULL; - gtk_signal_emit (GTK_OBJECT (message_list), message_list_signals [MESSAGE_SELECTED], NULL); + gtk_signal_emit (GTK_OBJECT (message_list), message_list_signals[MESSAGE_SELECTED], NULL); } } @@ -1227,7 +1228,15 @@ message_list_class_init (GtkObjectClass *object_class) GTK_SIGNAL_OFFSET (MessageListClass, message_selected), gtk_marshal_NONE__STRING, GTK_TYPE_NONE, 1, GTK_TYPE_STRING); - + + message_list_signals[MESSAGE_LIST_BUILT] = + gtk_signal_new ("message_list_built", + GTK_RUN_LAST, + object_class->type, + GTK_SIGNAL_OFFSET (MessageListClass, message_list_built), + gtk_marshal_NONE__NONE, + GTK_TYPE_NONE, 0); + gtk_object_class_add_signals(object_class, message_list_signals, LAST_SIGNAL); message_list_init_images (); @@ -2009,7 +2018,7 @@ on_cursor_activated_idle (gpointer data) MessageList *message_list = data; printf("emitting cursor changed signal, for uid %s\n", message_list->cursor_uid); - gtk_signal_emit(GTK_OBJECT (message_list), message_list_signals [MESSAGE_SELECTED], message_list->cursor_uid); + gtk_signal_emit(GTK_OBJECT (message_list), message_list_signals[MESSAGE_SELECTED], message_list->cursor_uid); message_list->idle_id = 0; return FALSE; @@ -2446,17 +2455,20 @@ static void regen_list_regen(struct _mail_msg *mm) m->tree = NULL; } -static void regen_list_regened(struct _mail_msg *mm) +static void +regen_list_regened (struct _mail_msg *mm) { struct _regen_list_msg *m = (struct _regen_list_msg *)mm; - + if (m->summary == NULL) return; - + if (m->dotree) build_tree(m->ml, m->tree, m->changes); else build_flat(m->ml, m->summary, m->changes); + + gtk_signal_emit (GTK_OBJECT (m->ml), message_list_signals[MESSAGE_LIST_BUILT]); } static void regen_list_free(struct _mail_msg *mm) diff --git a/mail/message-list.h b/mail/message-list.h index 837b8d837f..86c5caf3df 100644 --- a/mail/message-list.h +++ b/mail/message-list.h @@ -87,6 +87,7 @@ typedef struct { /* signals - select a message */ void (*message_selected) (MessageList *ml, const char *uid); + void (*message_list_built) (MessageList *ml); } MessageListClass; typedef void (*MessageListForeachFunc) (MessageList *message_list, |