[gnome-control-center] network: Remove WirelessSecurity constructor parameters that were never changed



commit d168eee5cd7d1198208a367fd1d9000b0f43872b
Author: Robert Ancell <robert ancell canonical com>
Date:   Tue Dec 3 15:14:56 2019 +1300

    network: Remove WirelessSecurity constructor parameters that were never changed

 panels/network/connection-editor/ce-page-security.c |  8 ++++----
 panels/network/wireless-security/ws-leap.c          | 14 ++++----------
 panels/network/wireless-security/ws-leap.h          |  2 +-
 panels/network/wireless-security/ws-wep-key.c       | 19 +++++++------------
 panels/network/wireless-security/ws-wep-key.h       |  4 +---
 panels/network/wireless-security/ws-wpa-psk.c       | 11 ++++-------
 panels/network/wireless-security/ws-wpa-psk.h       |  2 +-
 7 files changed, 22 insertions(+), 38 deletions(-)
---
diff --git a/panels/network/connection-editor/ce-page-security.c 
b/panels/network/connection-editor/ce-page-security.c
index de996ec57..cc4182ff3 100644
--- a/panels/network/connection-editor/ce-page-security.c
+++ b/panels/network/connection-editor/ce-page-security.c
@@ -276,7 +276,7 @@ finish_setup (CEPageSecurity *self)
                                 wep_type = NM_WEP_KEY_TYPE_KEY;
                 }
 
