]> git.sur5r.net Git - glabels/commitdiff
Set path for Save As
authorMarek Černocký <marek@manet.cz>
Sun, 14 Feb 2016 19:14:47 +0000 (20:14 +0100)
committerJim Evins <evins@snaught.com>
Sun, 21 Feb 2016 20:43:47 +0000 (15:43 -0500)
src/file.c

index 3375720f175603dface8ac3c9054299d1b0b91ce..ffe82b508050a4f7edc53397c418cbaf5dfc33fd 100644 (file)
@@ -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 ();