aboutsummaryrefslogtreecommitdiffstats
path: root/composer
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-02-17 01:49:05 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-02-17 01:51:20 +0800
commit3b5864586c84a612397840b7be4aff3b1d985a4d (patch)
tree1748b815b940ed6316722febeeb5e64589010ef9 /composer
parent88004688ff06f7c8e37faa4d5c809d501daf656e (diff)
downloadgsoc2013-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.c34
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 (