-                ws_wep = ws_wep_key_new (self->connection, NM_WEP_KEY_TYPE_KEY, FALSE, FALSE);
+                ws_wep = ws_wep_key_new (self->connection, NM_WEP_KEY_TYPE_KEY);
                 if (ws_wep) {
                         add_security_item (self, WIRELESS_SECURITY (ws_wep), sec_model,
                                            &iter, _("WEP 40/128-bit Key (Hex or ASCII)"),
@@ -286,7 +286,7 @@ finish_setup (CEPageSecurity *self)
                         item++;
                 }
 
-                ws_wep = ws_wep_key_new (self->connection, NM_WEP_KEY_TYPE_PASSPHRASE, FALSE, FALSE);
+                ws_wep = ws_wep_key_new (self->connection, NM_WEP_KEY_TYPE_PASSPHRASE);
                 if (ws_wep) {
                         add_security_item (self, WIRELESS_SECURITY (ws_wep), sec_model,
                                            &iter, _("WEP 128-bit Passphrase"), TRUE);
@@ -299,7 +299,7 @@ finish_setup (CEPageSecurity *self)
         if (nm_utils_security_valid (NMU_SEC_LEAP, dev_caps, FALSE, is_adhoc, 0, 0, 0)) {
                 WirelessSecurityLEAP *ws_leap;
 
-                ws_leap = ws_leap_new (self->connection, FALSE);
+                ws_leap = ws_leap_new (self->connection);
                 if (ws_leap) {
                         add_security_item (self, WIRELESS_SECURITY (ws_leap), sec_model,
                                            &iter, _("LEAP"), FALSE);
@@ -326,7 +326,7 @@ finish_setup (CEPageSecurity *self)
             nm_utils_security_valid (NMU_SEC_WPA2_PSK, dev_caps, FALSE, is_adhoc, 0, 0, 0)) {
                 WirelessSecurityWPAPSK *ws_wpa_psk;
 
-                ws_wpa_psk = ws_wpa_psk_new (self->connection, FALSE);
+                ws_wpa_psk = ws_wpa_psk_new (self->connection);
                 if (ws_wpa_psk) {
                         add_security_item (self, WIRELESS_SECURITY (ws_wpa_psk), sec_model,
                                            &iter, _("WPA & WPA2 Personal"), FALSE);
diff --git a/panels/network/wireless-security/ws-leap.c b/panels/network/wireless-security/ws-leap.c
index 9fb2a93ac..d641237e4 100644
--- a/panels/network/wireless-security/ws-leap.c
+++ b/panels/network/wireless-security/ws-leap.c
@@ -37,7 +37,6 @@ struct _WirelessSecurityLEAP {
        GtkEntry       *username_entry;
        GtkLabel       *username_label;
 
-       gboolean editing_connection;
        const char *password_flags_name;
 };
 
@@ -119,9 +118,8 @@ fill_connection (WirelessSecurity *security, NMConnection *connection)
                                     secret_flags, NULL);
 
        /* Update secret flags and popup when editing the connection */
-       if (self->editing_connection)
-               nma_utils_update_password_storage (GTK_WIDGET (self->password_entry), secret_flags,
-                                                  NM_SETTING (s_wireless_sec), self->password_flags_name);
+       nma_utils_update_password_storage (GTK_WIDGET (self->password_entry), secret_flags,
+                                          NM_SETTING (s_wireless_sec), self->password_flags_name);
 }
 
 static gboolean
@@ -166,7 +164,7 @@ wireless_security_iface_init (WirelessSecurityInterface *iface)
 }
 
 WirelessSecurityLEAP *
-ws_leap_new (NMConnection *connection, gboolean secrets_only)
+ws_leap_new (NMConnection *connection)
 {
        WirelessSecurityLEAP *self;
        NMSettingWirelessSecurity *wsec = NULL;
@@ -185,14 +183,13 @@ ws_leap_new (NMConnection *connection, gboolean secrets_only)
                }
        }
 
-       self->editing_connection = secrets_only ? FALSE : TRUE;
        self->password_flags_name = NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD;
 
        g_signal_connect_swapped (self->password_entry, "changed", G_CALLBACK (changed_cb), self);
 
        /* Create password-storage popup menu for password entry under entry's secondary icon */
        nma_utils_setup_password_storage (GTK_WIDGET (self->password_entry), 0, (NMSetting *) wsec, 
self->password_flags_name,
-                                         FALSE, secrets_only);
+                                         FALSE, FALSE);
 
        if (wsec)
                helper_fill_secret_entry (connection,
@@ -204,9 +201,6 @@ ws_leap_new (NMConnection *connection, gboolean secrets_only)
        if (wsec)
                gtk_entry_set_text (self->username_entry, nm_setting_wireless_security_get_leap_username 
(wsec));
 
-       if (secrets_only)
-               gtk_widget_hide (GTK_WIDGET (self->username_entry));
-
        g_signal_connect_swapped (self->show_password_check, "toggled", G_CALLBACK (show_toggled_cb), self);
 
        return self;
diff --git a/panels/network/wireless-security/ws-leap.h b/panels/network/wireless-security/ws-leap.h
index 20b8c0e15..ebe90bbe8 100644
--- a/panels/network/wireless-security/ws-leap.h
+++ b/panels/network/wireless-security/ws-leap.h
@@ -29,6 +29,6 @@ G_BEGIN_DECLS
 
 G_DECLARE_FINAL_TYPE (WirelessSecurityLEAP, ws_leap, WS, LEAP, GtkGrid)
 
-WirelessSecurityLEAP * ws_leap_new (NMConnection *connection, gboolean secrets_only);
+WirelessSecurityLEAP *ws_leap_new (NMConnection *connection);
 
 G_END_DECLS
diff --git a/panels/network/wireless-security/ws-wep-key.c b/panels/network/wireless-security/ws-wep-key.c
index 4ceb1ea29..6b3b7b44c 100644
--- a/panels/network/wireless-security/ws-wep-key.c
+++ b/panels/network/wireless-security/ws-wep-key.c
@@ -39,7 +39,6 @@ struct _WirelessSecurityWEPKey {
        GtkLabel       *key_label;
        GtkCheckButton *show_key_check;
 
-       gboolean editing_connection;
        const char *password_flags_name;
 
        NMWepKeyType type;
@@ -193,9 +192,8 @@ fill_connection (WirelessSecurity *security, NMConnection *connection)
        g_object_set (s_wsec, NM_SETTING_WIRELESS_SECURITY_WEP_KEY_FLAGS, secret_flags, NULL);
 
        /* Update secret flags and popup when editing the connection */
-       if (self->editing_connection)
-               nma_utils_update_password_storage (GTK_WIDGET (self->key_entry), secret_flags,
-                                                  NM_SETTING (s_wsec), self->password_flags_name);
+       nma_utils_update_password_storage (GTK_WIDGET (self->key_entry), secret_flags,
+                                          NM_SETTING (s_wsec), self->password_flags_name);
 }
 
 static void
@@ -282,20 +280,17 @@ wireless_security_iface_init (WirelessSecurityInterface *iface)
 
 WirelessSecurityWEPKey *
 ws_wep_key_new (NMConnection *connection,
-                NMWepKeyType type,
-                gboolean adhoc_create,
-                gboolean secrets_only)
+                NMWepKeyType type)
 {
        WirelessSecurityWEPKey *self;
        NMSettingWirelessSecurity *s_wsec = NULL;
        NMSetting *setting = NULL;
        guint8 default_key_idx = 0;
-       gboolean is_adhoc = adhoc_create;
+       gboolean is_adhoc = FALSE;
        gboolean is_shared_key = FALSE;
 
        self = g_object_new (ws_wep_key_get_type (), NULL);
 
-       self->editing_connection = secrets_only ? FALSE : TRUE;
        self->password_flags_name = NM_SETTING_WIRELESS_SECURITY_WEP_KEY0;
        self->type = type;
 
@@ -305,7 +300,7 @@ ws_wep_key_new (NMConnection *connection,
        if (connection)
                setting = (NMSetting *) nm_connection_get_setting_wireless_security (connection);
        nma_utils_setup_password_storage (GTK_WIDGET (self->key_entry), 0, setting, self->password_flags_name,
-                                         FALSE, secrets_only);
+                                         FALSE, FALSE);
 
        if (connection) {
                NMSettingWireless *s_wireless;
@@ -339,7 +334,7 @@ ws_wep_key_new (NMConnection *connection,
        g_signal_connect_swapped (self->key_index_combo, "changed", G_CALLBACK (key_index_combo_changed_cb), 
self);
 
        /* Key index is useless with adhoc networks */
-       if (is_adhoc || secrets_only) {
+       if (is_adhoc) {
                gtk_widget_hide (GTK_WIDGET (self->key_index_combo));
                gtk_widget_hide (GTK_WIDGET (self->key_index_label));
        }
@@ -357,7 +352,7 @@ ws_wep_key_new (NMConnection *connection,
        /* Don't show auth method for adhoc (which always uses open-system) or
         * when in "simple" mode.
         */
-       if (is_adhoc || secrets_only) {
+       if (is_adhoc) {
                /* Ad-Hoc connections can't use Shared Key auth */
                if (is_adhoc)
                        gtk_combo_box_set_active (self->auth_method_combo, 0);
diff --git a/panels/network/wireless-security/ws-wep-key.h b/panels/network/wireless-security/ws-wep-key.h
index 218270255..dc85e8b46 100644
--- a/panels/network/wireless-security/ws-wep-key.h
+++ b/panels/network/wireless-security/ws-wep-key.h
@@ -30,8 +30,6 @@ G_BEGIN_DECLS
 G_DECLARE_FINAL_TYPE (WirelessSecurityWEPKey, ws_wep_key, WS, WEP_KEY, GtkGrid)
 
 WirelessSecurityWEPKey *ws_wep_key_new (NMConnection *connection,
-                                        NMWepKeyType type,
-                                        gboolean adhoc_create,
-                                        gboolean secrets_only);
+                                        NMWepKeyType type);
 
 G_END_DECLS
diff --git a/panels/network/wireless-security/ws-wpa-psk.c b/panels/network/wireless-security/ws-wpa-psk.c
index 5e228d41f..93a2f260f 100644
--- a/panels/network/wireless-security/ws-wpa-psk.c
+++ b/panels/network/wireless-security/ws-wpa-psk.c
@@ -40,7 +40,6 @@ struct _WirelessSecurityWPAPSK {
        GtkComboBox    *type_combo;
        GtkLabel       *type_label;
 
-       gboolean editing_connection;
        const char *password_flags_name;
 };
 
@@ -130,9 +129,8 @@ fill_connection (WirelessSecurity *security, NMConnection *connection)
                                     secret_flags, NULL);
 
        /* Update secret flags and popup when editing the connection */
-       if (self->editing_connection)
-               nma_utils_update_password_storage (GTK_WIDGET (self->password_entry), secret_flags,
-                                                  NM_SETTING (s_wireless_sec), self->password_flags_name);
+       nma_utils_update_password_storage (GTK_WIDGET (self->password_entry), secret_flags,
+                                          NM_SETTING (s_wireless_sec), self->password_flags_name);
 
        wireless_security_clear_ciphers (connection);
        if (is_adhoc) {
@@ -196,14 +194,13 @@ wireless_security_iface_init (WirelessSecurityInterface *iface)
 }
 
 WirelessSecurityWPAPSK *
-ws_wpa_psk_new (NMConnection *connection, gboolean secrets_only)
+ws_wpa_psk_new (NMConnection *connection)
 {
        WirelessSecurityWPAPSK *self;
        NMSetting *setting = NULL;
 
        self = g_object_new (ws_wpa_psk_get_type (), NULL);
 
-       self->editing_connection = secrets_only ? FALSE : TRUE;
        self->password_flags_name = NM_SETTING_WIRELESS_SECURITY_PSK;
 
        g_signal_connect_swapped (self->password_entry, "changed", G_CALLBACK (changed_cb), self);
@@ -213,7 +210,7 @@ ws_wpa_psk_new (NMConnection *connection, gboolean secrets_only)
        if (connection)
                setting = (NMSetting *) nm_connection_get_setting_wireless_security (connection);
        nma_utils_setup_password_storage (GTK_WIDGET (self->password_entry), 0, setting, 
self->password_flags_name,
-                                         FALSE, secrets_only);
+                                         FALSE, FALSE);
 
        /* Fill secrets, if any */
        if (connection) {
diff --git a/panels/network/wireless-security/ws-wpa-psk.h b/panels/network/wireless-security/ws-wpa-psk.h
index 3c47506e1..7ca8676fa 100644
--- a/panels/network/wireless-security/ws-wpa-psk.h
+++ b/panels/network/wireless-security/ws-wpa-psk.h
@@ -29,6 +29,6 @@ G_BEGIN_DECLS
 
 G_DECLARE_FINAL_TYPE (WirelessSecurityWPAPSK, ws_wpa_psk, WS, WPA_PSK, GtkGrid)
 
-WirelessSecurityWPAPSK * ws_wpa_psk_new (NMConnection *connection, gboolean secrets_only);
+WirelessSecurityWPAPSK *ws_wpa_psk_new (NMConnection *connection);
 
 G_END_DECLS


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