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



commit 5e04155d2f46e0bc5be4ae50ad903245e8de72e4
Author: Dan Williams <dcbw redhat com>
Date:   Thu Nov 12 00:09:35 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    |   31 ++++++++++++++++++-------------
 2 files changed, 27 insertions(+), 14 deletions(-)
---
diff --git a/src/applet-device-wifi.c b/src/applet-device-wifi.c
index 6db26b2..ca2b087 100644
--- a/src/applet-device-wifi.c
+++ b/src/applet-device-wifi.c
@@ -1324,6 +1324,7 @@ wireless_dialog_response_cb (GtkDialog *foo,
 	NMDevice *device = NULL;
 	NMAccessPoint *ap = NULL;
 	NMAGConfConnection *gconf_connection;
+	const char *service = NM_DBUS_SERVICE_USER_SETTINGS;
 
 	if (response != GTK_RESPONSE_OK)
 		goto done;
@@ -1348,6 +1349,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;
+	}
+
 	gconf_connection = nma_gconf_settings_get_by_connection (applet->gconf_settings, connection);
 	if (gconf_connection) {
 		/* Not a new or system connection, save the updated settings to GConf */
@@ -1427,8 +1434,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 e284a1f..2f3ed5e 100644
--- a/src/wireless-dialog.c
+++ b/src/wireless-dialog.c
@@ -1139,19 +1139,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]