SF.net SVN: geany:[3867] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Tue Jun 16 21:25:11 UTC 2009


Revision: 3867
          http://geany.svn.sourceforge.net/geany/?rev=3867&view=rev
Author:   eht16
Date:     2009-06-16 21:25:04 +0000 (Tue, 16 Jun 2009)

Log Message:
-----------
Don't explicitly change the current directory of the Save As dialog so that it uses the last used directory.

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

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2009-06-14 10:41:10 UTC (rev 3866)
+++ trunk/ChangeLog	2009-06-16 21:25:04 UTC (rev 3867)
@@ -1,3 +1,10 @@
+2009-06-16  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>
+
+ * src/dialogs.c:
+   Don't explicitly change the current directory of the Save As dialog
+   so that it uses the last used directory.
+
+
 2009-06-14  Enrico Tröger  <enrico(dot)troeger(at)uvena(dot)de>
 
  * src/encodings.c, src/encodings.h, src/plugindata.h:

Modified: trunk/src/dialogs.c
===================================================================
--- trunk/src/dialogs.c	2009-06-14 10:41:10 UTC (rev 3866)
+++ trunk/src/dialogs.c	2009-06-16 21:25:04 UTC (rev 3867)
@@ -444,6 +444,10 @@
 	if (gtk_check_version(2, 14, 0) == NULL)
 		gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(ui_widgets.save_filesel), FALSE);
 
+	/* set the folder by default to the project base dir or the global pref for opening files */
+	gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(ui_widgets.save_filesel),
+			utils_get_default_dir_utf8());
+
 	g_signal_connect(check_open_new_tab, "toggled",
 				G_CALLBACK(on_save_as_new_tab_toggled), rename_btn);
 
@@ -461,11 +465,10 @@
 
 
 #if ! GEANY_USE_WIN32_DIALOG
-static gboolean gtk_show_save_as(const gchar *initdir)
+static gboolean gtk_show_save_as(void)
 {
 	GeanyDocument *doc = document_get_current();
 	gint resp;
-	gboolean folder_set = FALSE;
 
 	if (G_UNLIKELY(ui_widgets.save_filesel == NULL))
 		create_save_file_dialog();
@@ -480,7 +483,6 @@
 			gchar *locale_basename = g_path_get_basename(locale_filename);
 			gchar *locale_dirname = g_path_get_dirname(locale_filename);
 
-			folder_set = TRUE;
 			gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(ui_widgets.save_filesel),
 				locale_dirname);
 			gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(ui_widgets.save_filesel),
@@ -514,10 +516,6 @@
 		gtk_file_chooser_add_shortcut_folder(GTK_FILE_CHOOSER(ui_widgets.save_filesel),
 			app->project->base_path, NULL);
 
-	/* if the folder wasn't set so far, we set it to the given directory */
-	if (! folder_set && initdir != NULL && g_path_is_absolute(initdir))
-		gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(ui_widgets.save_filesel), initdir);
-
 	/* Run the dialog synchronously, pausing this function call */
 	resp = gtk_dialog_run(GTK_DIALOG(ui_widgets.save_filesel));
 
@@ -538,26 +536,12 @@
 gboolean dialogs_show_save_as()
 {
 	gboolean result;
-	gchar *initdir = NULL;
-	static gboolean initial = TRUE;
 
-	initdir = utils_get_current_file_dir_utf8();
-
-	/* use project or default startup directory (if set) if no files are open */
-	if (initdir == NULL && initial)
-	{
-		initdir = g_strdup(utils_get_default_dir_utf8());
-		initial = FALSE;
-	}
-
-	setptr(initdir, utils_get_locale_from_utf8(initdir));
-
 #if GEANY_USE_WIN32_DIALOG
-	result = win32_show_file_dialog(FALSE, initdir);
+	result = win32_show_file_dialog(FALSE, utils_get_default_dir_utf8());
 #else
-	result = gtk_show_save_as(initdir);
+	result = gtk_show_save_as();
 #endif
-	g_free(initdir);
 	return result;
 }
 


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