aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/itip-formatter
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-11-08 05:08:26 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-11-08 05:09:05 +0800
commit5783bb4eb0a6e454fcebb4b87fcbd9bd11f32bdc (patch)
treefd38a5cbf9f058351a276f6d7bbf17e25cd90c3f /plugins/itip-formatter
parent86ecfc50539ddef82205551c11a6a13b135bbab4 (diff)
downloadgsoc2013-evolution-5783bb4eb0a6e454fcebb4b87fcbd9bd11f32bdc.tar
gsoc2013-evolution-5783bb4eb0a6e454fcebb4b87fcbd9bd11f32bdc.tar.gz
gsoc2013-evolution-5783bb4eb0a6e454fcebb4b87fcbd9bd11f32bdc.tar.bz2
gsoc2013-evolution-5783bb4eb0a6e454fcebb4b87fcbd9bd11f32bdc.tar.lz
gsoc2013-evolution-5783bb4eb0a6e454fcebb4b87fcbd9bd11f32bdc.tar.xz
gsoc2013-evolution-5783bb4eb0a6e454fcebb4b87fcbd9bd11f32bdc.tar.zst
gsoc2013-evolution-5783bb4eb0a6e454fcebb4b87fcbd9bd11f32bdc.zip
Kill more redundant save functions.
Diffstat (limited to 'plugins/itip-formatter')
-rw-r--r--plugins/itip-formatter/itip-formatter.c42
1 files changed, 40 insertions, 2 deletions
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 <calendar/gui/itip-utils.h>
#include <calendar/common/authentication.h>
#include <shell/e-shell.h>
+#include <shell/e-shell-utils.h>
#include "itip-view.h"
+#include <misc/e-attachment.h>
#define CLASSID "itip://"
#define GCONF_KEY_DELETE "/apps/evolution/itip/delete_processed"
@@ -1474,18 +1476,54 @@ get_next (icalcompiter *iter)
}
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 *