[gtksourceview/wip/loader-saver] FileSaver: recover write when not mounted
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/loader-saver] FileSaver: recover write when not mounted
- Date: Thu, 26 Dec 2013 10:09:53 +0000 (UTC)
commit 0d794a2eb43bbfdc6db5df5efe6fc6ac4a1a4d58
Author: Sébastien Wilmet <swilmet gnome org>
Date: Thu Dec 26 11:09:21 2013 +0100
FileSaver: recover write when not mounted
gtksourceview/gtksourcefilesaver.c | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
---
diff --git a/gtksourceview/gtksourcefilesaver.c b/gtksourceview/gtksourcefilesaver.c
index 25a9020..2ae682f 100644
--- a/gtksourceview/gtksourcefilesaver.c
+++ b/gtksourceview/gtksourcefilesaver.c
@@ -96,6 +96,7 @@ G_DEFINE_TYPE_WITH_PRIVATE (GtkSourceFileSaver, gtk_source_file_saver, G_TYPE_OB
static void read_file_chunk (GtkSourceFileSaver *saver);
static void write_file_chunk (GtkSourceFileSaver *saver);
static void check_externally_modified (GtkSourceFileSaver *saver);
+static void recover_not_mounted (GtkSourceFileSaver *saver);
static void
gtk_source_file_saver_set_property (GObject *object,
@@ -606,12 +607,19 @@ replace_file_cb (GFile *location,
if (error != NULL)
{
+ if (error->domain == G_IO_ERROR &&
+ error->code == G_IO_ERROR_NOT_MOUNTED &&
+ !saver->priv->tried_mount)
+ {
+ recover_not_mounted (saver);
+ g_error_free (error);
+ return;
+ }
+
DEBUG ({
g_print ("Opening file failed: %s\n", error->message);
});
- /* FIXME check not mounted? */
-
g_task_return_error (saver->priv->task, error);
return;
}
@@ -717,9 +725,12 @@ mount_cb (GFile *location,
{
g_task_return_error (saver->priv->task, error);
}
+ else if (saver->priv->flags & GTK_SOURCE_FILE_SAVE_IGNORE_MTIME)
+ {
+ begin_write (saver);
+ }
else
{
- /* Try again to get the modified state. */
check_externally_modified (saver);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]