aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2008-04-29 16:35:05 +0800
committerMilan Crha <mcrha@src.gnome.org>2008-04-29 16:35:05 +0800
commit7acaf0f527da269a34bf404647cde27f93c08d78 (patch)
tree7b15ae966836fbc228fd5a707066936d1f22cf41 /mail
parent21a896f292a2ed4ea1a58869b0711e0a46f8ab0d (diff)
downloadgsoc2013-evolution-7acaf0f527da269a34bf404647cde27f93c08d78.tar
gsoc2013-evolution-7acaf0f527da269a34bf404647cde27f93c08d78.tar.gz
gsoc2013-evolution-7acaf0f527da269a34bf404647cde27f93c08d78.tar.bz2
gsoc2013-evolution-7acaf0f527da269a34bf404647cde27f93c08d78.tar.lz
gsoc2013-evolution-7acaf0f527da269a34bf404647cde27f93c08d78.tar.xz
gsoc2013-evolution-7acaf0f527da269a34bf404647cde27f93c08d78.tar.zst
gsoc2013-evolution-7acaf0f527da269a34bf404647cde27f93c08d78.zip
** Fix for bug #511337
2008-04-29 Milan Crha <mcrha@redhat.com> ** Fix for bug #511337 * em-format-html.h: (EMFormatHTMLState), (struct _EMFormatHTML): * em-format-html.c: (efh_init), (efh_format_done), (efh_format_timeout): Track state of the object to recognize whether rendering new content or doing nothing. * em-format-html-display.c: (efhd_can_process_attachment), (efhd_attachment_show), (efhd_attachment_popup), (efhd_attachment_image), (efhd_attachment_button): Do nothing when EMFormatHTML object's state is RENDERING, the puri object instance is not valid anyway. svn path=/trunk/; revision=35437
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog14
-rw-r--r--mail/em-format-html-display.c30
-rw-r--r--mail/em-format-html.c4
-rw-r--r--mail/em-format-html.h7
4 files changed, 53 insertions, 2 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 979b36e4bb..8941a49d22 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,17 @@
+2008-04-29 Milan Crha <mcrha@redhat.com>
+
+ ** Fix for bug #511337
+
+ * em-format-html.h: (EMFormatHTMLState), (struct _EMFormatHTML):
+ * em-format-html.c: (efh_init), (efh_format_done),
+ (efh_format_timeout): Track state of the object to recognize
+ whether rendering new content or doing nothing.
+ * em-format-html-display.c: (efhd_can_process_attachment),
+ (efhd_attachment_show), (efhd_attachment_popup),
+ (efhd_attachment_image), (efhd_attachment_button):
+ Do nothing when EMFormatHTML object's state is RENDERING,
+ the puri object instance is not valid anyway.
+
2008-04-28 Johan Euphrosine <proppy@aminche.com>
** Fix for bug #529247
diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c
index 4c99d027ff..7d6ff4f7aa 100644
--- a/mail/em-format-html-display.c
+++ b/mail/em-format-html-display.c
@@ -1424,6 +1424,21 @@ static void efhd_format_source(EMFormat *emf, CamelStream *stream, CamelMimePart
/* ********************************************************************** */
+/* Checks on the widget whether it can be processed, based on the state of EMFormatHTML.
+ The widget should have set "efh" data as the EMFormatHTML instance. */
+static gboolean
+efhd_can_process_attachment (GtkWidget *button)
+{
+ EMFormatHTML *efh;
+
+ if (!button)
+ return FALSE;
+
+ efh = g_object_get_data (G_OBJECT (button), "efh");
+
+ return efh && efh->state != EM_FORMAT_HTML_STATE_RENDERING;
+}
+
/* if it hasn't been processed yet, format the attachment */
static void
efhd_attachment_show(EPopup *ep, EPopupItem *item, void *data)
@@ -1439,6 +1454,9 @@ efhd_attachment_show(EPopup *ep, EPopupItem *item, void *data)
static void
efhd_attachment_button_show(GtkWidget *w, void *data)
{
+ if (!efhd_can_process_attachment (w))
+ return;
+
efhd_attachment_show(NULL, NULL, data);
}
@@ -1499,6 +1517,9 @@ efhd_attachment_popup(GtkWidget *w, GdkEventButton *event, struct _attach_puri *
return FALSE;
}
+ if (!efhd_can_process_attachment (w))
+ return FALSE;
+
/** @HookPoint-EMPopup: Attachment Button Context Menu
* @Id: org.gnome.evolution.mail.formathtmldisplay.popup
* @Class: org.gnome.evolution.mail.popup:1.0
@@ -1765,6 +1786,8 @@ efhd_attachment_image(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObjec
g_signal_connect(box, "popup_menu", G_CALLBACK(efhd_attachment_popup_menu), info);
g_signal_connect(box, "button-press-event", G_CALLBACK(efhd_image_fit_width), info);
+ g_object_set_data (G_OBJECT (box), "efh", efh);
+
return TRUE;
}
@@ -1840,9 +1863,10 @@ efhd_attachment_button(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObje
button = gtk_button_new();
- if (info->handle)
+ if (info->handle) {
g_signal_connect(button, "clicked", G_CALLBACK(efhd_attachment_button_show), info);
- else {
+ g_object_set_data (G_OBJECT (button), "efh", efh);
+ } else {
gtk_widget_set_sensitive(button, FALSE);
GTK_WIDGET_UNSET_FLAGS(button, GTK_CAN_FOCUS);
}
@@ -1916,6 +1940,8 @@ efhd_attachment_button(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObje
g_signal_connect(button, "clicked", G_CALLBACK(efhd_attachment_popup_menu), info);
gtk_box_pack_start((GtkBox *)mainbox, button, TRUE, TRUE, 0);
+ g_object_set_data (G_OBJECT (button), "efh", efh);
+
gtk_widget_show_all(mainbox);
if (info->shown)
diff --git a/mail/em-format-html.c b/mail/em-format-html.c
index 8e3878ab3f..53a6ffc8d8 100644
--- a/mail/em-format-html.c
+++ b/mail/em-format-html.c
@@ -170,6 +170,7 @@ efh_init(GObject *o)
efh->text_html_flags = CAMEL_MIME_FILTER_TOHTML_CONVERT_NL | CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES
| CAMEL_MIME_FILTER_TOHTML_MARK_CITATION;
efh->show_icon = TRUE;
+ efh->state = EM_FORMAT_HTML_STATE_NONE;
}
static void
@@ -1330,6 +1331,7 @@ efh_format_done (struct _format_msg *m)
m->format->load_http_now = FALSE;
m->format->priv->format_id = -1;
+ m->format->state = EM_FORMAT_HTML_STATE_NONE;
g_signal_emit_by_name(m->format, "complete");
}
@@ -1398,6 +1400,8 @@ efh_format_timeout(struct _format_msg *m)
mail_msg_unref(m);
p->last_part = NULL;
} else {
+ efh->state = EM_FORMAT_HTML_STATE_RENDERING;
+
if (p->last_part != m->message) {
hstream = gtk_html_begin (efh->html);
gtk_html_stream_printf (hstream, "<h5>%s</h5>", _("Formatting Message..."));
diff --git a/mail/em-format-html.h b/mail/em-format-html.h
index 7c419f3ba7..b7f44f6bf4 100644
--- a/mail/em-format-html.h
+++ b/mail/em-format-html.h
@@ -49,6 +49,11 @@ enum _em_format_html_header_flags {
EM_FORMAT_HTML_HEADER_BCC = 1<<2,
};
+typedef enum {
+ EM_FORMAT_HTML_STATE_NONE = 0,
+ EM_FORMAT_HTML_STATE_RENDERING
+} EMFormatHTMLState;
+
/* A HTMLJob will be executed in another thread, in sequence,
It's job is to write to its stream, close it if successful,
then exit */
@@ -196,6 +201,8 @@ struct _EMFormatHTML {
unsigned int hide_headers:1; /* no headers at all */
unsigned int show_icon:1; /* show an icon when the sender used Evo */
guint32 header_wrap_flags;
+
+ EMFormatHTMLState state; /* actual state of the object */
};
struct _EMFormatHTMLClass {