main.c: main() gtk3.4+: hide cmd line args from GApplication

Handling cmd line args with GApplication is a nightmare
https://developer.gnome.org/gtkmm-tutorial/stable/sec-multi-item-containers.html.en#boxes-command-line-options
This commit is contained in:
wdlkmpx 2021-02-22 14:57:08 +08:00
parent 0573d99082
commit e390c1e063
1 changed files with 4 additions and 2 deletions

View File

@ -533,7 +533,6 @@ static void on_compline_activated (GtkCompletionLine *cl)
static void gmrun_activate(void)
{
GtkWidget *dialog, * main_vbox;
GtkWidget *label_search;
GtkWidget * window = gtk_application_window_new (gmrun_app);
@ -758,7 +757,10 @@ int main(int argc, char **argv)
config_init ();
parse_command_line (argc, argv);
#if GTK_CHECK_VERSION(3, 0, 0)
#if GTK_CHECK_VERSION(3, 4, 0)
// Handling cmd line args with GApplication is a nightmare
// follow this: https://developer.gnome.org/gtkmm-tutorial/stable/sec-multi-item-containers.html.en#boxes-command-line-options
argc = 1; /* hide args from GApplication */
gmrun_app = gtk_application_new ("org.gtk.gmrun", G_APPLICATION_FLAGS_NONE);
g_signal_connect (gmrun_app, "activate", gmrun_activate, NULL);
status = g_application_run (G_APPLICATION (gmrun_app), argc, argv);