From c4da35c00be2c5884bd1aa4e6e6fed1a72c3f0e5 Mon Sep 17 00:00:00 2001 From: Srinivasa Ragavan Date: Wed, 11 Apr 2007 18:56:45 +0000 Subject: Add progress indication in the preview. svn path=/trunk/; revision=33418 --- mail/ChangeLog | 5 +++++ mail/em-folder-view.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/mail/ChangeLog b/mail/ChangeLog index 228bf61c42..f50ae11b98 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,8 @@ +2007-04-11 Srinivasa Ragavan + + * em-folder-view.c: (emfv_spin), (emfv_message_selected_timeout): Add + a progress spinner widget in the preview while fetching messages. + 2007-04-09 Hiroyuki Ikezoe ** Fixes bug #343195 diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c index 0ec83e1df0..e45b5e37e2 100644 --- a/mail/em-folder-view.c +++ b/mail/em-folder-view.c @@ -65,6 +65,7 @@ #include #include +#include #include #include @@ -76,6 +77,7 @@ #include "misc/e-charset-picker.h" #include +#include #include "e-util/e-error.h" #include "e-util/e-dialog-utils.h" @@ -2356,6 +2358,35 @@ emfv_list_done_message_selected(CamelFolder *folder, const char *uid, CamelMimeM g_object_unref (emfv); } + +static gboolean +emfv_spin(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject *pobject) +{ + GtkWidget *ep; + + if (!strcmp(eb->classid, "spinner")) { + GtkWidget *box, *label; + + label = gtk_label_new (NULL); + gtk_label_set_markup ((GtkLabel *)label, _("Retrieving Message...")); + box = gtk_hbox_new (FALSE, 0); + + ep = e_spinner_new (); + e_spinner_set_size ((ESpinner *)ep, GTK_ICON_SIZE_SMALL_TOOLBAR); + e_spinner_start ((ESpinner *)ep); + + gtk_box_pack_start ((GtkBox *)box, ep, FALSE, FALSE, 0); + gtk_box_pack_start ((GtkBox *)box, label, FALSE, FALSE, 0); + + gtk_container_add ((GtkContainer *)eb, box); + gtk_widget_show_all ((GtkWidget *)eb); + + g_signal_handlers_disconnect_by_func(efh, emfv_spin, NULL); + } + + return TRUE; +} + static gboolean emfv_message_selected_timeout(void *data) { @@ -2363,12 +2394,23 @@ emfv_message_selected_timeout(void *data) if (emfv->priv->selected_uid) { if (emfv->displayed_uid == NULL || strcmp(emfv->displayed_uid, emfv->priv->selected_uid) != 0) { + GtkHTMLStream *hstream; + g_free(emfv->displayed_uid); emfv->displayed_uid = emfv->priv->selected_uid; emfv->priv->selected_uid = NULL; g_object_ref (emfv); /* TODO: we should manage our own thread stuff, would make cancelling outstanding stuff easier */ e_profile_event_emit("goto.load", emfv->displayed_uid, 0); + hstream = gtk_html_begin(((EMFormatHTML *)emfv->preview)->html); + + g_signal_connect(((EMFormatHTML *)emfv->preview)->html, "object_requested", G_CALLBACK(emfv_spin), NULL); + + gtk_html_stream_printf(hstream, "

%s

%s

", + _("Retrieving Message"), + emfv->priv->selected_uid); + gtk_html_stream_close(hstream, GTK_HTML_STREAM_OK); + mail_get_messagex(emfv->folder, emfv->displayed_uid, emfv_list_done_message_selected, emfv, mail_thread_queued); } else { e_profile_event_emit("goto.empty", "", 0); -- cgit