[network-manager-applet/NETWORKMANAGER_APPLET_0_7] applet: assume system connections are valid in the wireless dialog



commit 67d8204cb6f5d2048096e2d5c5febcda3af5e669
Author: Dan Williams <dcbw redhat com>
Date:   Thu Nov 12 00:00:17 2009 -0800

    applet: assume system connections are valid in the wireless dialog
    
    Since 0.7 doesn't request secrets from system connections, there wasn't
    really any way to validate the connection, and the wireless dialog's
    Connect... button would always be insensitive when picking a system
    connection from the "Connect to hidden..." menu item.  Since the
    connection couldn't have been exported over D-Bus if it wasn't
    valid in the first place, assume it is valid even though we don't
    have secrets for it.  This is fixed in NM 0.8.

 src/wireless-dialog.c |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/src/wireless-dialog.c b/src/wireless-dialog.c
index a75b8e8..e284a1f 100644
--- a/src/wireless-dialog.c
+++ b/src/wireless-dialog.c
@@ -1,3 +1,4 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
 /* NetworkManager Wireless Applet -- Display wireless access points and allow user control
  *
  * Dan Williams <dcbw redhat com>
@@ -224,6 +225,14 @@ security_combo_changed_manually (GtkWidget *combo,
 	security_combo_changed (combo, user_data);
 }
 
+static gboolean
+is_system_connection (NMAWirelessDialog *self)
+{
+	NMAWirelessDialogPrivate *priv = NMA_WIRELESS_DIALOG_GET_PRIVATE (self);
+
+	return priv->connection && (nm_connection_get_scope (priv->connection) == NM_CONNECTION_SCOPE_SYSTEM);
+}
+
 static GByteArray *
 validate_dialog_ssid (NMAWirelessDialog *self)
 {
@@ -272,6 +281,10 @@ stuff_changed_cb (WirelessSecurity *sec, gpointer user_data)
 			g_byte_array_free (ssid, TRUE);
 	}
 
+	/* Assume system connections are valid so that we don't have to get secrets for them. */
+	if (is_system_connection (self))
+		valid = TRUE;
+
 	gtk_dialog_set_response_sensitive (GTK_DIALOG (self), GTK_RESPONSE_OK, valid);
 }
 
@@ -307,6 +320,10 @@ ssid_entry_changed (GtkWidget *entry, gpointer user_data)
 	}
 
 out:
+	/* Assume system connections are valid so that we don't have to get secrets for them. */
+	if (is_system_connection (self))
+		valid = TRUE;
+
 	gtk_dialog_set_response_sensitive (GTK_DIALOG (self), GTK_RESPONSE_OK, valid);
 }
 
@@ -996,7 +1013,11 @@ internal_init (NMAWirelessDialog *self,
 		priv->network_name_focus = TRUE;
 	}
 
-	gtk_dialog_set_response_sensitive (GTK_DIALOG (self), GTK_RESPONSE_OK, FALSE);
+	/* Assume system connections are valid so that we don't have to get secrets for them. */
+	if (is_system_connection (self))
+		gtk_dialog_set_response_sensitive (GTK_DIALOG (self), GTK_RESPONSE_OK, TRUE);
+	else
+		gtk_dialog_set_response_sensitive (GTK_DIALOG (self), GTK_RESPONSE_OK, FALSE);
 
 	if (!device_combo_init (self, specific_device)) {
 		g_warning ("No wireless devices available.");



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