aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mail/ChangeLog10
-rw-r--r--mail/mail-display.c28
-rw-r--r--mail/message-list.c13
3 files changed, 30 insertions, 21 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 43400bdc09..dea8c9be1e 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,13 @@
+2000-07-03 Dan Winship <danw@helixcode.com>
+
+ * message-list.c (select_msg): call mail_display_set_message with
+ NULL if the message we tried to select doesn't exist (probably
+ meaning we tried to selecte the first message and the folder is
+ empty.)
+
+ * mail-display.c (mail_display_set_message): deal with NULL as an
+ input (meaning "undisplay previous message and display nothing").
+
2000-07-02 Dan Winship <danw@helixcode.com>
* mail-ops.c (real_fetch_mail): Remove hack to redisplay the
diff --git a/mail/mail-display.c b/mail/mail-display.c
index b5db4c69e1..cdd701ea4b 100644
--- a/mail/mail-display.c
+++ b/mail/mail-display.c
@@ -318,7 +318,7 @@ mail_html_write (GtkHTML *html, GtkHTMLStream *stream,
/**
* mail_display_set_message:
* @mail_display: the mail display object
- * @mime_message: the input camel medium
+ * @medium: the input camel medium, or %NULL
*
* Makes the mail_display object show the contents of the medium
* param. This means feeding mail_display->body_stream and
@@ -333,30 +333,30 @@ mail_display_set_message (MailDisplay *mail_display,
GtkAdjustment *adj;
/*
- * for the moment, camel-formatter deals only with
- * mime messages, but in the future, it should be
- * able to deal with any medium.
- * It can work on pretty much data wrapper, but in
- * fact, only the medium class has the distinction
- * header / body
+ * For the moment, we deal only with CamelMimeMessage, but in
+ * the future, we should be able to deal with any medium.
*/
- if (!CAMEL_IS_MIME_MESSAGE (medium))
+ if (medium && !CAMEL_IS_MIME_MESSAGE (medium))
return;
/* Clean up from previous message. */
if (mail_display->current_message)
gtk_object_unref (GTK_OBJECT (mail_display->current_message));
- mail_display->current_message = CAMEL_MIME_MESSAGE (medium);
- gtk_object_ref (GTK_OBJECT (medium));
+ mail_display->current_message = (CamelMimeMessage*)medium;
- gtk_object_set_data (GTK_OBJECT (mail_display->html), "message", medium);
stream = gtk_html_begin (mail_display->html);
mail_html_write (mail_display->html, stream, "%s%s", HTML_HEADER,
"<BODY TEXT=\"#000000\" BGCOLOR=\"#FFFFFF\">\n");
- mail_format_mime_message (CAMEL_MIME_MESSAGE (medium),
- mail_display->html, stream,
- CAMEL_MIME_MESSAGE (medium));
+
+ if (medium) {
+ gtk_object_ref (GTK_OBJECT (medium));
+ gtk_object_set_data (GTK_OBJECT (mail_display->html),
+ "message", medium);
+ mail_format_mime_message (CAMEL_MIME_MESSAGE (medium),
+ mail_display->html, stream,
+ CAMEL_MIME_MESSAGE (medium));
+ }
mail_html_write (mail_display->html, stream, "</BODY></HTML>\n");
gtk_html_end (mail_display->html, stream, GTK_HTML_STREAM_OK);
diff --git a/mail/message-list.c b/mail/message-list.c
index eac111e285..9b34ba7ddc 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -145,12 +145,13 @@ static void
select_msg (MessageList *message_list, gint row)
{
CamelException ex;
- CamelMimeMessage *message = NULL;
+ CamelMimeMessage *message;
CamelMessageInfo *msg_info;
+ MailDisplay *md = message_list->parent_folder_browser->mail_display;
camel_exception_init (&ex);
- msg_info = get_message_info(message_list, row);
+ msg_info = get_message_info (message_list, row);
if (msg_info) {
message = camel_folder_get_message (message_list->folder,
msg_info->uid, &ex);
@@ -159,19 +160,17 @@ select_msg (MessageList *message_list, gint row)
ex.desc?ex.desc:"unknown_reason");
return;
}
- }
- if (message) {
if (message_list->seen_id)
gtk_timeout_remove (message_list->seen_id);
- mail_display_set_message (message_list->parent_folder_browser->mail_display,
- CAMEL_MEDIUM (message));
+ mail_display_set_message (md, CAMEL_MEDIUM (message));
gtk_object_unref (GTK_OBJECT (message));
message_list->seen_id =
gtk_timeout_add (1500, mark_msg_seen, message_list);
- }
+ } else
+ mail_display_set_message (md, NULL);
}
/*