diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2018-07-12 19:49:06 +0200 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2018-07-12 19:49:06 +0200 |
commit | d9215e1ad063d0adc88d64c2cd311fd77a288e5b (patch) | |
tree | ff13b4b3c61b03d0119350c915a422abde5ef315 | |
parent | 346630de3f849a75b1fb7336d8ec8c1c1cf0aeda (diff) | |
download | network-manager-applet-d9215e1ad063d0adc88d64c2cd311fd77a288e5b.tar.gz |
connection-editor: don't defer creation of vpn connection to idlelr/vpn-add-idle
Now that GtkApplication makes good decisions about when to quit (when no
windows are present), the magic that deferred creation of vpn type
selector is useless. Worse even, it makes GtkApplication believe that
we're done and shuts it down before an editor window is added to it.
https://gitlab.gnome.org/GNOME/network-manager-applet/issues/9
Reported-by: Jan Tojnar
-rw-r--r-- | src/connection-editor/main.c | 58 |
1 files changed, 9 insertions, 49 deletions
diff --git a/src/connection-editor/main.c b/src/connection-editor/main.c index 2beba815..29d10154 100644 --- a/src/connection-editor/main.c +++ b/src/connection-editor/main.c @@ -39,39 +39,6 @@ gboolean nm_ce_keep_above; /*************************************************/ -typedef struct { - gboolean create; - NMConnectionList *list; - GType ctype; - char *detail; - char *import_filename; -} CreateConnectionInfo; - -static gboolean -idle_create_connection (gpointer user_data) -{ - CreateConnectionInfo *info = user_data; - - if (info->create) { - if (!info->ctype) - nm_connection_list_add (info->list); - else { - nm_connection_list_create (info->list, info->ctype, - info->detail, NULL); - } - } else { - /* import */ - nm_connection_list_create (info->list, info->ctype, - info->detail, info->import_filename); - } - - g_object_unref (info->list); - g_free (info->detail); - g_free (info->import_filename); - g_slice_free (CreateConnectionInfo, info); - return FALSE; -} - static gboolean handle_arguments (GApplication *application, const char *type, @@ -85,7 +52,6 @@ handle_arguments (GApplication *application, GType ctype = 0; gs_free char *type_tmp = NULL; const char *p, *detail = NULL; - CreateConnectionInfo *info; if (type) { p = strchr (type, ':'); @@ -113,21 +79,15 @@ handle_arguments (GApplication *application, if (show) { /* Just show the given connection type page */ nm_connection_list_set_type (list, ctype); - } else if (create || import) { - /* If type is "vpn" and the user cancels the "vpn type" dialog, we need - * to quit. But we haven't even started yet. So postpone this to an idle. - */ - info = g_slice_new0 (CreateConnectionInfo); - info->list = g_object_ref (list); - info->create = create; - info->detail = g_strdup (detail); - if (create) - info->ctype = ctype; - else { - info->ctype = NM_TYPE_SETTING_VPN; - info->import_filename = g_strdup (import); - } - g_idle_add (idle_create_connection, info); + } else if (create) { + if (!ctype) + nm_connection_list_add (list); + else + nm_connection_list_create (list, ctype, detail, NULL); + show_list = FALSE; + } else if (import) { + /* import */ + nm_connection_list_create (list, ctype, detail, import); show_list = FALSE; } else if (edit_uuid) { /* Show the edit dialog for the given UUID */ |