aboutsummaryrefslogtreecommitdiffstats
path: root/modules/calendar/e-task-shell-view-actions.c
diff options
context:
space:
mode:
Diffstat (limited to 'modules/calendar/e-task-shell-view-actions.c')
-rw-r--r--modules/calendar/e-task-shell-view-actions.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/modules/calendar/e-task-shell-view-actions.c b/modules/calendar/e-task-shell-view-actions.c
index fb7b89b049..282d5a3e75 100644
--- a/modules/calendar/e-task-shell-view-actions.c
+++ b/modules/calendar/e-task-shell-view-actions.c
@@ -598,17 +598,22 @@ static void
action_task_save_as_cb (GtkAction *action,
ETaskShellView *task_shell_view)
{
+ EShell *shell;
EShellView *shell_view;
EShellWindow *shell_window;
+ EShellBackend *shell_backend;
ETaskShellContent *task_shell_content;
ECalendarTable *task_table;
ECalModelComponent *comp_data;
+ EActivity *activity;
GSList *list;
- gchar *filename;
+ GFile *file;
gchar *string;
shell_view = E_SHELL_VIEW (task_shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
+ shell_backend = e_shell_view_get_shell_backend (shell_view);
+ shell = e_shell_window_get_shell (shell_window);
task_shell_content = task_shell_view->priv->task_shell_content;
task_table = e_task_shell_content_get_task_table (task_shell_content);
@@ -618,22 +623,33 @@ action_task_save_as_cb (GtkAction *action,
comp_data = list->data;
g_slist_free (list);
- filename = e_file_dialog_save (
- GTK_WINDOW (shell_window), _("Save as..."), NULL);
- if (filename == NULL)
+ file = e_shell_run_save_dialog (
+ shell, _("Save as iCalendar"), NULL, NULL);
+ if (file == NULL)
return;
+ /* XXX We only save the first selected task. */
string = e_cal_get_component_as_string (
comp_data->client, comp_data->icalcomp);
if (string == NULL) {
g_warning ("Could not convert task to a string");
+ g_object_unref (file);
return;
}
- e_write_file_uri (filename, string);
+ /* XXX No callback means errors are discarded. */
+ activity = e_file_replace_contents_async (
+ file, string, strlen (string), NULL, FALSE,
+ G_FILE_CREATE_NONE, (GAsyncReadyCallback) NULL, NULL);
+ e_shell_backend_add_activity (shell_backend, activity);
+
+ /* Free the string when the activity is finalized. */
+ g_object_set_data_full (
+ G_OBJECT (activity),
+ "file-content", string,
+ (GDestroyNotify) g_free);
- g_free (filename);
- g_free (string);
+ g_object_unref (file);
}
static void