From 10c3ddb38138f3408044fd46115d5804f057c13a Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 13 Feb 2009 03:23:04 +0000 Subject: Make attachment saving work everywhere. svn path=/branches/kill-bonobo/; revision=37259 --- mail/em-format-html-display.c | 10 ++++++++-- mail/em-popup.c | 8 +++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c index d1c69fc3df..e9516100f0 100644 --- a/mail/em-format-html-display.c +++ b/mail/em-format-html-display.c @@ -2209,14 +2209,20 @@ efhd_bar_save_selected(EPopup *ep, EPopupItem *item, void *data) EMFormatHTMLDisplay *efhd = (EMFormatHTMLDisplay *)data; GSList *attachment_parts, *tmp; GSList *parts = NULL; + GtkWidget *widget; + gpointer parent; + + widget = efhd->priv->attachment_bar; + parent = gtk_widget_get_toplevel (widget); + parent = GTK_WIDGET_TOPLEVEL (parent) ? parent : NULL; - attachment_parts = e_attachment_bar_get_selected(E_ATTACHMENT_BAR(efhd->priv->attachment_bar)); + attachment_parts = e_attachment_bar_get_selected(E_ATTACHMENT_BAR(widget)); for (tmp = attachment_parts; tmp; tmp=tmp->next) parts = g_slist_prepend(parts, ((EAttachment *)tmp->data)->body); parts = g_slist_reverse(parts); - em_utils_save_parts(efhd->priv->attachment_bar, _("Select folder to save selected attachments..."), parts); + em_utils_save_parts(parent, _("Select folder to save selected attachments..."), parts); g_slist_free (parts); g_slist_foreach(attachment_parts, (GFunc)g_object_unref, NULL); diff --git a/mail/em-popup.c b/mail/em-popup.c index 38f3b1426b..84d49c845e 100644 --- a/mail/em-popup.c +++ b/mail/em-popup.c @@ -404,6 +404,8 @@ emp_part_popup_saveas(EPopup *ep, EPopupItem *item, void *data) { EPopupTarget *t = ep->target; CamelMimePart *part = NULL; + GtkWidget *widget; + gpointer parent; /* If it is of type EM_POPUP_TARGET_ATTACHMENTS, we can assume the length is one. */ if (t->type == EM_POPUP_TARGET_ATTACHMENTS) @@ -411,7 +413,11 @@ emp_part_popup_saveas(EPopup *ep, EPopupItem *item, void *data) else part = ((EMPopupTargetPart *) t)->part; - em_utils_save_part(ep->target->widget, _("Save As..."), part); + widget = ep->target->widget; + parent = gtk_widget_get_toplevel (widget); + parent = GTK_WIDGET_TOPLEVEL (parent) ? parent : NULL; + + em_utils_save_part (parent, _("Save As..."), part); } static void -- cgit v1.2.3