Use current working directory for initial file selection dialog
authorHugo Villeneuve <hugo@hugovil.com>
Sun, 8 Sep 2013 02:03:08 +0000 (22:03 -0400)
committerHugo Villeneuve <hugo@hugovil.com>
Mon, 9 Sep 2013 00:54:15 +0000 (20:54 -0400)
src/filemenu.c

index c3f13e0..560f4d9 100644 (file)
@@ -38,6 +38,7 @@ void
 FileOpenEvent(GtkObject *object, gpointer data)
 {
        GtkWidget *file_dialog;
+       char *cwd;
 
 #if defined(DEBUG)
        g_print("FileOpenEvent()\n");
@@ -49,6 +50,11 @@ FileOpenEvent(GtkObject *object, gpointer data)
                GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
                GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL);
 
+       /* Opening file chooser to current working directory. */
+       cwd = g_get_current_dir();
+       gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(file_dialog), cwd);
+       g_free (cwd);
+
        if (gtk_dialog_run(GTK_DIALOG(file_dialog)) == GTK_RESPONSE_ACCEPT) {
                char *selected_file;