[network-manager-applet/NETWORKMANAGER_APPLET_0_7] wifi: only show WEP index & auth method in connection editor



commit 84a363d11c3dadc546f4e7b8fc54326212ca4529
Author: Dan Williams <dcbw redhat com>
Date:   Mon Aug 10 14:59:34 2009 -0500

    wifi: only show WEP index & auth method in connection editor
    
    Almost nobody uses these options, and since those people that do use
    them already need that additional configuration, they might was well
    set that up in the connection editor.  This fixes the reported issues
    with users being confused by the options that almost nobody needs to
    change, while preserving the ability to set these options for users
    that need them.  In the future we could put some sort of disclosure
    triangle or something in standalone WEP dialog that would expose
    the index & auth method combos if people really seem to want them
    there.

 src/connection-editor/page-wireless-security.c |    4 ++--
 src/wireless-dialog.c                          |   17 ++++++++++-------
 src/wireless-security/ws-wep-key.c             |   15 ++++++++++-----
 src/wireless-security/ws-wep-key.h             |    3 ++-
 4 files changed, 24 insertions(+), 15 deletions(-)
---
diff --git a/src/connection-editor/page-wireless-security.c b/src/connection-editor/page-wireless-security.c
index 661d5e3..36aaa84 100644
--- a/src/connection-editor/page-wireless-security.c
+++ b/src/connection-editor/page-wireless-security.c
@@ -256,7 +256,7 @@ finish_setup (CEPageWirelessSecurity *self, gpointer unused, GError *error, gpoi
 				wep_type = NM_WEP_KEY_TYPE_KEY;
 		}
 
