diff options
-rw-r--r-- | mail/ChangeLog | 20 | ||||
-rw-r--r-- | mail/folder-browser.c | 17 | ||||
-rw-r--r-- | mail/folder-browser.h | 5 | ||||
-rw-r--r-- | mail/message-browser.c | 30 |
4 files changed, 59 insertions, 13 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 0a24a5aed6..c51e5d2480 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,23 @@ +2001-04-24 Jeffrey Stedfast <fejj@ximian.com> + + * folder-browser.c: Added a new signal, "message_loaded" that gets + emitted when the message has been loaded and set on the + mail_display. + (folder_browser_class_init): Define the "message_loaded" signal + stuff. + (done_message_selected): Emit the "message_loaded" signal here. + + * message-browser.c (message_browser_next_msg): Do our own + message-list manipulation. We want the next message, not the next + unread message. + (message_browser_prev_msg): Same here but for previous. + (message_browser_new): Connect to the folder browser's + "message_loaded" signal. + (message_browser_folder_loaded): Don't connect to the + message-list's "message_selected" signal. + (message_browser_message_loaded): Nw callback which replaces the + old message_browser_message_selected callback's functionality. + 2001-04-24 Dan Winship <danw@ximian.com> * folder-browser.c: Add accelerators to the context menu. diff --git a/mail/folder-browser.c b/mail/folder-browser.c index 1bbd3dce0c..6bbb672ea5 100644 --- a/mail/folder-browser.c +++ b/mail/folder-browser.c @@ -54,6 +54,7 @@ static GtkObjectClass *folder_browser_parent_class; enum { FOLDER_LOADED, + MESSAGE_LOADED, LAST_SIGNAL }; @@ -108,6 +109,14 @@ folder_browser_class_init (GtkObjectClass *object_class) gtk_marshal_NONE__STRING, GTK_TYPE_NONE, 1, GTK_TYPE_STRING); + folder_browser_signals[MESSAGE_LOADED] = + gtk_signal_new ("message_loaded", + GTK_RUN_LAST, + object_class->type, + GTK_SIGNAL_OFFSET (FolderBrowserClass, message_loaded), + gtk_marshal_NONE__STRING, + GTK_TYPE_NONE, 1, GTK_TYPE_STRING); + gtk_object_class_add_signals (object_class, folder_browser_signals, LAST_SIGNAL); } @@ -958,9 +967,11 @@ static void done_message_selected(CamelFolder *folder, char *uid, CamelMimeMessa if (folder != fb->folder) return; - - mail_display_set_message(fb->mail_display, (CamelMedium *)msg); - + + mail_display_set_message (fb->mail_display, (CamelMedium *)msg); + /* FIXME: should this signal be emitted here?? */ + gtk_signal_emit (GTK_OBJECT (fb), folder_browser_signals [MESSAGE_LOADED], uid); + /* pain, if we have pending stuff, re-run */ if (fb->pending_uid) { g_free(fb->loading_uid); diff --git a/mail/folder-browser.h b/mail/folder-browser.h index 94f70b225d..e428465340 100644 --- a/mail/folder-browser.h +++ b/mail/folder-browser.h @@ -64,8 +64,9 @@ struct _FolderBrowser { typedef struct { GtkTableClass parent_class; - /* signals - select a message */ - void (*folder_loaded) (FolderBrowser *fb, const char *uri); + /* signals */ + void (*folder_loaded) (FolderBrowser *fb, const char *uri); + void (*message_loaded) (FolderBrowser *fb, const char *uid); } FolderBrowserClass; struct fb_ondemand_closure { diff --git a/mail/message-browser.c b/mail/message-browser.c index 3a471b24e9..280afeea07 100644 --- a/mail/message-browser.c +++ b/mail/message-browser.c @@ -129,27 +129,41 @@ static void message_browser_next_msg (GtkWidget *button, gpointer user_data) { MessageBrowser *mb = MESSAGE_BROWSER (user_data); + int row; + + row = e_tree_row_of_node (mb->fb->message_list->tree, + e_tree_get_cursor (mb->fb->message_list->tree)); + + message_list_select (mb->fb->message_list, row, + MESSAGE_LIST_SELECT_NEXT, + 0, 0); - next_msg (NULL, mb->fb); } static void message_browser_prev_msg (GtkWidget *button, gpointer user_data) { MessageBrowser *mb = MESSAGE_BROWSER (user_data); + int row; + + row = e_tree_row_of_node (mb->fb->message_list->tree, + e_tree_get_cursor (mb->fb->message_list->tree)); + + message_list_select (mb->fb->message_list, row, + MESSAGE_LIST_SELECT_PREVIOUS, + 0, 0); - previous_msg (NULL, mb->fb); } static void -message_browser_message_selected (MessageList *ml, const char *uid, MessageBrowser *mb) +message_browser_message_loaded (FolderBrowser *fb, const char *uid, MessageBrowser *mb) { CamelMimeMessage *message; char *subject = NULL; - g_warning ("got 'message_selected' event"); + g_warning ("got 'message_loaded' event"); - message = mb->fb->mail_display->current_message; + message = fb->mail_display->current_message; if (message) subject = (char *) camel_mime_message_get_subject (message); @@ -164,9 +178,6 @@ message_browser_folder_loaded (FolderBrowser *fb, const char *uri, MessageBrowse g_warning ("got 'folder_loaded' event"); - gtk_signal_connect (GTK_OBJECT (fb->message_list), "message_selected", - message_browser_message_selected, mb); - message_list_select_uid (fb->message_list, uid); } @@ -274,6 +285,9 @@ message_browser_new (const GNOME_Evolution_Shell shell, const char *uri, const c gtk_signal_connect (GTK_OBJECT (fb), "folder_loaded", message_browser_folder_loaded, new); + gtk_signal_connect (GTK_OBJECT (fb), "message_loaded", + message_browser_message_loaded, new); + folder_browser_set_uri (fb, uri); return GTK_WIDGET (new); |