gtk: remember last file loaded and load it by default in the filechooser
This commit is contained in:
parent
fc8a43b524
commit
acec8ad4c5
|
@ -213,6 +213,10 @@ InitConfig()
|
|||
config->addOption("mute", "SDL.MuteCapture", 0);
|
||||
#endif
|
||||
|
||||
#ifdef _GTK
|
||||
config->addOption("", "SDL.LastOpenFile", "/");
|
||||
#endif
|
||||
|
||||
// fcm -> fm2 conversion
|
||||
config->addOption("fcmconvert", "SDL.FCMConvert", "");
|
||||
|
||||
|
|
|
@ -1260,9 +1260,14 @@ void loadGame ()
|
|||
gtk_file_filter_add_pattern(filterAll, "*");
|
||||
gtk_file_filter_set_name(filterAll, "All Files");
|
||||
|
||||
|
||||
|
||||
fileChooser = gtk_file_chooser_dialog_new ("Open ROM", GTK_WINDOW(MainWindow),
|
||||
GTK_FILE_CHOOSER_ACTION_OPEN, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, NULL);
|
||||
const char* last_dir;
|
||||
g_config->getOption("SDL.LastOpenFile", &last_dir);
|
||||
gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(fileChooser), last_dir);
|
||||
|
||||
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(fileChooser), filterFCEU);
|
||||
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(fileChooser), filterNes);
|
||||
|
@ -1277,6 +1282,7 @@ void loadGame ()
|
|||
|
||||
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (fileChooser));
|
||||
gtk_widget_destroy (fileChooser);
|
||||
g_config->setOption("SDL.LastOpenFile", filename);
|
||||
if(LoadGame(filename) == 0)
|
||||
{
|
||||
|
||||
|
|
Loading…
Reference in New Issue