GTK: ignore options
Specifying any options on the command line besides the ROM dump aborts with "Unknown option <--option-name>". This happened after starting the GTK application, which wants to parse the command line again. Install an empty command-line signal handler into the GTK application, since options are already parsed by CommandLine::parse(). Setting .nds_filename was alredy done by CommandLine::parse(), too, so the signal handler for open can be removed.
This commit is contained in:
parent
9836f56312
commit
581155aa30
|
@ -3549,16 +3549,13 @@ static void Teardown() {
|
|||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
handle_open(GApplication *application,
|
||||
GFile **files,
|
||||
gint n_files,
|
||||
const gchar *hint,
|
||||
static gint
|
||||
ignore_command_line(GApplication *application,
|
||||
GApplicationCommandLine *command_line,
|
||||
gpointer user_data)
|
||||
{
|
||||
configured_features *my_config = static_cast<configured_features*>(user_data);
|
||||
my_config->nds_file = g_file_get_path(files[0]);
|
||||
common_gtk_main(application, user_data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
|
@ -3578,10 +3575,9 @@ int main (int argc, char *argv[])
|
|||
fprintf(stderr, "Warning: X11 not thread-safe\n");
|
||||
}
|
||||
|
||||
// TODO: pass G_APPLICATION_HANDLES_COMMAND_LINE instead.
|
||||
GtkApplication *app = gtk_application_new("org.desmume.DeSmuME", G_APPLICATION_HANDLES_OPEN);
|
||||
GtkApplication *app = gtk_application_new("org.desmume.DeSmuME", G_APPLICATION_HANDLES_COMMAND_LINE);
|
||||
g_signal_connect (app, "activate", G_CALLBACK(common_gtk_main), &my_config);
|
||||
g_signal_connect (app, "open", G_CALLBACK(handle_open), &my_config);
|
||||
g_signal_connect (app, "command-line", G_CALLBACK(ignore_command_line), &my_config);
|
||||
g_action_map_add_action_entries(G_ACTION_MAP(app),
|
||||
app_entries, G_N_ELEMENTS(app_entries),
|
||||
app);
|
||||
|
|
Loading…
Reference in New Issue