diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-02-17 01:49:05 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-02-17 01:51:20 +0800 |
commit | 3b5864586c84a612397840b7be4aff3b1d985a4d (patch) | |
tree | 1748b815b940ed6316722febeeb5e64589010ef9 /composer | |
parent | 88004688ff06f7c8e37faa4d5c809d501daf656e (diff) | |
download | gsoc2013-evolution-3b5864586c84a612397840b7be4aff3b1d985a4d.tar.gz gsoc2013-evolution-3b5864586c84a612397840b7be4aff3b1d985a4d.tar.zst gsoc2013-evolution-3b5864586c84a612397840b7be4aff3b1d985a4d.zip |
BugĀ 610124 - Autosave errors dialogues can't be dismissed
Diffstat (limited to 'composer')
-rw-r--r-- | composer/e-composer-autosave.c | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/composer/e-composer-autosave.c b/composer/e-composer-autosave.c index 002f6d0028..eefb47e6d1 100644 --- a/composer/e-composer-autosave.c +++ b/composer/e-composer-autosave.c @@ -36,6 +36,7 @@ typedef struct _AutosaveState AutosaveState; struct _AutosaveState { GFile *file; gboolean enabled; + gboolean error_shown; }; static GList *autosave_registry; @@ -72,8 +73,7 @@ composer_autosave_state_new (void) { AutosaveState *state; - state = g_slice_new (AutosaveState); - state->file = NULL; + state = g_slice_new0 (AutosaveState); state->enabled = TRUE; return state; @@ -122,15 +122,35 @@ static void composer_autosave_finish_cb (EMsgComposer *composer, GAsyncResult *result) { + AutosaveState *state; GError *error = NULL; + state = g_object_get_data (G_OBJECT (composer), "autosave"); + g_return_if_fail (state != NULL); + e_composer_autosave_snapshot_finish (composer, result, &error); if (error != NULL) { - e_alert_run_dialog_for_args ( - GTK_WINDOW (composer), - "mail-composer:no-autosave", - "", error->message, NULL); + gchar *basename; + + if (G_IS_FILE (state->file)) + basename = g_file_get_basename (state->file); + else + basename = g_strdup (" "); + + /* Only show one error dialog at a + * time to avoid cascading dialogs. */ + if (!state->error_shown) { + state->error_shown = TRUE; + e_alert_run_dialog_for_args ( + GTK_WINDOW (composer), + "mail-composer:no-autosave", + basename, error->message, NULL); + state->error_shown = FALSE; + } else + g_warning ("%s: %s", basename, error->message); + + g_free (basename); g_error_free (error); } } @@ -147,7 +167,7 @@ composer_autosave_foreach (EMsgComposer *composer) composer_autosave_finish_cb, NULL); } -static gint +static gboolean composer_autosave_timeout (void) { g_list_foreach ( |