diff options
author | Thomas Haller <thaller@redhat.com> | 2016-11-11 19:02:34 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2016-11-22 13:47:26 +0100 |
commit | 555920eb132938ade56eb240d9cbd58a217d6cf2 (patch) | |
tree | 6a7fe1c96895265970db8d87c0de6d9ee2a24435 | |
parent | bd8108c39b5e98c48a541dcb52715b58e26299a2 (diff) | |
download | network-manager-applet-555920eb132938ade56eb240d9cbd58a217d6cf2.tar.gz |
c-e: fix exiting after cancelling connection type selection
Fixes hanging application when pressing "Cancel" with
nm-connection-editor --create
-rw-r--r-- | src/connection-editor/main.c | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/src/connection-editor/main.c b/src/connection-editor/main.c index b82066ff..e28aa8ec 100644 --- a/src/connection-editor/main.c +++ b/src/connection-editor/main.c @@ -50,6 +50,7 @@ static GDBusNodeInfo *introspection_data = NULL; /*************************************************/ typedef struct { + gboolean create; NMConnectionList *list; GType ctype; char *detail; @@ -61,8 +62,18 @@ idle_create_connection (gpointer user_data) { CreateConnectionInfo *info = user_data; - nm_connection_list_create (info->list, info->ctype, - info->detail, info->connection); + 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->connection); + } g_object_unref (info->list); g_free (info->detail); @@ -102,25 +113,20 @@ handle_arguments (NMConnectionList *list, if (show) { /* Just show the given connection type page */ nm_connection_list_set_type (list, ctype); - } else if (create) { - if (!ctype) - nm_connection_list_add (list); - else { - /* 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->ctype = ctype; - info->detail = g_strdup (detail); - g_idle_add (idle_create_connection, info); - } - show_list = FALSE; - } else if (import) { + } 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->ctype = NM_TYPE_SETTING_VPN; - info->connection = vpn_connection_from_file (import); + info->create = create; + info->detail = g_strdup (detail); + if (create) + info->ctype = ctype; + else { + info->ctype = NM_TYPE_SETTING_VPN; + info->connection = vpn_connection_from_file (import); + } g_idle_add (idle_create_connection, info); show_list = FALSE; } else if (edit_uuid) { |