Skip to content

Commit ca125e4

Browse files
committed
Gtk3: respect event/snapshot directory in snapshot load/save dialogs
Read the "EventSnapshotDir" resource and use that to set the initial directory of the event load and save dialogs. Partially fixes bug #2192. git-svn-id: https://svn.code.sf.net/p/vice-emu/code/trunk@45947 379a1393-f5fb-40a0-bcee-ef074d9b53f7
1 parent 7836e37 commit ca125e4

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

vice/src/arch/gtk3/uisnapshot.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ static void save_snapshot_dialog(void)
126126
gint response_id;
127127
int save_roms;
128128
int save_disks;
129+
const char *eventdir = NULL;
130+
131+
resources_get_string("EventSnapshotDir", &eventdir);
129132

130133
dialog = gtk_file_chooser_dialog_new("Save snapshot file",
131134
ui_get_active_window(),
@@ -137,6 +140,11 @@ static void save_snapshot_dialog(void)
137140
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(dialog),
138141
create_file_chooser_filter(file_chooser_filter_snapshot, FALSE));
139142

143+
/* set directory */
144+
if (eventdir != NULL && *eventdir != '\0') {
145+
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), eventdir);
146+
}
147+
140148
/* set proposed filename */
141149
gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog),
142150
create_proposed_snapshot_name());
@@ -224,10 +232,13 @@ static void load_snapshot_filename_callback(GtkDialog *dialog,
224232
static gboolean load_snapshot_trap_impl(gpointer user_data)
225233
{
226234
const char *filters[] = { "*.vsf", NULL };
235+
const char *eventdir = NULL;
236+
237+
resources_get_string("EventSnapshotDir", &eventdir);
227238

228239
vice_gtk3_open_file_dialog(
229240
"Open snapshot file",
230-
"Snapshot files", filters, NULL,
241+
"Snapshot files", filters, eventdir,
231242
load_snapshot_filename_callback,
232243
NULL);
233244
/* FIXME: shouldn't this return TRUE? */

0 commit comments

Comments
 (0)