From a8fdd2ef48cd8bd832f6c85c8f2a2903ac39c346 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20=C4=8Cernock=C3=BD?= Date: Sun, 14 Feb 2016 20:14:47 +0100 Subject: [PATCH] Set path for Save As --- src/file.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/file.c b/src/file.c index 3375720f..ffe82b50 100644 --- a/src/file.c +++ b/src/file.c @@ -525,6 +525,8 @@ gl_file_save_as (glLabel *label, GtkFileFilter *filter; gboolean saved_flag = FALSE; gchar *name, *title; + gchar *filename = NULL; + gchar *path; gl_debug (DEBUG_FILE, "START"); @@ -547,9 +549,19 @@ gl_file_save_as (glLabel *label, g_free (title); /* Recover proper state of save-as dialog */ - if (save_path != NULL) { + filename = gl_label_get_filename (label); + if (filename != NULL) + { + path = g_path_get_dirname (filename); + gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER(chooser), + path); + g_free (path); + g_free (filename); + } + else if (save_path != NULL) + { gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER(chooser), - save_path); + save_path); } filter = gtk_file_filter_new (); -- 2.39.5