2006-01-16 Dan Williams <dcbw@redhat.com>

* 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


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1339 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Dan Williams
2006-01-16 18:34:13 +00:00
parent dc74d1bd2d
commit a6d596b796
8 changed files with 96 additions and 493 deletions

View File

@@ -1,3 +1,26 @@
2006-01-16 Dan Williams <dcbw@redhat.com>
* 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 <dcbw@redhat.com>
* gnome/applet/other-network-dialog.c

View File

@@ -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 \

View File

@@ -304,11 +304,10 @@ You have chosen to log in to the wireless network '%s'. If you are sure that th
<widget class="GtkDialog" id="other_network_dialog">
<property name="border_width">6</property>
<property name="visible">True</property>
<property name="title" translatable="yes">Other Wireless Network...</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="window_position">GTK_WIN_POS_CENTER_ALWAYS</property>
<property name="modal">True</property>
<property name="default_width">488</property>
<property name="resizable">False</property>
<property name="destroy_with_parent">False</property>
@@ -625,7 +624,7 @@ WEP 40/128-bit ASCII
<property name="title" translatable="yes">Wireless Network Key Required</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_CENTER_ALWAYS</property>
<property name="modal">False</property>
<property name="modal">True</property>
<property name="resizable">False</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
@@ -1988,9 +1987,9 @@ Shared Key</property>
</child>
</widget>
<widget class="GtkWindow" id="wpa_psk_hex_subwindow">
<widget class="GtkWindow" id="wpa_psk_subwindow">
<property name="visible">True</property>
<property name="title" translatable="yes">wpa_psk_hex_subwindow</property>
<property name="title" translatable="yes">wpa_psk_subwindow</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
@@ -2005,7 +2004,7 @@ Shared Key</property>
<property name="urgency_hint">False</property>
<child>
<widget class="GtkNotebook" id="wpa_psk_hex_notebook">
<widget class="GtkNotebook" id="wpa_psk_notebook">
<property name="visible">True</property>
<property name="show_tabs">False</property>
<property name="show_border">False</property>
@@ -2024,9 +2023,9 @@ Shared Key</property>
<property name="column_spacing">4</property>
<child>
<widget class="GtkLabel" id="wpa_psk_hex_label">
<widget class="GtkLabel" id="wpa_psk_label">
<property name="visible">True</property>
<property name="label" translatable="yes">Key:</property>
<property name="label" translatable="yes">Password:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -2052,7 +2051,7 @@ Shared Key</property>
</child>
<child>
<widget class="GtkEntry" id="wpa_psk_hex_entry">
<widget class="GtkEntry" id="wpa_psk_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
@@ -2073,29 +2072,7 @@ Shared Key</property>
</child>
<child>
<widget class="GtkCheckButton" id="wpa2_checkbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Use WPA Enterprise (WPA2)</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="wpa_psk_hex_type_label">
<widget class="GtkLabel" id="wpa_psk_type_label">
<property name="visible">True</property>
<property name="label" translatable="yes">Type:</property>
<property name="use_underline">False</property>
@@ -2123,7 +2100,7 @@ Shared Key</property>
</child>
<child>
<widget class="GtkComboBox" id="wpa_psk_hex_type_combo">
<widget class="GtkComboBox" id="wpa_psk_type_combo">
<property name="visible">True</property>
<property name="items" translatable="yes"></property>
<property name="add_tearoffs">False</property>
@@ -2138,6 +2115,28 @@ Shared Key</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="wpa2_checkbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Connect using WPA2</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
</widget>
<packing>
<property name="tab_expand">False</property>
@@ -2387,214 +2386,4 @@ Shared Key</property>
</child>
</widget>
<widget class="GtkWindow" id="wpa_psk_passphrase_subwindow">
<property name="visible">True</property>
<property name="title" translatable="yes">wpa_psk_passphrase_subwindow</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<child>
<widget class="GtkNotebook" id="wpa_psk_passphrase_notebook">
<property name="visible">True</property>
<property name="show_tabs">False</property>
<property name="show_border">False</property>
<property name="tab_pos">GTK_POS_TOP</property>
<property name="scrollable">False</property>
<property name="enable_popup">False</property>
<child>
<widget class="GtkTable" id="table10">
<property name="border_width">8</property>
<property name="visible">True</property>
<property name="n_rows">3</property>
<property name="n_columns">2</property>
<property name="homogeneous">False</property>
<property name="row_spacing">4</property>
<property name="column_spacing">4</property>
<child>
<widget class="GtkLabel" id="wpa_psk_passphrase_label">
<property name="visible">True</property>
<property name="label" translatable="yes">Passphrase:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="wpa_psk_passphrase_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes"></property>
<property name="has_frame">True</property>
<property name="invisible_char">*</property>
<property name="activates_default">False</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="wpa2_checkbutton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Use WPA Enterprise (WPA2)</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="wpa_psk_passphrase_type_label">
<property name="visible">True</property>
<property name="label" translatable="yes">Type:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">1</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="wpa_psk_passphrase_type_combo">
<property name="visible">True</property>
<property name="items" translatable="yes"></property>
<property name="add_tearoffs">False</property>
<property name="focus_on_click">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
</widget>
<packing>
<property name="tab_expand">False</property>
<property name="tab_fill">True</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label32">
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="type">tab</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<widget class="GtkLabel" id="label33">
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="type">tab</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>

View File

@@ -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);
}

View File

@@ -1,193 +0,0 @@
/* NetworkManager Wireless Applet -- Display wireless access points and allow user control
*
* Dan Williams <dcbw@redhat.com>
*
* 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 <glib.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <glade/glade.h>
#include <dbus/dbus.h>
#include <iwlib.h>
#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;
}

View File

@@ -1,28 +0,0 @@
/* NetworkManager Wireless Applet -- Display wireless access points and allow user control
*
* Dan Williams <dcbw@redhat.com>
*
* 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 */

View File

@@ -27,9 +27,10 @@
#include <iwlib.h>
#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);
}
@@ -115,27 +121,33 @@ 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);
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,
wso_wpa_psk_new (const char *glade_file,
int capabilities)
{
WirelessSecurityOption * opt = 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))

View File

@@ -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 */