SF.net SVN: geany:[5860] trunk
colombanw at users.sourceforge.net
colombanw at xxxxx
Mon Jun 20 16:11:19 UTC 2011
Revision: 5860
http://geany.svn.sourceforge.net/geany/?rev=5860&view=rev
Author: colombanw
Date: 2011-06-20 16:11:18 +0000 (Mon, 20 Jun 2011)
Log Message:
-----------
Add an hidden pref to choose between GIO and plain C unsafe file saving.
Modified Paths:
--------------
trunk/ChangeLog
trunk/doc/geany.html
trunk/doc/geany.txt
trunk/src/document.c
trunk/src/document.h
trunk/src/keyfile.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2011-06-18 14:54:50 UTC (rev 5859)
+++ trunk/ChangeLog 2011-06-20 16:11:18 UTC (rev 5860)
@@ -1,3 +1,11 @@
+2011-06-20 Colomban Wendling <colomban(at)geany(dot)org>
+
+ * src/document.c, src/document.h, src/keyfile.c, doc/geany.txt,
+ doc/geany.html:
+ Add an hidden pref to choose between GIO and plain C unsafe
+ file saving.
+
+
2011-06-18 Colomban Wendling <colomban(at)geany(dot)org>
* src/document.c, src/document.h, src/editor.c:
Modified: trunk/doc/geany.html
===================================================================
--- trunk/doc/geany.html 2011-06-18 14:54:50 UTC (rev 5859)
+++ trunk/doc/geany.html 2011-06-20 16:11:18 UTC (rev 5860)
@@ -5181,6 +5181,13 @@
disk won't run out of free space.</td>
<td>false</td>
</tr>
+<tr><td>use_gio_unsafe_file_saving</td>
+<td>Whether to use GIO as the unsafe file
+saving backend. It is better on most
+situations but is know not to work
+correctly on some complex setups.</td>
+<td>true</td>
+</tr>
<tr><td>gio_unsafe_save_backup</td>
<td>Make a backup when using GIO unsafe file
saving. Backup is named <cite>filename~</cite>.</td>
@@ -6572,7 +6579,7 @@
<div class="footer">
<hr class="footer" />
<a class="reference external" href="geany.txt">View document source</a>.
-Generated on: 2011-06-13 20:23 UTC.
+Generated on: 2011-06-20 15:39 UTC.
Generated by <a class="reference external" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference external" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
</div>
Modified: trunk/doc/geany.txt
===================================================================
--- trunk/doc/geany.txt 2011-06-18 14:54:50 UTC (rev 5859)
+++ trunk/doc/geany.txt 2011-06-20 16:11:18 UTC (rev 5860)
@@ -4425,6 +4425,10 @@
break things seriously.
The better approach would be to ensure your
disk won't run out of free space.
+use_gio_unsafe_file_saving Whether to use GIO as the unsafe file true
+ saving backend. It is better on most
+ situations but is know not to work
+ correctly on some complex setups.
gio_unsafe_save_backup Make a backup when using GIO unsafe file false
saving. Backup is named `filename~`.
**Search related**
Modified: trunk/src/document.c
===================================================================
--- trunk/src/document.c 2011-06-18 14:54:50 UTC (rev 5859)
+++ trunk/src/document.c 2011-06-20 16:11:18 UTC (rev 5860)
@@ -1594,17 +1594,29 @@
{
GError *error = NULL;
- if (! file_prefs.use_safe_file_saving)
+ if (file_prefs.use_safe_file_saving)
{
+ /* Use old GLib API for safe saving (GVFS-safe, but alters ownership and permissons).
+ * This is the only option that handles disk space exhaustion. */
+ if (g_file_set_contents(locale_filename, data, len, &error))
+ geany_debug("Wrote %s with g_file_set_contents().", locale_filename);
+ }
#ifdef HAVE_GIO
+ else if (file_prefs.use_gio_unsafe_file_saving)
+ {
GFile *fp;
- /* Use GIO API to save file (GVFS-safe) */
+ /* Use GIO API to save file (GVFS-safe)
+ * It is best in most GVFS setups but don't seem to work correctly on some more complex
+ * setups (saving from some VM to their host, over some SMB shares, etc.) */
fp = g_file_new_for_path(locale_filename);
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
+ }
+#endif
+ else
+ {
FILE *fp;
int save_errno;
gchar *display_name = g_filename_display_name(locale_filename);
@@ -1659,15 +1671,7 @@
}
g_free(display_name);
-#endif
}
- else
- {
- /* Use old GLib API for safe saving (GVFS-safe, but alters ownership and permissons).
- * This is the only option that handles disk space exhaustion. */
- if (g_file_set_contents(locale_filename, data, len, &error))
- geany_debug("Wrote %s with g_file_set_contents().", locale_filename);
- }
if (error != NULL)
{
gchar *msg = g_strdup(error->message);
Modified: trunk/src/document.h
===================================================================
--- trunk/src/document.h 2011-06-18 14:54:50 UTC (rev 5859)
+++ trunk/src/document.h 2011-06-20 16:11:18 UTC (rev 5860)
@@ -61,6 +61,7 @@
gboolean use_safe_file_saving;
gboolean ensure_convert_new_lines;
gboolean gio_unsafe_save_backup;
+ gboolean use_gio_unsafe_file_saving; /* whether to use GIO as the unsafe backend */
}
GeanyFilePrefs;
Modified: trunk/src/keyfile.c
===================================================================
--- trunk/src/keyfile.c 2011-06-18 14:54:50 UTC (rev 5859)
+++ trunk/src/keyfile.c 2011-06-20 16:11:18 UTC (rev 5860)
@@ -196,6 +196,8 @@
"use_safe_file_saving", FALSE);
stash_group_add_boolean(group, &file_prefs.gio_unsafe_save_backup,
"gio_unsafe_save_backup", FALSE);
+ stash_group_add_boolean(group, &file_prefs.use_gio_unsafe_file_saving,
+ "use_gio_unsafe_file_saving", TRUE);
/* for backwards-compatibility */
stash_group_add_integer(group, &editor_prefs.indentation->hard_tab_width,
"indent_hard_tab_width", 8);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list