mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-04 21:08:04 +02:00
2006-01-08 Dan Williams <dcbw@redhat.com>
* gnome/applet/Makefile.am gnome/applet/wso-wpa-psk-hex.c gnome/applet/wso-wpa-psk-hex.h - New files, implement WPA-PSK Hex key input * gnome/applet/wireless-applet.glade - Change existing wpa-psk stuff to wpa-psk-hex - Add new widgets for wpa-psk-passphrase * gnome/applet/wireless-security-manager.c - (wsm_set_capabilities): enable WPA options * gnome/applet/wso-wpa-psk-passphrase.c - (wso_wpa_psk_passphrase_new): use correct glade widgets for WPA-PSK passphrase git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1291 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
parent
e07888aa03
commit
65b6ba0b88
7 changed files with 328 additions and 10 deletions
18
ChangeLog
18
ChangeLog
|
|
@ -1,3 +1,21 @@
|
|||
2006-01-08 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
* gnome/applet/Makefile.am
|
||||
gnome/applet/wso-wpa-psk-hex.c
|
||||
gnome/applet/wso-wpa-psk-hex.h
|
||||
- New files, implement WPA-PSK Hex key input
|
||||
|
||||
* gnome/applet/wireless-applet.glade
|
||||
- Change existing wpa-psk stuff to wpa-psk-hex
|
||||
- Add new widgets for wpa-psk-passphrase
|
||||
|
||||
* gnome/applet/wireless-security-manager.c
|
||||
- (wsm_set_capabilities): enable WPA options
|
||||
|
||||
* gnome/applet/wso-wpa-psk-passphrase.c
|
||||
- (wso_wpa_psk_passphrase_new): use correct glade widgets
|
||||
for WPA-PSK passphrase
|
||||
|
||||
2006-01-08 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
* include/NetworkManager.h
|
||||
|
|
|
|||
|
|
@ -73,6 +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 \
|
||||
nm-gconf-wso.c \
|
||||
|
|
|
|||
|
|
@ -1988,9 +1988,9 @@ Shared Key</property>
|
|||
</child>
|
||||
</widget>
|
||||
|
||||
<widget class="GtkWindow" id="wpa_psk_subwindow">
|
||||
<widget class="GtkWindow" id="wpa_psk_hex_subwindow">
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes">wpa_psk_subwindow</property>
|
||||
<property name="title" translatable="yes">wpa_psk_hex_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 +2005,7 @@ Shared Key</property>
|
|||
<property name="urgency_hint">False</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkNotebook" id="wpa_psk_notebook">
|
||||
<widget class="GtkNotebook" id="wpa_psk_hex_notebook">
|
||||
<property name="visible">True</property>
|
||||
<property name="show_tabs">False</property>
|
||||
<property name="show_border">False</property>
|
||||
|
|
@ -2021,7 +2021,7 @@ Shared Key</property>
|
|||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="wpa_psk_label">
|
||||
<widget class="GtkLabel" id="wpa_psk_hex_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Key:</property>
|
||||
<property name="use_underline">False</property>
|
||||
|
|
@ -2046,7 +2046,7 @@ Shared Key</property>
|
|||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkEntry" id="wpa_psk_entry">
|
||||
<widget class="GtkEntry" id="wpa_psk_hex_entry">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="editable">True</property>
|
||||
|
|
@ -2312,4 +2312,139 @@ 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="GtkHBox" id="hbox8">
|
||||
<property name="border_width">8</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</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="padding">6</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</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="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</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>
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
#include "wso-wep-hex.h"
|
||||
#include "wso-wep-passphrase.h"
|
||||
#include "wso-wpa-psk-passphrase.h"
|
||||
#include "wso-wpa-psk-hex.h"
|
||||
|
||||
struct WirelessSecurityManager
|
||||
{
|
||||
|
|
@ -88,14 +89,16 @@ void wsm_set_capabilities (WirelessSecurityManager *wsm, guint32 capabilities)
|
|||
wsm->options = g_slist_append (wsm->options, opt);
|
||||
}
|
||||
|
||||
#if 0 /* NOT YET */
|
||||
if (capabilities & NM_802_11_CAP_PROTO_WPA)
|
||||
{
|
||||
opt = wso_wpa_psk_passphrase_new (glade_file);
|
||||
opt = wso_wpa_psk_passphrase_new (wsm->glade_file);
|
||||
g_assert (opt);
|
||||
wsm->options = g_slist_append (wsm->options, opt);
|
||||
|
||||
opt = wso_wpa_psk_hex_new (wsm->glade_file);
|
||||
g_assert (opt);
|
||||
wsm->options = g_slist_append (wsm->options, opt);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#define NAME_COLUMN 0
|
||||
|
|
|
|||
132
gnome/applet/wso-wpa-psk-hex.c
Normal file
132
gnome/applet/wso-wpa-psk-hex.c
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
/* 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"
|
||||
|
||||
|
||||
struct OptData
|
||||
{
|
||||
const char * entry_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;
|
||||
|
||||
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;
|
||||
|
||||
nmu_security_serialize_wpa_psk_with_cipher (message, cipher, ssid, input,
|
||||
IW_AUTH_WPA_VERSION_WPA, IW_AUTH_KEY_MGMT_PSK);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
WirelessSecurityOption * wso_wpa_psk_hex_new (const char *glade_file)
|
||||
{
|
||||
WirelessSecurityOption * opt = NULL;
|
||||
GladeXML * xml = NULL;
|
||||
OptData * data = NULL;
|
||||
|
||||
g_return_val_if_fail (glade_file != NULL, NULL);
|
||||
|
||||
opt = g_malloc0 (sizeof (WirelessSecurityOption));
|
||||
opt->name = g_strdup (_("WPA Personal 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;
|
||||
|
||||
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";
|
||||
|
||||
return opt;
|
||||
}
|
||||
|
||||
28
gnome/applet/wso-wpa-psk-hex.h
Normal file
28
gnome/applet/wso-wpa-psk-hex.h
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
/* 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_HEX_H
|
||||
#define WSO_WPA_PSK_HEX_H
|
||||
|
||||
WirelessSecurityOption * wso_wpa_psk_hex_new (const char *glade_file);
|
||||
|
||||
|
||||
#endif /* WSO_WPA_PSK_HEX_H */
|
||||
|
|
@ -111,7 +111,7 @@ WirelessSecurityOption * wso_wpa_psk_passphrase_new (const char *glade_file)
|
|||
|
||||
opt = g_malloc0 (sizeof (WirelessSecurityOption));
|
||||
opt->name = g_strdup (_("WPA Personal Passphrase"));
|
||||
opt->widget_name = "wpa_psk_notebook";
|
||||
opt->widget_name = "wpa_psk_passphrase_notebook";
|
||||
opt->data_free_func = data_free_func;
|
||||
opt->validate_input_func = validate_input_func;
|
||||
opt->widget_create_func = widget_create_func;
|
||||
|
|
@ -125,7 +125,7 @@ WirelessSecurityOption * wso_wpa_psk_passphrase_new (const char *glade_file)
|
|||
|
||||
/* Option-specific data */
|
||||
opt->data = data = g_malloc0 (sizeof (OptData));
|
||||
data->entry_name = "wpa_psk_entry";
|
||||
data->entry_name = "wpa_psk_passphrase_entry";
|
||||
|
||||
return opt;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue