From: Marek Černocký Date: Sun, 14 Feb 2016 19:14:47 +0000 (+0100) Subject: Set path for Save As X-Git-Tag: glabels-3_4_0~45 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a8fdd2ef48cd8bd832f6c85c8f2a2903ac39c346;p=glabels Set path for Save As --- 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 ();