aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-08-11 06:38:10 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-08-11 06:53:31 +0800
commitf1c03de09dfda7052753b86a78bc22f87ca039a1 (patch)
treeb41336b69fd09fa9027458a8f4943187d5f98b28 /mail
parent84abe8bbf3f19dfd3f940986706805154ef20240 (diff)
downloadgsoc2013-evolution-f1c03de09dfda7052753b86a78bc22f87ca039a1.tar
gsoc2013-evolution-f1c03de09dfda7052753b86a78bc22f87ca039a1.tar.gz
gsoc2013-evolution-f1c03de09dfda7052753b86a78bc22f87ca039a1.tar.bz2
gsoc2013-evolution-f1c03de09dfda7052753b86a78bc22f87ca039a1.tar.lz
gsoc2013-evolution-f1c03de09dfda7052753b86a78bc22f87ca039a1.tar.xz
gsoc2013-evolution-f1c03de09dfda7052753b86a78bc22f87ca039a1.tar.zst
gsoc2013-evolution-f1c03de09dfda7052753b86a78bc22f87ca039a1.zip
Bug 271691 - Add a way to view all attachments inline
Diffstat (limited to 'mail')
-rw-r--r--mail/em-format-html-display.c33
1 files changed, 15 insertions, 18 deletions
diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c
index d49d797de4..b2661b67c0 100644
--- a/mail/em-format-html-display.c
+++ b/mail/em-format-html-display.c
@@ -744,31 +744,24 @@ efhd_message_prefix(EMFormat *emf, CamelStream *stream, CamelMimePart *part, EMF
/* ********************************************************************** */
-/* 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)
+static void
+efhd_attachment_button_expanded (EAttachmentButton *button,
+ GParamSpec *pspec,
+ struct _attach_puri *info)
{
EMFormatHTML *efh;
- if (!button)
- return FALSE;
-
+ /* FIXME The PURI struct seems to have some lifecycle issues,
+ * because casting info->puri.format to an EMFormatHTML
+ * can lead to crashes. So we hack around it. */
efh = g_object_get_data (G_OBJECT (button), "efh");
+ g_return_if_fail (EM_IS_FORMAT_HTML (efh));
- return efh && efh->state != EM_FORMAT_HTML_STATE_RENDERING;
-}
-
-static void
-efhd_attachment_button_expanded (GtkWidget *widget,
- GParamSpec *pspec,
- struct _attach_puri *info)
-{
- if (!efhd_can_process_attachment (widget))
+ if (efh->state == EM_FORMAT_HTML_STATE_RENDERING)
return;
- info->shown = ~info->shown;
+ info->shown = e_attachment_button_get_expanded (button);
+
em_format_set_inline (
info->puri.format, info->puri.part_id, info->shown);
}
@@ -848,6 +841,10 @@ efhd_attachment_button(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObje
gtk_container_add (GTK_CONTAINER (eb), widget);
gtk_widget_show (widget);
+ /* FIXME Not sure why the expanded callback can't just use
+ * info->puri.format, but there seems to be lifecycle
+ * issues with the PURI struct. Maybe it should have
+ * a reference count? */
g_object_set_data (G_OBJECT (widget), "efh", efh);
g_signal_connect (