On Tue, 6 Apr 2010 12:10:13 +0100 Nick Treleaven nick.treleaven@btinternet.com wrote:
On Sat, 03 Apr 2010 03:51:18 +0400 Алексей Антипов 1a_antipov@mail.ru wrote:
Please find the patch in attachment. When building with GIO, it would use g_file_replace_contents
I think this is a good idea (but haven't tested it as I don't have GIO). However, I don't think we should change the meaning of the 'safe file saving' pref. What if there's a bug in GIO? At least we know that pref doesn't lose data.
I've still been using a GLib 2.14 system (so haven't personally tested this), but I think we ought to try using GIO for document saving as it may fix the network file truncation problems.
I attach an edited version of Алексей's patch, which doesn't make backups. Please test - if GIO saving is used then you should see a debug message "Using GIO to save: /path/foo.c" on saving. File permissions hopefully will be maintained.
I suggest we apply it (but maybe with a new hidden pref use_old_file_saving if we include it in a release, in case it doesn't work for some people).
Алексей: I know it's a long time later, but 2 questions: 1. Where is HAVE_GIO defined? Should we use a version check for GLib 2.16 instead? 2. I'm assuming there's no need to free the GFile from g_file_new_for_path?
Also just to mention: we don't use C++ style comments and don't allow variable declarations after code (g_return_val_if_fail) for portability - that's also my purpose in editing the patch.
Regards, Nick