diff --git a/ChangeLog b/ChangeLog index c0f18ff4..6ff239b9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,10 @@ * src/interface.c, doc/geany.txt, doc/geany.html, geany.glade: Don't use 'Enable' in pref labels when unnecessary. Rename XML/HTML tag autocompletion -> auto-closing. + * src/keyfile.c, src/document.c, src/document.h, doc/geany.txt, + doc/geany.html: + Add gio_unsafe_save_backup hidden pref (patch by Lex Trotman, + thanks). 2010-11-22 Nick Treleaven diff --git a/doc/geany.html b/doc/geany.html index 7e0f2de7..2fd271b8 100644 --- a/doc/geany.html +++ b/doc/geany.html @@ -4959,6 +4959,11 @@ The better approach would be to ensure your disk won't run out of free space. false +gio_unsafe_save_backup +Make a backup when using GIO unsafe file +saving. Backup is named filename~. +false + Search related     @@ -6367,7 +6372,7 @@ USE OR PERFORMANCE OF THIS SOFTWARE.

diff --git a/doc/geany.txt b/doc/geany.txt index 04f816ce..ebabd1c7 100644 --- a/doc/geany.txt +++ b/doc/geany.txt @@ -4225,6 +4225,8 @@ use_safe_file_saving Defines the mode how Geany saves files to f break things seriously. The better approach would be to ensure your disk won't run out of free space. +gio_unsafe_save_backup Make a backup when using GIO unsafe file false + saving. Backup is named `filename~`. **Search related** find_selection_type See `Find selection`_. 0 **Build Menu related** diff --git a/src/document.c b/src/document.c index abe8e2d0..714d64c0 100644 --- a/src/document.c +++ b/src/document.c @@ -1721,7 +1721,7 @@ static gchar *write_data_to_disk(const gchar *locale_filename, /* Use GIO API to save file (GVFS-safe) */ fp = g_file_new_for_path(locale_filename); - g_file_replace_contents(fp, data, len, NULL, FALSE, + g_file_replace_contents(fp, data, len, NULL, file_prefs.gio_unsafe_save_backup, G_FILE_CREATE_NONE, NULL, NULL, &error); g_object_unref(fp); #else diff --git a/src/document.h b/src/document.h index d20b4cfe..5b6117ef 100644 --- a/src/document.h +++ b/src/document.h @@ -60,6 +60,7 @@ typedef struct GeanyFilePrefs gboolean cmdline_new_files; /* New file if command-line filename doesn't exist */ gboolean use_safe_file_saving; gboolean ensure_convert_new_lines; + gboolean gio_unsafe_save_backup; } GeanyFilePrefs; diff --git a/src/keyfile.c b/src/keyfile.c index 8b17b542..c57eb3f1 100644 --- a/src/keyfile.c +++ b/src/keyfile.c @@ -189,6 +189,8 @@ static void init_pref_groups(void) "complete_snippets_whilst_editing", FALSE); stash_group_add_boolean(group, &file_prefs.use_safe_file_saving, "use_safe_file_saving", FALSE); + stash_group_add_boolean(group, &file_prefs.gio_unsafe_save_backup, + "gio_unsafe_save_backup", FALSE); /* for backwards-compatibility */ stash_group_add_integer(group, &editor_prefs.indentation->hard_tab_width, "indent_hard_tab_width", 8);