From 44323b73055789c8a172901e90bc5d19e756789b Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 14 Apr 2007 20:46:09 +0000 Subject: [PATCH] - Add patch for RH bug #234315 (fix saving attachments). --- evolution-2.10.1-saving-attachments.patch | 218 ++++++++++++++++++++++ evolution.spec | 9 +- 2 files changed, 226 insertions(+), 1 deletion(-) create mode 100644 evolution-2.10.1-saving-attachments.patch diff --git a/evolution-2.10.1-saving-attachments.patch b/evolution-2.10.1-saving-attachments.patch new file mode 100644 index 0000000..1f591f5 --- /dev/null +++ b/evolution-2.10.1-saving-attachments.patch @@ -0,0 +1,218 @@ +--- evolution-2.10.1/mail/em-utils.c.saving-attachments 2007-04-14 14:25:40.000000000 -0400 ++++ evolution-2.10.1/mail/em-utils.c 2007-04-14 15:08:50.000000000 -0400 +@@ -354,28 +354,23 @@ + + /* Saving messages... */ + +-static void +-emu_save_part_response(GtkWidget *filesel, int response, CamelMimePart *part) ++static const gchar * ++emu_save_get_filename_for_part (CamelMimePart *part) + { +- char *uri; +- +- if (response == GTK_RESPONSE_OK) { +- uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (filesel)); ++ const gchar *filename; + +- if (!e_file_can_save((GtkWindow *)filesel, uri)) { +- g_free(uri); +- return; +- } +- +- e_file_update_save_path(gtk_file_chooser_get_current_folder_uri( +- GTK_FILE_CHOOSER(filesel)), TRUE); +- /* FIXME: popup error if it fails? */ +- mail_save_part(part, uri, NULL, NULL, FALSE); +- g_free(uri); ++ filename = camel_mime_part_get_filename (part); ++ if (filename == NULL) { ++ if (CAMEL_IS_MIME_MESSAGE (part)) { ++ filename = camel_mime_message_get_subject ( ++ CAMEL_MIME_MESSAGE (part)); ++ if (filename == NULL) ++ filename = _("message"); ++ } else ++ filename = _("attachment"); + } + +- gtk_widget_destroy((GtkWidget *)filesel); +- camel_object_unref(part); ++ return filename; + } + + /** +@@ -387,83 +382,78 @@ + * Saves a mime part to disk (prompting the user for filename). + **/ + void +-em_utils_save_part(GtkWidget *parent, const char *prompt, CamelMimePart *part) ++em_utils_save_part (GtkWidget *parent, const char *prompt, CamelMimePart *part) + { +- const char *name; +- GtkWidget *filesel; ++ GtkWidget *file_chooser; ++ const gchar *filename; ++ gchar *uri = NULL; + +- name = camel_mime_part_get_filename(part); +- if (name == NULL) { +- if (CAMEL_IS_MIME_MESSAGE(part)) { +- name = camel_mime_message_get_subject((CamelMimeMessage *)part); +- if (name == NULL) +- name = _("message"); +- } else { +- name = _("attachment"); +- } ++ filename = emu_save_get_filename_for_part (part); ++ ++ file_chooser = e_file_get_save_filesel ( ++ parent, prompt, filename, GTK_FILE_CHOOSER_ACTION_SAVE); ++ ++ if (gtk_dialog_run (GTK_DIALOG (file_chooser)) != GTK_RESPONSE_OK) ++ goto exit; ++ ++ uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (file_chooser)); ++ ++ /* XXX Would be nice to mention _why_ we can't save. */ ++ if (!e_file_can_save (GTK_WINDOW (file_chooser), uri)) { ++ g_warning ("Unable to save %s", uri); ++ goto exit; + } + +- filesel = e_file_get_save_filesel(parent, prompt, name, GTK_FILE_CHOOSER_ACTION_SAVE); +- camel_object_ref(part); +- g_signal_connect (filesel, "response", G_CALLBACK (emu_save_part_response), part); +- gtk_widget_show (filesel); ++ e_file_update_save_path ( ++ gtk_file_chooser_get_current_folder_uri ( ++ GTK_FILE_CHOOSER (file_chooser)), TRUE); ++ ++ mail_save_part (part, uri, NULL, NULL, FALSE); ++ ++exit: ++ gtk_widget_destroy (file_chooser); ++ g_free (uri); + } + +-static void +-emu_save_parts_response (GtkWidget *filesel, int response, GSList *parts) ++void ++em_utils_save_parts (GtkWidget *parent, const gchar *prompt, GSList *parts) + { +- GSList *selected; +- char *uri = NULL; +- if (response == GTK_RESPONSE_OK) { +- uri = gtk_file_chooser_get_current_folder_uri(GTK_FILE_CHOOSER (filesel)); +- e_file_update_save_path(uri, FALSE); +- +- for ( selected = parts; selected != NULL; selected = selected->next) { +- const char *file_name; +- char *safe_name = NULL; +- char *file_path; +- CamelMimePart *part = selected->data; +- +- file_name = camel_mime_part_get_filename(part); +- if (file_name == NULL) { +- if (CAMEL_IS_MIME_MESSAGE(part)) { +- file_name = camel_mime_message_get_subject((CamelMimeMessage *)part); +- if (file_name == NULL) +- file_name = _("message"); +- } else { +- file_name = _("attachment"); +- } +- } else { +- safe_name = g_strdup(file_name); +- em_filename_make_safe(safe_name); +- file_name = safe_name; +- } +- +- file_path = g_build_filename (uri, file_name, NULL); +- if (!e_file_check_local(file_path) || !g_file_test(file_path, (G_FILE_TEST_EXISTS)) || e_error_run(NULL, E_ERROR_ASK_FILE_EXISTS_OVERWRITE, file_name, NULL) == GTK_RESPONSE_OK) +- mail_save_part(part, file_path, NULL, NULL, FALSE); +- else +- g_warning ("Could not save %s. File already exists", file_path); ++ GtkWidget *file_chooser; ++ gchar *path_uri; ++ GSList *iter; ++ ++ file_chooser = e_file_get_save_filesel ( ++ parent, prompt, NULL, GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER); ++ ++ if (gtk_dialog_run (GTK_DIALOG (file_chooser)) != GTK_RESPONSE_OK) ++ goto exit; ++ ++ path_uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (file_chooser)); ++ ++ e_file_update_save_path (path_uri, FALSE); + +- g_free (file_path); +- g_free (safe_name); +- } ++ for (iter = parts; iter != NULL; iter = iter->next) { ++ CamelMimePart *part = iter->data; ++ const gchar *filename; ++ gchar *uri; ++ ++ filename = emu_save_get_filename_for_part (part); ++ ++ uri = g_build_path ("/", path_uri, filename, NULL); ++ ++ /* XXX Would be nice to mention _why_ we can't save. */ ++ if (e_file_can_save (GTK_WINDOW (file_chooser), uri)) ++ mail_save_part (part, uri, NULL, NULL, FALSE); ++ else ++ g_warning ("Unable to save %s", uri); + + g_free (uri); +- } +- +- g_slist_free (parts); +- gtk_widget_destroy((GtkWidget *)filesel); +-} ++ } + +-void +-em_utils_save_parts (GtkWidget *parent, const char *prompt, GSList * parts) +-{ +- GtkWidget *filesel; ++ g_free (path_uri); + +- filesel = e_file_get_save_filesel (parent, prompt, NULL, GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER); +- g_signal_connect (filesel, "response", G_CALLBACK (emu_save_parts_response), parts); +- gtk_widget_show (filesel); ++exit: ++ gtk_widget_destroy (file_chooser); + } + + +--- evolution-2.10.1/mail/em-format-html-display.c.saving-attachments 2007-04-14 14:25:40.000000000 -0400 ++++ evolution-2.10.1/mail/em-format-html-display.c 2007-04-14 15:08:50.000000000 -0400 +@@ -2099,12 +2099,24 @@ + } + + 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); + } + + static void diff --git a/evolution.spec b/evolution.spec index 7760930..8c4f3b2 100644 --- a/evolution.spec +++ b/evolution.spec @@ -47,7 +47,7 @@ Name: evolution Version: 2.10.1 -Release: 3%{?dist} +Release: 4%{?dist} License: GPL Group: Applications/Productivity Summary: GNOME's next-generation groupware suite @@ -164,6 +164,9 @@ Patch48: evolution-2.10.1-fix-gnome-doc-utils.patch # RH bug 235878 / GNOME bug #386503 Patch49: evolution-2.10.1-fix-help.patch +# RH bug 234315 / GNOME bug #423766 +Patch50: evolution-2.10.1-saving-attachments.patch + ## Dependencies ### Requires(post): GConf2 @@ -318,6 +321,7 @@ Development files needed for building things which link against evolution. %patch47 -p1 -b .drop-old-glib-support %patch48 -p1 -b .fix-gnome-doc-utils %patch49 -p1 -b .fix-help +%patch50 -p1 -b .saving-attachments mkdir -p krb5-fakeprefix/include mkdir -p krb5-fakeprefix/lib @@ -734,6 +738,9 @@ rm -rf $RPM_BUILD_ROOT %{_libdir}/evolution/%{evo_major}/libmenus.so %changelog +* Sat Apr 14 2007 Matthew Barnes - 2.10.1-4.fc7 +- Add patch for RH bug #234315 (fix saving attachments). + * Fri Apr 13 2007 Matthew Barnes - 2.10.1-3.fc7 - Add patch for RH bug #235878 (make Help->Contents work again).