[network-manager-applet] applet: fix connecting to system connections from the wireless dialog



commit 4162285fd7c53e8b684e1c1513a2ba6ce865e073
Author: Dan Williams <dcbw redhat com>
Date:   Wed Nov 11 23:27:27 2009 -0800

    applet: fix connecting to system connections from the wireless dialog
    
    Picking a system connection from the dropdown of the Connect to Hidden...
    dialog wasn't working because it didn't handle system connections at
    all; fix that.

 src/applet-device-wifi.c |   10 +++++++++-
 src/wireless-dialog.c    |   32 ++++++++++++++++++--------------
 2 files changed, 27 insertions(+), 15 deletions(-)
---
diff --git a/src/applet-device-wifi.c b/src/applet-device-wifi.c
index bd487b0..724141a 100644
--- a/src/applet-device-wifi.c
+++ b/src/applet-device-wifi.c
@@ -1417,6 +1417,7 @@ wireless_dialog_response_cb (GtkDialog *foo,
 	NMConnection *connection = NULL, *fuzzy_match = NULL;
 	NMDevice *device = NULL;
 	NMAccessPoint *ap = NULL;
+	const char *service = NM_DBUS_SERVICE_USER_SETTINGS;
 
 	if (response != GTK_RESPONSE_OK)
 		goto done;
@@ -1444,6 +1445,12 @@ wireless_dialog_response_cb (GtkDialog *foo,
 	g_assert (connection);
 	g_assert (device);
 
+	/* If it's a system connection we just need to tell NM to activate it */
+	if (nm_connection_get_scope (connection) == NM_CONNECTION_SCOPE_SYSTEM) {
+		service = NM_DBUS_SERVICE_SYSTEM_SETTINGS;
+		goto activate;
+	}
+
 	if (NMA_IS_GCONF_CONNECTION (connection)) {
 		/* Not a new or system connection, save the updated settings to GConf */
 		nm_settings_connection_interface_update (NM_SETTINGS_CONNECTION_INTERFACE (connection),
@@ -1528,8 +1535,9 @@ wireless_dialog_response_cb (GtkDialog *foo,
 		}
 	}
 
+activate:
 	nm_client_activate_connection (applet->nm_client,
-	                               NM_DBUS_SERVICE_USER_SETTINGS,
+	                               service,
 	                               nm_connection_get_path (connection),
 	                               device,
 	                               ap ? nm_object_get_path (NM_OBJECT (ap)) : NULL,
diff --git a/src/wireless-dialog.c b/src/wireless-dialog.c
index 6e2c5de..b42e0f8 100644
--- a/src/wireless-dialog.c
+++ b/src/wireless-dialog.c
@@ -1208,20 +1208,24 @@ nma_wireless_dialog_get_connection (NMAWirelessDialog *self,
 	} else
 		connection = g_object_ref (priv->connection);
 
-
-	/* Fill security */
-	model = gtk_combo_box_get_model (GTK_COMBO_BOX (priv->sec_combo));
-	gtk_combo_box_get_active_iter (GTK_COMBO_BOX (priv->sec_combo), &iter);
-	gtk_tree_model_get (model, &iter, S_SEC_COLUMN, &sec, -1);
-	if (sec) {
-		wireless_security_fill_connection (sec, connection);
-		wireless_security_unref (sec);
-	} else {
-		/* Unencrypted */
-		s_wireless = NM_SETTING_WIRELESS (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS));
-		g_assert (s_wireless);
-
-		g_object_set (s_wireless, NM_SETTING_WIRELESS_SEC, NULL, NULL);
+	/* Only update security information for user connections, as for system
+	 * connections the applet just needs to tell NM to activate it.
+	 */
+	if (!is_system_connection (self)) {
+		/* Fill security */
+		model = gtk_combo_box_get_model (GTK_COMBO_BOX (priv->sec_combo));
+		gtk_combo_box_get_active_iter (GTK_COMBO_BOX (priv->sec_combo), &iter);
+		gtk_tree_model_get (model, &iter, S_SEC_COLUMN, &sec, -1);
+		if (sec) {
+			wireless_security_fill_connection (sec, connection);
+			wireless_security_unref (sec);
+		} else {
+			/* Unencrypted */
+			s_wireless = NM_SETTING_WIRELESS (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS));
+			g_assert (s_wireless);
+
+			g_object_set (s_wireless, NM_SETTING_WIRELESS_SEC, NULL, NULL);
+		}
 	}
 
 	/* Fill device */



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