[network-manager-applet] connection-editor: fix cancel from --create --type vpn



commit 6de47d8ef14142c091fe9b6489e669b07ac2ab3c
Author: Dan Winship <danw gnome org>
Date:   Fri Jul 20 08:47:34 2012 -0400

    connection-editor: fix cancel from --create --type vpn
    
    If you run "nm-connection-editor --create --type vpn" and hit cancel,
    nm-c-e wasn't exiting (and wasn't showing the connection list either,
    so it was just useless). Fix that.

 src/connection-editor/main.c |   18 +++++++++++++++++-
 1 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/src/connection-editor/main.c b/src/connection-editor/main.c
index 50d5d3f..ead01a9 100644
--- a/src/connection-editor/main.c
+++ b/src/connection-editor/main.c
@@ -137,6 +137,16 @@ nm_ce_service_class_init (NMCEServiceClass *service_class)
 /*************************************************/
 
 static gboolean
+idle_create_connection (gpointer user_data)
+{
+	NMConnectionList *list = user_data;
+	GType ctype = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (list), "nm-connection-editor-ctype"));
+
+	nm_connection_list_create (list, ctype);
+	return FALSE;
+}
+
+static gboolean
 handle_arguments (NMConnectionList *list,
                   const char *type,
                   gboolean create,
@@ -162,7 +172,13 @@ handle_arguments (NMConnectionList *list,
 			g_warning ("'create' requested but no connection type given.");
 			return TRUE;
 		}
-		nm_connection_list_create (list, ctype);
+
+		/* 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.
+		 */
+		g_idle_add (idle_create_connection, list);
+		g_object_set_data (G_OBJECT (list), "nm-connection-editor-ctype",
+		                   GUINT_TO_POINTER (ctype));
 
 		show_list = FALSE;
 	} else if (edit_uuid) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]