From 5783bb4eb0a6e454fcebb4b87fcbd9bd11f32bdc Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Sat, 7 Nov 2009 16:08:26 -0500 Subject: Kill more redundant save functions. --- plugins/itip-formatter/itip-formatter.c | 42 +++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) (limited to 'plugins/itip-formatter') diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c index 8ed7a51b37..658acc07dc 100644 --- a/plugins/itip-formatter/itip-formatter.c +++ b/plugins/itip-formatter/itip-formatter.c @@ -57,7 +57,9 @@ #include #include #include +#include #include "itip-view.h" +#include #define CLASSID "itip://" #define GCONF_KEY_DELETE "/apps/evolution/itip/delete_processed" @@ -1473,19 +1475,55 @@ get_next (icalcompiter *iter) return ret; } +static void +attachment_load_finish (EAttachment *attachment, + GAsyncResult *result, + GFile *file) +{ + EShell *shell; + GtkWindow *parent; + + /* XXX Theoretically, this should never fail. */ + e_attachment_load_finish (attachment, result, NULL); + + shell = e_shell_get_default (); + parent = e_shell_get_active_window (shell); + + e_attachment_save_async ( + attachment, file, (GAsyncReadyCallback) + e_attachment_save_handle_error, parent); + + g_object_unref (file); +} + static void save_vcalendar_cb (GtkWidget *button, struct _itip_puri *pitip) { + EAttachment *attachment; + EShell *shell; + GFile *file; + g_return_if_fail (pitip != NULL); g_return_if_fail (pitip->vcalendar != NULL); g_return_if_fail (pitip->part != NULL); + shell = e_shell_get_default (); + file = e_shell_run_save_dialog ( + shell, _("Save Calendar"), NULL, NULL); + if (file == NULL) + return; + if (!camel_mime_part_get_filename (pitip->part)) { - /* To Translators: This is a default file name when saving calendar part */ + /* Translators: This is a default filename for a calendar. */ camel_mime_part_set_filename (pitip->part, _("calendar.ics")); } - em_utils_save_part (GTK_WINDOW (gtk_widget_get_toplevel (button)), _("Save calendar"), pitip->part); + attachment = e_attachment_new (); + e_attachment_set_mime_part (attachment, pitip->part); + + e_attachment_load_async ( + attachment, (GAsyncReadyCallback) + attachment_load_finish, file); } static GtkWidget * -- cgit