From bb05f6e6d0541bf29c8dde4e264cc7c23ba52fbb Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 18 Apr 2007 11:09:52 +0000 Subject: ** Fixes bug #423766 2007-04-18 Matthew Barnes ** Fixes bug #423766 * mail/em-format-html-display.c (attachments_save_all_clicked): Call em_utils_save_part() if there's only one attachment to save. * mail/em-utils.c (em_utils_save_part): Refactor to use gtk_dialog_run() instead of a "response" callback. * mail/em-utils.c (em_utils_save_parts): Refactor to use gtk_dialog_run() instead of a "response" callback. Use gtk_file_chooser_get_uri() to fetch the selected folder. svn path=/trunk/; revision=33429 --- mail/em-format-html-display.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'mail/em-format-html-display.c') diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c index e35db056c4..d4c7a01d11 100644 --- a/mail/em-format-html-display.c +++ b/mail/em-format-html-display.c @@ -2098,12 +2098,26 @@ attachment_bar_arrow_clicked(GtkWidget *w, EMFormatHTMLDisplay *efhd) } static void -attachments_save_all_clicked(GtkWidget *w, EMFormatHTMLDisplay *efhd) +attachments_save_all_clicked (GtkWidget *widget, EMFormatHTMLDisplay *efhd) { GSList *attachment_parts; + guint n_attachment_parts; - attachment_parts = e_attachment_bar_get_parts(E_ATTACHMENT_BAR(efhd->priv->attachment_bar)); - em_utils_save_parts(w, _("Select folder to save all attachments..."), attachment_parts); + attachment_parts = e_attachment_bar_get_parts ( + E_ATTACHMENT_BAR (efhd->priv->attachment_bar)); + n_attachment_parts = g_slist_length (attachment_parts); + g_return_if_fail (n_attachment_parts > 0); + + if (n_attachment_parts == 1) + em_utils_save_part ( + widget, _("Save attachment as"), + attachment_parts->data); + else + em_utils_save_parts ( + widget, _("Select folder to save all attachments"), + attachment_parts); + + g_slist_free (attachment_parts); } static void @@ -2143,6 +2157,7 @@ efhd_bar_save_selected(EPopup *ep, EPopupItem *item, void *data) parts = g_slist_reverse(parts); em_utils_save_parts(efhd->priv->attachment_bar, _("Select folder to save selected attachments..."), parts); + g_slist_free (parts); g_slist_foreach(attachment_parts, (GFunc)g_object_unref, NULL); g_slist_free (attachment_parts); -- cgit v1.2.3