SF.net SVN: geany:[4732] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Sun Mar 7 17:37:00 UTC 2010


Revision: 4732
          http://geany.svn.sourceforge.net/geany/?rev=4732&view=rev
Author:   eht16
Date:     2010-03-07 17:37:00 +0000 (Sun, 07 Mar 2010)

Log Message:
-----------
When editing non-existent config files using the Tools->Configuration Files menu, explicitly set the real_path to avoid presenting the Save As dialog when saving the file (patch by Tony Rick, thanks).

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/ui_utils.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2010-03-07 17:28:13 UTC (rev 4731)
+++ trunk/ChangeLog	2010-03-07 17:37:00 UTC (rev 4732)
@@ -23,6 +23,10 @@
  * src/dialog.c:
    Fix setting the icon for some dialogs if the parent itself is also
    a dialog.
+ * src/ui_utils.c:
+   When editing non-existent config files using the Tools->Configuration
+   Files menu, explicitly set the real_path to avoid presenting the Save
+   As dialog when saving the file (patch by Tony Rick, thanks).
 
 
 2010-03-05  Frank Lanitz  <frank(at)frank(dot)uvena(dot)de>

Modified: trunk/src/ui_utils.c
===================================================================
--- trunk/src/ui_utils.c	2010-03-07 17:28:13 UTC (rev 4731)
+++ trunk/src/ui_utils.c	2010-03-07 17:37:00 UTC (rev 4732)
@@ -1737,18 +1737,24 @@
 		document_open_file(file_name, FALSE, ft, NULL);
 	else
 	{
-		gchar *utf8 = utils_get_utf8_from_locale(file_name);
+		gchar *utf8_filename = utils_get_utf8_from_locale(file_name);
 		gchar *base_name = g_path_get_basename(file_name);
 		gchar *global_file = g_build_filename(app->datadir, base_name, NULL);
 		gchar *global_content = NULL;
+		GeanyDocument *doc;
 
 		/* if the requested file doesn't exist in the user's config dir, try loading the file
 		 * from the global data directory and use its contents for the newly created file */
 		if (g_file_test(global_file, G_FILE_TEST_EXISTS))
 			g_file_get_contents(global_file, &global_content, NULL, NULL);
 
-		document_new_file(utf8, ft, global_content);
-		utils_free_pointers(4, utf8, base_name, global_file, global_content, NULL);
+		doc = document_new_file(utf8_filename, ft, global_content);
+
+		/* Enforce config file override policy by populating doc->real_path, which in turn
+		 * allows document to be saved directly to file_name location. */
+		doc->real_path = g_strdup(utf8_filename);
+
+		utils_free_pointers(4, utf8_filename, base_name, global_file, global_content, NULL);
 	}
 }
 


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