aboutsummaryrefslogtreecommitdiffstats
path: root/mail/em-format-html-display.c
diff options
context:
space:
mode:
Diffstat (limited to 'mail/em-format-html-display.c')
-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 (