diff --git a/ChangeLog b/ChangeLog index 481548610..5fb305872 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +2006-01-16 Dan Williams + + * gnome/applet/wso-wpa-psk-hex.[ch] + - Renamed -> wso-wpa-psk.[ch] + + * gnome/applet/wso-wpa-psk.[ch] + - New files + + * gnome/applet/wso-wpa-psk-passphrase.[ch] + - Removed, rolled into wso-wpa-psk.[ch] + + * gnome/applet/Makefile.am + - Updated for above changes + + * gnome/applet/wireless-applet.glade + - Consolidate WPA-PSK options into one notebook + widget, and make dialogs invisible by default + to fix screen oddities + + * gnome/applet/wireless-security-manager.c + - (wsm_set_capabilities): create the new wpa-psk widget rather + than both the old hex & passphrase ones + 2006-01-16 Dan Williams * gnome/applet/other-network-dialog.c diff --git a/gnome/applet/Makefile.am b/gnome/applet/Makefile.am index 6165f65e1..badf84170 100644 --- a/gnome/applet/Makefile.am +++ b/gnome/applet/Makefile.am @@ -73,10 +73,8 @@ nm_applet_SOURCES = \ wso-wep-hex.h \ wso-wep-passphrase.c \ wso-wep-passphrase.h \ - wso-wpa-psk-hex.c \ - wso-wpa-psk-hex.h \ - wso-wpa-psk-passphrase.c \ - wso-wpa-psk-passphrase.h \ + wso-wpa-psk.c \ + wso-wpa-psk.h \ nm-gconf-wso.c \ nm-gconf-wso.h \ nm-gconf-wso-private.h \ diff --git a/gnome/applet/wireless-applet.glade b/gnome/applet/wireless-applet.glade index b1027f6a2..97d5b61ea 100644 --- a/gnome/applet/wireless-applet.glade +++ b/gnome/applet/wireless-applet.glade @@ -304,11 +304,10 @@ You have chosen to log in to the wireless network '%s'. If you are sure that th 6 - True Other Wireless Network... GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False + GTK_WIN_POS_CENTER_ALWAYS + True 488 False False @@ -625,7 +624,7 @@ WEP 40/128-bit ASCII Wireless Network Key Required GTK_WINDOW_TOPLEVEL GTK_WIN_POS_CENTER_ALWAYS - False + True False False True @@ -1988,9 +1987,9 @@ Shared Key - + True - wpa_psk_hex_subwindow + wpa_psk_subwindow GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE False @@ -2005,7 +2004,7 @@ Shared Key False - + True False False @@ -2024,9 +2023,9 @@ Shared Key 4 - + True - Key: + Password: False False GTK_JUSTIFY_LEFT @@ -2052,7 +2051,7 @@ Shared Key - + True True True @@ -2073,29 +2072,7 @@ Shared Key - - True - True - Use WPA Enterprise (WPA2) - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 1 - 2 - 2 - 3 - fill - - - - - - + True Type: False @@ -2123,7 +2100,7 @@ Shared Key - + True False @@ -2138,6 +2115,28 @@ Shared Key fill + + + + True + True + Connect using WPA2 + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 1 + 2 + 2 + 3 + fill + + + False @@ -2387,214 +2386,4 @@ Shared Key - - True - wpa_psk_passphrase_subwindow - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - True - False - True - False - False - GDK_WINDOW_TYPE_HINT_NORMAL - GDK_GRAVITY_NORTH_WEST - True - False - - - - True - False - False - GTK_POS_TOP - False - False - - - - 8 - True - 3 - 2 - False - 4 - 4 - - - - True - Passphrase: - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 0 - 1 - fill - - - - - - - True - True - True - True - 0 - - True - * - False - - - 1 - 2 - 0 - 1 - - - - - - - True - True - Use WPA Enterprise (WPA2) - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 1 - 2 - 2 - 3 - fill - - - - - - - True - Type: - False - False - GTK_JUSTIFY_LEFT - False - False - 1 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 1 - 2 - fill - - - - - - - True - - False - True - - - 1 - 2 - 1 - 2 - fill - fill - - - - - False - True - - - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - tab - - - - - - - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - tab - - - - - - diff --git a/gnome/applet/wireless-security-manager.c b/gnome/applet/wireless-security-manager.c index 13d31b3ca..1558110f8 100644 --- a/gnome/applet/wireless-security-manager.c +++ b/gnome/applet/wireless-security-manager.c @@ -33,8 +33,7 @@ #include "wso-wep-ascii.h" #include "wso-wep-hex.h" #include "wso-wep-passphrase.h" -#include "wso-wpa-psk-passphrase.h" -#include "wso-wpa-psk-hex.h" +#include "wso-wpa-psk.h" struct WirelessSecurityManager { @@ -92,11 +91,7 @@ void wsm_set_capabilities (WirelessSecurityManager *wsm, guint32 capabilities) if ( (capabilities & NM_802_11_CAP_PROTO_WPA) || (capabilities & NM_802_11_CAP_PROTO_WPA2)) { - opt = wso_wpa_psk_passphrase_new (wsm->glade_file, capabilities); - if (opt) - wsm->options = g_slist_append (wsm->options, opt); - - opt = wso_wpa_psk_hex_new (wsm->glade_file, capabilities); + opt = wso_wpa_psk_new (wsm->glade_file, capabilities); if (opt) wsm->options = g_slist_append (wsm->options, opt); } diff --git a/gnome/applet/wso-wpa-psk-hex.c b/gnome/applet/wso-wpa-psk-hex.c deleted file mode 100644 index 767c7bb6e..000000000 --- a/gnome/applet/wso-wpa-psk-hex.c +++ /dev/null @@ -1,193 +0,0 @@ -/* NetworkManager Wireless Applet -- Display wireless access points and allow user control - * - * Dan Williams - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * (C) Copyright 2005 Red Hat, Inc. - */ - -#include -#include -#include -#include -#include -#include - -#include "wireless-security-option.h" -#include "wso-wpa-psk-hex.h" -#include "wso-private.h" -#include "cipher.h" -#include "cipher-wpa-psk-hex.h" -#include "dbus-helpers.h" -#include "NetworkManager.h" - - -struct OptData -{ - const char * entry_name; - const char * wpa2_checkbox_name; - const char * key_type_combo_name; -}; - -static void data_free_func (WirelessSecurityOption *opt) -{ - g_return_if_fail (opt != NULL); - g_return_if_fail (opt->data != NULL); - - g_free (opt->data); -} - - -static GtkWidget * widget_create_func (WirelessSecurityOption *opt, GtkSignalFunc validate_cb, gpointer user_data) -{ - GtkWidget * entry; - GtkWidget * widget; - - g_return_val_if_fail (opt != NULL, NULL); - g_return_val_if_fail (opt->data != NULL, NULL); - g_return_val_if_fail (validate_cb != NULL, NULL); - - widget = wso_widget_helper (opt); - entry = glade_xml_get_widget (opt->uixml, opt->data->entry_name); - g_signal_connect (G_OBJECT (entry), "changed", validate_cb, user_data); - return widget; -} - - -static gboolean validate_input_func (WirelessSecurityOption *opt, const char *ssid, IEEE_802_11_Cipher ** out_cipher) -{ - GtkWidget * entry; - const char * input; - - g_return_val_if_fail (opt != NULL, FALSE); - - entry = glade_xml_get_widget (opt->uixml, opt->data->entry_name); - input = gtk_entry_get_text (GTK_ENTRY (entry)); - return wso_validate_helper (opt, ssid, input, out_cipher); -} - - -static gboolean append_dbus_params_func (WirelessSecurityOption *opt, const char *ssid, DBusMessage *message) -{ - IEEE_802_11_Cipher * cipher = NULL; - GtkWidget * auth_combo; - int auth_alg = -1; - GtkWidget * entry; - const char * input; - GtkWidget * wpa2_checkbox; - int wpa_version = IW_AUTH_WPA_VERSION_WPA; - - g_return_val_if_fail (opt != NULL, FALSE); - g_return_val_if_fail (opt->data != NULL, FALSE); - g_return_val_if_fail (opt->data->entry_name != NULL, FALSE); - - entry = glade_xml_get_widget (opt->uixml, opt->data->entry_name); - input = gtk_entry_get_text (GTK_ENTRY (entry)); - if (!wso_validate_helper (opt, ssid, input, &cipher) || !cipher) - return FALSE; - - wpa2_checkbox = glade_xml_get_widget (opt->uixml, opt->data->wpa2_checkbox_name); - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (wpa2_checkbox))) - wpa_version = IW_AUTH_WPA_VERSION_WPA2; - - nmu_security_serialize_wpa_psk_with_cipher (message, cipher, ssid, input, - wpa_version, IW_AUTH_KEY_MGMT_PSK); - - return TRUE; -} - - -static void -key_type_combo_changed_cb (GtkComboBox *combo, - gpointer user_data) -{ - WirelessSecurityOption * opt = (WirelessSecurityOption *) user_data; - IEEE_802_11_Cipher * cipher; - int we_cipher; - GtkTreeModel * model; - GtkTreeIter iter; - char * str; - - g_return_if_fail (opt != NULL); - - cipher = (IEEE_802_11_Cipher *) g_slist_nth_data (opt->ciphers, 0); - g_return_if_fail (cipher != NULL); - - model = gtk_combo_box_get_model (combo); - gtk_combo_box_get_active_iter (combo, &iter); - gtk_tree_model_get (model, &iter, WPA_KEY_TYPE_NAME_COL, &str, - WPA_KEY_TYPE_CIPHER_COL, &we_cipher, -1); - cipher_wpa_psk_hex_set_we_cipher (cipher, we_cipher); -} - - -WirelessSecurityOption * -wso_wpa_psk_hex_new (const char *glade_file, - int capabilities) -{ - WirelessSecurityOption * opt = NULL; - GladeXML * xml = NULL; - OptData * data = NULL; - GtkWidget * wpa2_checkbox; - GtkWidget * key_type_combo; - int num_added; - GtkTreeModel * model; - GtkTreeIter iter; - - g_return_val_if_fail (glade_file != NULL, NULL); - - opt = g_malloc0 (sizeof (WirelessSecurityOption)); - opt->name = g_strdup (_("WPA Preshared-Key Hex")); - opt->widget_name = "wpa_psk_hex_notebook"; - opt->data_free_func = data_free_func; - opt->validate_input_func = validate_input_func; - opt->widget_create_func = widget_create_func; - opt->append_dbus_params_func = append_dbus_params_func; - - if (!(opt->uixml = glade_xml_new (glade_file, opt->widget_name, NULL))) - { - wso_free (opt); - return NULL; - } - opt->ciphers = g_slist_append (opt->ciphers, cipher_wpa_psk_hex_new ()); - - /* Option-specific data */ - opt->data = data = g_malloc0 (sizeof (OptData)); - data->entry_name = "wpa_psk_hex_entry"; - data->wpa2_checkbox_name = "wpa2_checkbutton"; - data->key_type_combo_name = "wpa_psk_hex_type_combo"; - - wpa2_checkbox = glade_xml_get_widget (opt->uixml, data->wpa2_checkbox_name); - if (!(capabilities & NM_802_11_CAP_PROTO_WPA2)) - gtk_widget_set_sensitive (GTK_WIDGET (wpa2_checkbox), FALSE); - - key_type_combo = glade_xml_get_widget (opt->uixml, data->key_type_combo_name); - g_signal_connect (G_OBJECT (key_type_combo), "changed", (GCallback) key_type_combo_changed_cb, opt); - model = wso_wpa_create_key_type_model (capabilities, &num_added); - if (!model || !num_added) - { - wso_free (opt); - return NULL; - } - gtk_combo_box_set_model (GTK_COMBO_BOX (key_type_combo), model); - gtk_tree_model_get_iter_first (model, &iter); - gtk_combo_box_set_active_iter (GTK_COMBO_BOX (key_type_combo), &iter); - if (num_added == 1) - gtk_widget_set_sensitive (key_type_combo, FALSE); - - return opt; -} - diff --git a/gnome/applet/wso-wpa-psk-passphrase.h b/gnome/applet/wso-wpa-psk-passphrase.h deleted file mode 100644 index 6942bed2f..000000000 --- a/gnome/applet/wso-wpa-psk-passphrase.h +++ /dev/null @@ -1,28 +0,0 @@ -/* NetworkManager Wireless Applet -- Display wireless access points and allow user control - * - * Dan Williams - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * (C) Copyright 2005 Red Hat, Inc. - */ - -#ifndef WSO_WPA_PSK_PASSPHRASE_H -#define WSO_WPA_PSK_PASSPHRASE_H - -WirelessSecurityOption * wso_wpa_psk_passphrase_new (const char *glade_file, int capabilities); - - -#endif /* WSO_WPA_PSK_PASSPHRASE_H */ diff --git a/gnome/applet/wso-wpa-psk-passphrase.c b/gnome/applet/wso-wpa-psk.c similarity index 80% rename from gnome/applet/wso-wpa-psk-passphrase.c rename to gnome/applet/wso-wpa-psk.c index a8e23e319..ee1cb2f80 100644 --- a/gnome/applet/wso-wpa-psk-passphrase.c +++ b/gnome/applet/wso-wpa-psk.c @@ -27,9 +27,10 @@ #include #include "wireless-security-option.h" -#include "wso-wpa-psk-passphrase.h" +#include "wso-wpa-psk.h" #include "wso-private.h" #include "cipher.h" +#include "cipher-wpa-psk-hex.h" #include "cipher-wpa-psk-passphrase.h" #include "dbus-helpers.h" #include "NetworkManager.h" @@ -40,6 +41,8 @@ struct OptData const char * entry_name; const char * wpa2_checkbox_name; const char * key_type_combo_name; + IEEE_802_11_Cipher * hex_cipher; + IEEE_802_11_Cipher * passphrase_cipher; }; static void data_free_func (WirelessSecurityOption *opt) @@ -47,6 +50,9 @@ static void data_free_func (WirelessSecurityOption *opt) g_return_if_fail (opt != NULL); g_return_if_fail (opt->data != NULL); + ieee_802_11_cipher_ref (opt->data->passphrase_cipher); + ieee_802_11_cipher_ref (opt->data->hex_cipher); + memset (opt->data, 0, sizeof (opt->data)); g_free (opt->data); } @@ -67,7 +73,7 @@ static GtkWidget * widget_create_func (WirelessSecurityOption *opt, GtkSignalFun } -static gboolean validate_input_func (WirelessSecurityOption *opt, const char *ssid, IEEE_802_11_Cipher ** out_cipher) +static gboolean validate_input_func (WirelessSecurityOption *opt, const char *ssid, IEEE_802_11_Cipher **out_cipher) { GtkWidget * entry; const char * input; @@ -115,28 +121,34 @@ key_type_combo_changed_cb (GtkComboBox *combo, gpointer user_data) { WirelessSecurityOption * opt = (WirelessSecurityOption *) user_data; - IEEE_802_11_Cipher * cipher; int we_cipher; GtkTreeModel * model; GtkTreeIter iter; char * str; + GSList * elt; g_return_if_fail (opt != NULL); - cipher = (IEEE_802_11_Cipher *) g_slist_nth_data (opt->ciphers, 0); - g_return_if_fail (cipher != NULL); - model = gtk_combo_box_get_model (combo); gtk_combo_box_get_active_iter (combo, &iter); gtk_tree_model_get (model, &iter, WPA_KEY_TYPE_NAME_COL, &str, WPA_KEY_TYPE_CIPHER_COL, &we_cipher, -1); - cipher_wpa_psk_passphrase_set_we_cipher (cipher, we_cipher); + + for (elt = opt->ciphers; elt; elt = g_slist_next (elt)) + { + IEEE_802_11_Cipher * cipher = (IEEE_802_11_Cipher *)(elt->data); + + if (cipher == opt->data->passphrase_cipher) + cipher_wpa_psk_passphrase_set_we_cipher (cipher, we_cipher); + else if (cipher == opt->data->hex_cipher) + cipher_wpa_psk_hex_set_we_cipher (cipher, we_cipher); + } } WirelessSecurityOption * -wso_wpa_psk_passphrase_new (const char *glade_file, - int capabilities) +wso_wpa_psk_new (const char *glade_file, + int capabilities) { WirelessSecurityOption * opt = NULL; GladeXML * xml = NULL; @@ -150,8 +162,8 @@ wso_wpa_psk_passphrase_new (const char *glade_file, g_return_val_if_fail (glade_file != NULL, NULL); opt = g_malloc0 (sizeof (WirelessSecurityOption)); - opt->name = g_strdup (_("WPA Preshared-Key Passphrase")); - opt->widget_name = "wpa_psk_passphrase_notebook"; + opt->name = g_strdup (_("WPA/WPA2 Personal")); + opt->widget_name = "wpa_psk_notebook"; opt->data_free_func = data_free_func; opt->validate_input_func = validate_input_func; opt->widget_create_func = widget_create_func; @@ -162,13 +174,20 @@ wso_wpa_psk_passphrase_new (const char *glade_file, wso_free (opt); return NULL; } - opt->ciphers = g_slist_append (opt->ciphers, cipher_wpa_psk_passphrase_new ()); /* Option-specific data */ opt->data = data = g_malloc0 (sizeof (OptData)); - data->entry_name = "wpa_psk_passphrase_entry"; + data->entry_name = "wpa_psk_entry"; data->wpa2_checkbox_name = "wpa2_checkbutton"; - data->key_type_combo_name = "wpa_psk_passphrase_type_combo"; + data->key_type_combo_name = "wpa_psk_type_combo"; + + /* Set up our ciphers */ + data->passphrase_cipher = cipher_wpa_psk_passphrase_new (); + ieee_802_11_cipher_ref (data->passphrase_cipher); + opt->ciphers = g_slist_append (opt->ciphers, data->passphrase_cipher); + data->hex_cipher = cipher_wpa_psk_hex_new (); + ieee_802_11_cipher_ref (data->hex_cipher); + opt->ciphers = g_slist_append (opt->ciphers, data->hex_cipher); wpa2_checkbox = glade_xml_get_widget (opt->uixml, data->wpa2_checkbox_name); if (!(capabilities & NM_802_11_CAP_PROTO_WPA2)) diff --git a/gnome/applet/wso-wpa-psk-hex.h b/gnome/applet/wso-wpa-psk.h similarity index 86% rename from gnome/applet/wso-wpa-psk-hex.h rename to gnome/applet/wso-wpa-psk.h index 5c0ea4152..443319b03 100644 --- a/gnome/applet/wso-wpa-psk-hex.h +++ b/gnome/applet/wso-wpa-psk.h @@ -19,10 +19,10 @@ * (C) Copyright 2005 Red Hat, Inc. */ -#ifndef WSO_WPA_PSK_HEX_H -#define WSO_WPA_PSK_HEX_H +#ifndef WSO_WPA_PSK_H +#define WSO_WPA_PSK_H -WirelessSecurityOption * wso_wpa_psk_hex_new (const char *glade_file, int capabilities); +WirelessSecurityOption * wso_wpa_psk_new (const char *glade_file, int capabilities); #endif /* WSO_WPA_PSK_HEX_H */