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

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@3867 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2009-06-16 21:25:04 +00:00
parent c5d9af4e43
commit d55fa1d975
2 changed files with 14 additions and 23 deletions

View File

@ -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:

View File

@ -444,6 +444,10 @@ static void create_save_file_dialog(void)
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 @@ static void create_save_file_dialog(void)
#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 @@ static gboolean gtk_show_save_as(const gchar *initdir)
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 @@ static gboolean gtk_show_save_as(const gchar *initdir)
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 @@ static gboolean gtk_show_save_as(const gchar *initdir)
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;
}