[network-manager-applet/th/c-e-import-fixes-bgo774290: 9/10] c-e: fix exiting after cancelling connection type selection
- From: Thomas Haller <thaller src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet/th/c-e-import-fixes-bgo774290: 9/10] c-e: fix exiting after cancelling connection type selection
- Date: Tue, 22 Nov 2016 10:48:53 +0000 (UTC)
commit 90f7329a2fea4eba9bc06da89d26531c10ff2d92
Author: Thomas Haller <thaller redhat com>
Date: Fri Nov 11 19:02:34 2016 +0100
c-e: fix exiting after cancelling connection type selection
Fixes hanging application when pressing "Cancel" with
nm-connection-editor --create
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 b82066f..e28aa8e 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) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]