diff options
author | Milan Crha <mcrha@redhat.com> | 2008-04-29 16:35:05 +0800 |
---|---|---|
committer | Milan Crha <mcrha@src.gnome.org> | 2008-04-29 16:35:05 +0800 |
commit | 7acaf0f527da269a34bf404647cde27f93c08d78 (patch) | |
tree | 7b15ae966836fbc228fd5a707066936d1f22cf41 /mail/em-format-html-display.c | |
parent | 21a896f292a2ed4ea1a58869b0711e0a46f8ab0d (diff) | |
download | gsoc2013-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/em-format-html-display.c')
-rw-r--r-- | mail/em-format-html-display.c | 30 |
1 files changed, 28 insertions, 2 deletions
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) |