[GTK3] Implement ROM loading from open file dialog
This commit is contained in:
parent
9b360ef292
commit
e42d16290d
@ -1096,8 +1096,10 @@ static void activate_open(GSimpleAction *action, GVariant *parameter, gpointer a
|
|||||||
gint res = gtk_native_dialog_run(GTK_NATIVE_DIALOG(native));
|
gint res = gtk_native_dialog_run(GTK_NATIVE_DIALOG(native));
|
||||||
|
|
||||||
if (res == GTK_RESPONSE_ACCEPT) {
|
if (res == GTK_RESPONSE_ACCEPT) {
|
||||||
// TODO: Emit an event for our emulation loop
|
const char* path = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(native));
|
||||||
g_message("%s", gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(native)));
|
gui_data.file = g_file_new_for_path(path);
|
||||||
|
|
||||||
|
activate_reset(action, parameter, app);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_object_unref(native);
|
g_object_unref(native);
|
||||||
@ -2090,6 +2092,8 @@ static void run(GuiData *gui_data) {
|
|||||||
static gpointer run_thread(gpointer gui_data_gptr) {
|
static gpointer run_thread(gpointer gui_data_gptr) {
|
||||||
GuiData *gui_data = gui_data_gptr;
|
GuiData *gui_data = gui_data_gptr;
|
||||||
|
|
||||||
|
if (!gui_data->file) return NULL;
|
||||||
|
|
||||||
if (gui_data->stopped) {
|
if (gui_data->stopped) {
|
||||||
start(gui_data);
|
start(gui_data);
|
||||||
}
|
}
|
||||||
@ -2101,7 +2105,6 @@ static gpointer run_thread(gpointer gui_data_gptr) {
|
|||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void init(GuiData *gui_data) {
|
static void init(GuiData *gui_data) {
|
||||||
if (GB_is_inited(&gb)) return;
|
if (GB_is_inited(&gb)) return;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user