-		ws_wep = ws_wep_key_new (glade_file, connection, NM_WEP_KEY_TYPE_KEY, FALSE);
+		ws_wep = ws_wep_key_new (glade_file, connection, NM_WEP_KEY_TYPE_KEY, FALSE, FALSE);
 		if (ws_wep) {
 			add_security_item (self, WIRELESS_SECURITY (ws_wep), sec_model,
 			                   &iter, _("WEP 40/128-bit Key"));
@@ -265,7 +265,7 @@ finish_setup (CEPageWirelessSecurity *self, gpointer unused, GError *error, gpoi
 			item++;
 		}
 
-		ws_wep = ws_wep_key_new (glade_file, connection, NM_WEP_KEY_TYPE_PASSPHRASE, FALSE);
+		ws_wep = ws_wep_key_new (glade_file, connection, NM_WEP_KEY_TYPE_PASSPHRASE, FALSE, FALSE);
 		if (ws_wep) {
 			add_security_item (self, WIRELESS_SECURITY (ws_wep), sec_model,
 			                   &iter, _("WEP 128-bit Passphrase"));
diff --git a/src/wireless-dialog.c b/src/wireless-dialog.c
index 75e6233..9969c07 100644
--- a/src/wireless-dialog.c
+++ b/src/wireless-dialog.c
@@ -69,6 +69,8 @@ typedef struct {
 	gboolean nag_ignored;
 	gboolean network_name_focus;
 
+	gboolean auth_only;
+
 	gboolean disposed;
 } NMAWirelessDialogPrivate;
 
@@ -83,7 +85,7 @@ typedef struct {
 #define C_SEP_COLUMN		2
 #define C_NEW_COLUMN		3
 
-static gboolean security_combo_init (NMAWirelessDialog *self);
+static gboolean security_combo_init (NMAWirelessDialog *self, gboolean auth_only);
 
 void
 nma_wireless_dialog_set_nag_ignored (NMAWirelessDialog *self, gboolean ignored)
@@ -330,7 +332,7 @@ connection_combo_changed (GtkWidget *combo,
 	                    C_CON_COLUMN, &priv->connection,
 	                    C_NEW_COLUMN, &is_new, -1);
 
-	if (!security_combo_init (self)) {
+	if (!security_combo_init (self, priv->auth_only)) {
 		g_warning ("Couldn't change wireless security combo box.");
 		return;
 	}
@@ -566,7 +568,7 @@ device_combo_changed (GtkWidget *combo,
 		return;
 	}
 
-	if (!security_combo_init (self)) {
+	if (!security_combo_init (self, priv->auth_only)) {
 		g_warning ("Couldn't change wireless security combo box.");
 		return;
 	}
@@ -732,7 +734,7 @@ add_security_item (NMAWirelessDialog *self,
 }
 
 static gboolean
-security_combo_init (NMAWirelessDialog *self)
+security_combo_init (NMAWirelessDialog *self, gboolean auth_only)
 {
 	NMAWirelessDialogPrivate *priv;
 	GtkListStore *sec_model;
@@ -816,7 +818,7 @@ security_combo_init (NMAWirelessDialog *self)
 	    && ((!ap_wpa && !ap_rsn) || !(dev_caps & (NM_WIFI_DEVICE_CAP_WPA | NM_WIFI_DEVICE_CAP_RSN)))) {
 		WirelessSecurityWEPKey *ws_wep;
 
-		ws_wep = ws_wep_key_new (priv->glade_file, priv->connection, NM_WEP_KEY_TYPE_KEY, priv->adhoc_create);
+		ws_wep = ws_wep_key_new (priv->glade_file, priv->connection, NM_WEP_KEY_TYPE_KEY, priv->adhoc_create, auth_only);
 		if (ws_wep) {
 			add_security_item (self, WIRELESS_SECURITY (ws_wep), sec_model,
 			                   &iter, _("WEP 40/128-bit Key"));
@@ -825,7 +827,7 @@ security_combo_init (NMAWirelessDialog *self)
 			item++;
 		}
 
-		ws_wep = ws_wep_key_new (priv->glade_file, priv->connection, NM_WEP_KEY_TYPE_PASSPHRASE, priv->adhoc_create);
+		ws_wep = ws_wep_key_new (priv->glade_file, priv->connection, NM_WEP_KEY_TYPE_PASSPHRASE, priv->adhoc_create, auth_only);
 		if (ws_wep) {
 			add_security_item (self, WIRELESS_SECURITY (ws_wep), sec_model,
 			                   &iter, _("WEP 128-bit Passphrase"));
@@ -927,6 +929,7 @@ internal_init (NMAWirelessDialog *self,
 	gtk_window_set_resizable (GTK_WINDOW (self), FALSE);
 	gtk_dialog_set_has_separator (GTK_DIALOG (self), FALSE);
 
+	priv->auth_only = auth_only;
 	if (auth_only)
 		icon_name = "dialog-password";
 	else
@@ -996,7 +999,7 @@ internal_init (NMAWirelessDialog *self,
 		return FALSE;
 	}
 
-	if (!security_combo_init (self)) {
+	if (!security_combo_init (self, priv->auth_only)) {
 		g_warning ("Couldn't set up wireless security combo box.");
 		return FALSE;
 	}
diff --git a/src/wireless-security/ws-wep-key.c b/src/wireless-security/ws-wep-key.c
index 01bfcfb..c895dce 100644
--- a/src/wireless-security/ws-wep-key.c
+++ b/src/wireless-security/ws-wep-key.c
@@ -269,7 +269,8 @@ WirelessSecurityWEPKey *
 ws_wep_key_new (const char *glade_file,
                 NMConnection *connection,
                 NMWepKeyType type,
-                gboolean adhoc_create)
+                gboolean adhoc_create,
+                gboolean simple)
 {
 	WirelessSecurityWEPKey *sec;
 	GtkWidget *widget;
@@ -353,7 +354,7 @@ ws_wep_key_new (const char *glade_file,
 	                  sec);
 
 	/* Key index is useless with adhoc networks */
-	if (is_adhoc) {
+	if (is_adhoc || simple) {
 		gtk_widget_hide (widget);
 		widget = glade_xml_get_widget (xml, "key_index_label");
 		gtk_widget_hide (widget);
@@ -377,9 +378,13 @@ ws_wep_key_new (const char *glade_file,
 	                  (GCallback) wireless_security_changed_cb,
 	                  sec);
 
-	/* Ad-Hoc connections can't use Shared Key auth */
-	if (is_adhoc) {
-		gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
+	/* Don't show auth method for adhoc (which always uses open-system) or
+	 * when in "simple" mode.
+	 */
+	if (is_adhoc || simple) {
+		/* Ad-Hoc connections can't use Shared Key auth */
+		if (is_adhoc)
+			gtk_combo_box_set_active (GTK_COMBO_BOX (widget), 0);
 		gtk_widget_hide (widget);
 		widget = glade_xml_get_widget (xml, "auth_method_label");
 		gtk_widget_hide (widget);
diff --git a/src/wireless-security/ws-wep-key.h b/src/wireless-security/ws-wep-key.h
index 07cb472..1561480 100644
--- a/src/wireless-security/ws-wep-key.h
+++ b/src/wireless-security/ws-wep-key.h
@@ -35,7 +35,8 @@ typedef struct {
 WirelessSecurityWEPKey * ws_wep_key_new (const char *glade_file,
                                          NMConnection *connection,
                                          NMWepKeyType type,
-                                         gboolean adhoc_create);
+                                         gboolean adhoc_create,
+                                         gboolean simple);
 
 #endif /* WS_WEP_KEY_H */
 



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