|
Packit Service |
87a54e |
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
Packit |
5756e2 |
/*
|
|
Packit |
5756e2 |
* Copyright (C) 2013 Red Hat, Inc.
|
|
Packit |
5756e2 |
*/
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
/**
|
|
Packit |
5756e2 |
* SECTION:nmt-page-wifi
|
|
Packit |
5756e2 |
* @short_description: The editor page for Wi-Fi connections
|
|
Packit |
5756e2 |
*
|
|
Packit |
5756e2 |
* #NmtPageWifi is the editor page for Wi-Fi connections, which
|
|
Packit |
5756e2 |
* includes both #NMSettingWireless and #NMSettingWirelessSecurity
|
|
Packit |
5756e2 |
* properties.
|
|
Packit |
5756e2 |
*/
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
#include "nm-default.h"
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
#include <stdlib.h>
|
|
Packit Service |
d0b836 |
#include <linux/if_ether.h>
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
#include "nmt-page-wifi.h"
|
|
Packit |
5756e2 |
#include "nmt-mac-entry.h"
|
|
Packit |
5756e2 |
#include "nmt-mtu-entry.h"
|
|
Packit |
5756e2 |
#include "nmt-password-fields.h"
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
#include "nm-editor-bindings.h"
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
G_DEFINE_TYPE(NmtPageWifi, nmt_page_wifi, NMT_TYPE_EDITOR_PAGE_DEVICE)
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
#define NMT_PAGE_WIFI_GET_PRIVATE(o) \
|
|
Packit Service |
a1bd4f |
(G_TYPE_INSTANCE_GET_PRIVATE((o), NMT_TYPE_PAGE_WIFI, NmtPageWifiPrivate))
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
typedef struct {
|
|
Packit Service |
a1bd4f |
NMSettingWirelessSecurity *s_wsec;
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
} NmtPageWifiPrivate;
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
NmtEditorPage *
|
|
Packit Service |
a1bd4f |
nmt_page_wifi_new(NMConnection *conn, NmtDeviceEntry *deventry)
|
|
Packit |
5756e2 |
{
|
|
Packit Service |
a1bd4f |
return g_object_new(NMT_TYPE_PAGE_WIFI, "connection", conn, "device-entry", deventry, NULL);
|
|
Packit |
5756e2 |
}
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
static void
|
|
Packit Service |
a1bd4f |
nmt_page_wifi_init(NmtPageWifi *wifi)
|
|
Packit Service |
a1bd4f |
{}
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
static NmtNewtPopupEntry wifi_mode[] = {{NC_("Wi-Fi", "Client"), NM_SETTING_WIRELESS_MODE_INFRA},
|
|
Packit Service |
a1bd4f |
{N_("Access Point"), NM_SETTING_WIRELESS_MODE_AP},
|
|
Packit Service |
a1bd4f |
{N_("Ad-Hoc Network"), NM_SETTING_WIRELESS_MODE_ADHOC},
|
|
Packit Service |
a1bd4f |
{NULL, NULL}};
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
static NmtNewtPopupEntry wifi_band[] = {{NC_("Wi-Fi", "Automatic"), NULL},
|
|
Packit Service |
a1bd4f |
/* 802.11a Wi-Fi network */
|
|
Packit Service |
a1bd4f |
{N_("A (5 GHz)"), "a"},
|
|
Packit Service |
a1bd4f |
/* 802.11b / 802.11g Wi-Fi network */
|
|
Packit Service |
a1bd4f |
{N_("B/G (2.4 GHz)"), "bg"},
|
|
Packit Service |
a1bd4f |
{NULL, NULL}};
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
static NmtNewtPopupEntry wifi_security[] = {{NC_("Wi-Fi security", "None"), "none"},
|
|
Packit Service |
a1bd4f |
{N_("WPA & WPA2 Personal"), "wpa-personal"},
|
|
Packit Service |
a1bd4f |
{N_("WPA3 Personal"), "wpa3-personal"},
|
|
Packit Service |
a1bd4f |
{N_("WPA & WPA2 Enterprise"), "wpa-enterprise"},
|
|
Packit Service |
a1bd4f |
{N_("WEP 40/128-bit Key (Hex or ASCII)"), "wep-key"},
|
|
Packit Service |
a1bd4f |
{N_("WEP 128-bit Passphrase"), "wep-passphrase"},
|
|
Packit Service |
a1bd4f |
{N_("Dynamic WEP (802.1x)"), "dynamic-wep"},
|
|
Packit Service |
a1bd4f |
{N_("LEAP"), "leap"},
|
|
Packit Service |
a1bd4f |
{N_("Enhanced Open (OWE)"), "owe"},
|
|
Packit Service |
a1bd4f |
{NULL, NULL}};
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
static NmtNewtPopupEntry wep_index[] = {{NC_("WEP key index", "1 (Default)"), "1"},
|
|
Packit Service |
a1bd4f |
{NC_("WEP key index", "2"), "2"},
|
|
Packit Service |
a1bd4f |
{NC_("WEP key index", "3"), "3"},
|
|
Packit Service |
a1bd4f |
{NC_("WEP key index", "4"), "4"},
|
|
Packit Service |
a1bd4f |
{NULL, NULL}};
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
static NmtNewtPopupEntry wep_auth[] = {{N_("Open System"), "open"},
|
|
Packit Service |
a1bd4f |
{N_("Shared Key"), "shared"},
|
|
Packit Service |
a1bd4f |
{NULL, NULL}};
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
static gboolean
|
|
Packit Service |
a1bd4f |
mode_transform_to_band_visibility(GBinding * binding,
|
|
Packit Service |
a1bd4f |
const GValue *source_value,
|
|
Packit Service |
a1bd4f |
GValue * target_value,
|
|
Packit Service |
a1bd4f |
gpointer user_data)
|
|
Packit |
5756e2 |
{
|
|
Packit Service |
a1bd4f |
if (!g_strcmp0(g_value_get_string(source_value), NM_SETTING_WIRELESS_MODE_INFRA))
|
|
Packit Service |
a1bd4f |
g_value_set_boolean(target_value, FALSE);
|
|
Packit Service |
a1bd4f |
else
|
|
Packit Service |
a1bd4f |
g_value_set_boolean(target_value, TRUE);
|
|
Packit Service |
a1bd4f |
return TRUE;
|
|
Packit |
5756e2 |
}
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
static gboolean
|
|
Packit Service |
a1bd4f |
band_transform_to_channel_visibility(GBinding * binding,
|
|
Packit Service |
a1bd4f |
const GValue *source_value,
|
|
Packit Service |
a1bd4f |
GValue * target_value,
|
|
Packit Service |
a1bd4f |
gpointer user_data)
|
|
Packit |
5756e2 |
{
|
|
Packit Service |
a1bd4f |
g_value_set_boolean(target_value, g_value_get_string(source_value) != NULL);
|
|
Packit Service |
a1bd4f |
return TRUE;
|
|
Packit |
5756e2 |
}
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
static gboolean
|
|
Packit Service |
a1bd4f |
ssid_transform_to_entry(GBinding * binding,
|
|
Packit Service |
a1bd4f |
const GValue *source_value,
|
|
Packit Service |
a1bd4f |
GValue * target_value,
|
|
Packit Service |
a1bd4f |
gpointer user_data)
|
|
Packit |
5756e2 |
{
|
|
Packit Service |
a1bd4f |
GBytes *ssid;
|
|
Packit Service |
a1bd4f |
char * utf8;
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
ssid = g_value_get_boxed(source_value);
|
|
Packit Service |
a1bd4f |
if (ssid)
|
|
Packit Service |
a1bd4f |
utf8 = nm_utils_ssid_to_utf8(g_bytes_get_data(ssid, NULL), g_bytes_get_size(ssid));
|
|
Packit Service |
a1bd4f |
else
|
|
Packit Service |
a1bd4f |
utf8 = g_strdup("");
|
|
Packit Service |
a1bd4f |
g_value_take_string(target_value, utf8);
|
|
Packit Service |
a1bd4f |
return TRUE;
|
|
Packit |
5756e2 |
}
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
static gboolean
|
|
Packit Service |
a1bd4f |
ssid_transform_from_entry(GBinding * binding,
|
|
Packit Service |
a1bd4f |
const GValue *source_value,
|
|
Packit Service |
a1bd4f |
GValue * target_value,
|
|
Packit Service |
a1bd4f |
gpointer user_data)
|
|
Packit |
5756e2 |
{
|
|
Packit Service |
a1bd4f |
NMSettingWireless *s_wireless = user_data;
|
|
Packit Service |
a1bd4f |
const char * text;
|
|
Packit Service |
a1bd4f |
GBytes * old_ssid, *ssid;
|
|
Packit Service |
a1bd4f |
char * utf8;
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
text = g_value_get_string(source_value);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
old_ssid = nm_setting_wireless_get_ssid(s_wireless);
|
|
Packit Service |
a1bd4f |
if (old_ssid)
|
|
Packit Service |
a1bd4f |
utf8 = nm_utils_ssid_to_utf8(g_bytes_get_data(old_ssid, NULL), g_bytes_get_size(old_ssid));
|
|
Packit Service |
a1bd4f |
else
|
|
Packit Service |
a1bd4f |
utf8 = g_strdup("");
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
if (!g_strcmp0(text, utf8)) {
|
|
Packit Service |
a1bd4f |
g_free(utf8);
|
|
Packit Service |
a1bd4f |
return FALSE;
|
|
Packit Service |
a1bd4f |
}
|
|
Packit Service |
a1bd4f |
g_free(utf8);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
ssid = g_bytes_new(text, strlen(text));
|
|
Packit Service |
a1bd4f |
g_value_take_boxed(target_value, ssid);
|
|
Packit Service |
a1bd4f |
return TRUE;
|
|
Packit |
5756e2 |
}
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
static void
|
|
Packit Service |
a1bd4f |
nmt_page_wifi_constructed(GObject *object)
|
|
Packit |
5756e2 |
{
|
|
Packit Service |
a1bd4f |
NmtPageWifiPrivate * priv = NMT_PAGE_WIFI_GET_PRIVATE(object);
|
|
Packit Service |
a1bd4f |
NmtPageWifi * wifi = NMT_PAGE_WIFI(object);
|
|
Packit Service |
a1bd4f |
NmtDeviceEntry * deventry;
|
|
Packit Service |
a1bd4f |
NmtEditorSection * section;
|
|
Packit Service |
a1bd4f |
NmtEditorGrid * grid;
|
|
Packit Service |
a1bd4f |
NMSettingWireless * s_wireless;
|
|
Packit Service |
a1bd4f |
NMSettingWirelessSecurity *s_wsec;
|
|
Packit Service |
a1bd4f |
NmtNewtWidget * widget, *hbox, *subgrid;
|
|
Packit Service |
a1bd4f |
NmtNewtWidget * mode, *band, *security, *entry;
|
|
Packit Service |
a1bd4f |
NmtNewtStack * stack;
|
|
Packit Service |
a1bd4f |
NMConnection * conn;
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
conn = nmt_editor_page_get_connection(NMT_EDITOR_PAGE(wifi));
|
|
Packit Service |
a1bd4f |
s_wireless = nm_connection_get_setting_wireless(conn);
|
|
Packit Service |
a1bd4f |
if (!s_wireless) {
|
|
Packit Service |
a1bd4f |
nm_connection_add_setting(conn, nm_setting_wireless_new());
|
|
Packit Service |
a1bd4f |
s_wireless = nm_connection_get_setting_wireless(conn);
|
|
Packit Service |
a1bd4f |
}
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
s_wsec = nm_connection_get_setting_wireless_security(conn);
|
|
Packit Service |
a1bd4f |
if (!s_wsec) {
|
|
Packit Service |
a1bd4f |
/* It makes things simpler if we always have a
|
|
Packit Service |
a1bd4f |
* NMSettingWirelessSecurity; we'll hold a ref on one, and add
|
|
Packit Service |
a1bd4f |
* it to and remove it from the connection as needed.
|
|
Packit Service |
a1bd4f |
*/
|
|
Packit Service |
a1bd4f |
s_wsec = NM_SETTING_WIRELESS_SECURITY(nm_setting_wireless_security_new());
|
|
Packit Service |
a1bd4f |
}
|
|
Packit Service |
a1bd4f |
priv->s_wsec = g_object_ref_sink(s_wsec);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
deventry = nmt_editor_page_device_get_device_entry(NMT_EDITOR_PAGE_DEVICE(object));
|
|
Packit Service |
a1bd4f |
g_object_bind_property(s_wireless,
|
|
Packit Service |
a1bd4f |
NM_SETTING_WIRELESS_MAC_ADDRESS,
|
|
Packit Service |
a1bd4f |
deventry,
|
|
Packit Service |
a1bd4f |
"mac-address",
|
|
Packit Service |
a1bd4f |
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
section = nmt_editor_section_new(_("WI-FI"), NULL, TRUE);
|
|
Packit Service |
a1bd4f |
grid = nmt_editor_section_get_body(section);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
widget = nmt_newt_entry_new(40, NMT_NEWT_ENTRY_NONEMPTY);
|
|
Packit Service |
a1bd4f |
g_object_bind_property_full(s_wireless,
|
|
Packit Service |
a1bd4f |
NM_SETTING_WIRELESS_SSID,
|
|
Packit Service |
a1bd4f |
widget,
|
|
Packit Service |
a1bd4f |
"text",
|
|
Packit Service |
a1bd4f |
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE,
|
|
Packit Service |
a1bd4f |
ssid_transform_to_entry,
|
|
Packit Service |
a1bd4f |
ssid_transform_from_entry,
|
|
Packit Service |
a1bd4f |
s_wireless,
|
|
Packit Service |
a1bd4f |
NULL);
|
|
Packit Service |
a1bd4f |
nmt_editor_grid_append(grid, _("SSID"), widget, NULL);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
widget = nmt_newt_popup_new(wifi_mode);
|
|
Packit Service |
a1bd4f |
g_object_bind_property(s_wireless,
|
|
Packit Service |
a1bd4f |
NM_SETTING_WIRELESS_MODE,
|
|
Packit Service |
a1bd4f |
widget,
|
|
Packit Service |
a1bd4f |
"active-id",
|
|
Packit Service |
a1bd4f |
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
|
Packit Service |
a1bd4f |
nmt_editor_grid_append(grid, _("Mode"), widget, NULL);
|
|
Packit Service |
a1bd4f |
mode = widget;
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
hbox = nmt_newt_grid_new();
|
|
Packit Service |
a1bd4f |
widget = nmt_newt_popup_new(wifi_band);
|
|
Packit Service |
a1bd4f |
g_object_bind_property(s_wireless,
|
|
Packit Service |
a1bd4f |
NM_SETTING_WIRELESS_BAND,
|
|
Packit Service |
a1bd4f |
widget,
|
|
Packit Service |
a1bd4f |
"active-id",
|
|
Packit Service |
a1bd4f |
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
|
Packit Service |
a1bd4f |
nmt_newt_grid_add(NMT_NEWT_GRID(hbox), widget, 0, 0);
|
|
Packit Service |
a1bd4f |
band = widget;
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
widget = nmt_newt_entry_numeric_new(10, 0, 255);
|
|
Packit Service |
a1bd4f |
g_object_bind_property(s_wireless,
|
|
Packit Service |
a1bd4f |
NM_SETTING_WIRELESS_CHANNEL,
|
|
Packit Service |
a1bd4f |
widget,
|
|
Packit Service |
a1bd4f |
"text",
|
|
Packit Service |
a1bd4f |
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
|
Packit Service |
a1bd4f |
nmt_newt_grid_add(NMT_NEWT_GRID(hbox), widget, 1, 0);
|
|
Packit Service |
a1bd4f |
nmt_newt_widget_set_padding(widget, 1, 0, 0, 0);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
g_object_bind_property_full(band,
|
|
Packit Service |
a1bd4f |
"active-id",
|
|
Packit Service |
a1bd4f |
widget,
|
|
Packit Service |
a1bd4f |
"visible",
|
|
Packit Service |
a1bd4f |
G_BINDING_SYNC_CREATE,
|
|
Packit Service |
a1bd4f |
band_transform_to_channel_visibility,
|
|
Packit Service |
a1bd4f |
NULL,
|
|
Packit Service |
a1bd4f |
NULL,
|
|
Packit Service |
a1bd4f |
NULL);
|
|
Packit Service |
a1bd4f |
g_object_bind_property_full(mode,
|
|
Packit Service |
a1bd4f |
"active-id",
|
|
Packit Service |
a1bd4f |
hbox,
|
|
Packit Service |
a1bd4f |
"visible",
|
|
Packit Service |
a1bd4f |
G_BINDING_SYNC_CREATE,
|
|
Packit Service |
a1bd4f |
mode_transform_to_band_visibility,
|
|
Packit Service |
a1bd4f |
NULL,
|
|
Packit Service |
a1bd4f |
NULL,
|
|
Packit Service |
a1bd4f |
NULL);
|
|
Packit Service |
a1bd4f |
nmt_editor_grid_append(grid, _("Channel"), hbox, NULL);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
nmt_editor_grid_append(grid, NULL, nmt_newt_separator_new(), NULL);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
widget = nmt_newt_popup_new(wifi_security);
|
|
Packit Service |
a1bd4f |
nmt_editor_grid_append(grid, _("Security"), widget, NULL);
|
|
Packit Service |
a1bd4f |
security = widget;
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
widget = nmt_newt_stack_new();
|
|
Packit Service |
a1bd4f |
stack = NMT_NEWT_STACK(widget);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
/* none */
|
|
Packit Service |
a1bd4f |
subgrid = nmt_editor_grid_new();
|
|
Packit Service |
a1bd4f |
nmt_newt_stack_add(stack, "none", subgrid);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
/* wpa-personal */
|
|
Packit Service |
a1bd4f |
subgrid = nmt_editor_grid_new();
|
|
Packit Service |
a1bd4f |
widget = nmt_password_fields_new(40, NMT_PASSWORD_FIELDS_SHOW_PASSWORD);
|
|
Packit Service |
a1bd4f |
g_object_bind_property(s_wsec,
|
|
Packit Service |
a1bd4f |
NM_SETTING_WIRELESS_SECURITY_PSK,
|
|
Packit Service |
a1bd4f |
widget,
|
|
Packit Service |
a1bd4f |
"password",
|
|
Packit Service |
a1bd4f |
G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
|
|
Packit Service |
a1bd4f |
nmt_editor_grid_append(NMT_EDITOR_GRID(subgrid), _("Password"), widget, NULL);
|
|
Packit Service |
a1bd4f |
nmt_newt_stack_add(stack, "wpa-personal", subgrid);
|
|
Packit Service |
a1bd4f |
nmt_newt_stack_add(stack, "wpa3-personal", subgrid);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
/* "wpa-enterprise" */
|
|
Packit Service |
a1bd4f |
// FIXME
|
|
Packit Service |
a1bd4f |
widget = nmt_newt_label_new(_("(No support for wpa-enterprise yet...)"));
|
|
Packit Service |
a1bd4f |
nmt_newt_stack_add(stack, "wpa-enterprise", widget);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
/* wep-key */
|
|
Packit Service |
a1bd4f |
subgrid = nmt_editor_grid_new();
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
widget = entry = nmt_password_fields_new(40, NMT_PASSWORD_FIELDS_SHOW_PASSWORD);
|
|
Packit Service |
a1bd4f |
nmt_editor_grid_append(NMT_EDITOR_GRID(subgrid), _("Key"), widget, NULL);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
widget = nmt_newt_popup_new(wep_index);
|
|
Packit Service |
a1bd4f |
nmt_editor_grid_append(NMT_EDITOR_GRID(subgrid), _("WEP index"), widget, NULL);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
nm_editor_bind_wireless_security_wep_key(s_wsec,
|
|
Packit Service |
a1bd4f |
entry,
|
|
Packit Service |
a1bd4f |
"password",
|
|
Packit Service |
a1bd4f |
widget,
|
|
Packit Service |
a1bd4f |
"active",
|
|
Packit Service |
a1bd4f |
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
widget = nmt_newt_popup_new(wep_auth);
|
|
Packit Service |
a1bd4f |
nmt_editor_grid_append(NMT_EDITOR_GRID(subgrid), _("Authentication"), widget, NULL);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
nmt_newt_stack_add(stack, "wep-key", subgrid);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
/* wep-passphrase */
|
|
Packit Service |
a1bd4f |
subgrid = nmt_editor_grid_new();
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
widget = entry = nmt_password_fields_new(40, NMT_PASSWORD_FIELDS_SHOW_PASSWORD);
|
|
Packit Service |
a1bd4f |
nmt_editor_grid_append(NMT_EDITOR_GRID(subgrid), _("Password"), widget, NULL);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
widget = nmt_newt_popup_new(wep_index);
|
|
Packit Service |
a1bd4f |
nmt_editor_grid_append(NMT_EDITOR_GRID(subgrid), _("WEP index"), widget, NULL);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
nm_editor_bind_wireless_security_wep_key(s_wsec,
|
|
Packit Service |
a1bd4f |
entry,
|
|
Packit Service |
a1bd4f |
"password",
|
|
Packit Service |
a1bd4f |
widget,
|
|
Packit Service |
a1bd4f |
"active",
|
|
Packit Service |
a1bd4f |
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
widget = nmt_newt_popup_new(wep_auth);
|
|
Packit Service |
a1bd4f |
nmt_editor_grid_append(NMT_EDITOR_GRID(subgrid), _("Authentication"), widget, NULL);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
nmt_newt_stack_add(stack, "wep-passphrase", subgrid);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
/* "dynamic-wep" */
|
|
Packit Service |
a1bd4f |
// FIXME
|
|
Packit Service |
a1bd4f |
widget = nmt_newt_label_new(_("(No support for dynamic-wep yet...)"));
|
|
Packit Service |
a1bd4f |
nmt_newt_stack_add(stack, "dynamic-wep", widget);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
/* leap */
|
|
Packit Service |
a1bd4f |
subgrid = nmt_editor_grid_new();
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
widget = nmt_newt_entry_new(40, NMT_NEWT_ENTRY_NONEMPTY);
|
|
Packit Service |
a1bd4f |
nmt_editor_grid_append(NMT_EDITOR_GRID(subgrid), _("Username"), widget, NULL);
|
|
Packit Service |
a1bd4f |
g_object_bind_property(s_wsec,
|
|
Packit Service |
a1bd4f |
NM_SETTING_WIRELESS_SECURITY_LEAP_USERNAME,
|
|
Packit Service |
a1bd4f |
widget,
|
|
Packit Service |
a1bd4f |
"text",
|
|
Packit Service |
a1bd4f |
G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
widget = nmt_password_fields_new(40, NMT_PASSWORD_FIELDS_SHOW_PASSWORD);
|
|
Packit Service |
a1bd4f |
g_object_bind_property(s_wsec,
|
|
Packit Service |
a1bd4f |
NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD,
|
|
Packit Service |
a1bd4f |
widget,
|
|
Packit Service |
a1bd4f |
"password",
|
|
Packit Service |
a1bd4f |
G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
|
|
Packit Service |
a1bd4f |
nmt_editor_grid_append(NMT_EDITOR_GRID(subgrid), _("Password"), widget, NULL);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
nmt_newt_stack_add(stack, "leap", subgrid);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
nmt_editor_grid_append(grid, NULL, NMT_NEWT_WIDGET(stack), NULL);
|
|
Packit Service |
a1bd4f |
g_object_bind_property(security, "active-id", stack, "active-id", G_BINDING_SYNC_CREATE);
|
|
Packit Service |
a1bd4f |
nm_editor_bind_wireless_security_method(conn,
|
|
Packit Service |
a1bd4f |
s_wsec,
|
|
Packit Service |
a1bd4f |
security,
|
|
Packit Service |
a1bd4f |
"active-id",
|
|
Packit Service |
a1bd4f |
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
nmt_editor_grid_append(grid, NULL, nmt_newt_separator_new(), NULL);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
widget = nmt_mac_entry_new(40, ETH_ALEN, NMT_MAC_ENTRY_TYPE_MAC);
|
|
Packit Service |
a1bd4f |
g_object_bind_property(s_wireless,
|
|
Packit Service |
a1bd4f |
NM_SETTING_WIRELESS_BSSID,
|
|
Packit Service |
a1bd4f |
widget,
|
|
Packit Service |
a1bd4f |
"mac-address",
|
|
Packit Service |
a1bd4f |
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
|
Packit Service |
a1bd4f |
nmt_editor_grid_append(grid, _("BSSID"), widget, NULL);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
widget = nmt_mac_entry_new(40, ETH_ALEN, NMT_MAC_ENTRY_TYPE_CLONED);
|
|
Packit Service |
a1bd4f |
g_object_bind_property(s_wireless,
|
|
Packit Service |
a1bd4f |
NM_SETTING_WIRELESS_CLONED_MAC_ADDRESS,
|
|
Packit Service |
a1bd4f |
widget,
|
|
Packit Service |
a1bd4f |
"mac-address",
|
|
Packit Service |
a1bd4f |
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
|
Packit Service |
a1bd4f |
nmt_editor_grid_append(grid, _("Cloned MAC address"), widget, NULL);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
widget = nmt_mtu_entry_new();
|
|
Packit Service |
a1bd4f |
g_object_bind_property(s_wireless,
|
|
Packit Service |
a1bd4f |
NM_SETTING_WIRELESS_MTU,
|
|
Packit Service |
a1bd4f |
widget,
|
|
Packit Service |
a1bd4f |
"mtu",
|
|
Packit Service |
a1bd4f |
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
|
|
Packit Service |
a1bd4f |
nmt_editor_grid_append(grid, _("MTU"), widget, NULL);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
nmt_editor_page_add_section(NMT_EDITOR_PAGE(wifi), section);
|
|
Packit Service |
a1bd4f |
|
|
Packit Service |
a1bd4f |
G_OBJECT_CLASS(nmt_page_wifi_parent_class)->constructed(object);
|
|
Packit |
5756e2 |
}
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
static void
|
|
Packit Service |
a1bd4f |
nmt_page_wifi_finalize(GObject *object)
|
|
Packit |
5756e2 |
{
|
|
Packit Service |
a1bd4f |
NmtPageWifiPrivate *priv = NMT_PAGE_WIFI_GET_PRIVATE(object);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
g_clear_object(&priv->s_wsec);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
G_OBJECT_CLASS(nmt_page_wifi_parent_class)->finalize(object);
|
|
Packit |
5756e2 |
}
|
|
Packit |
5756e2 |
|
|
Packit |
5756e2 |
static void
|
|
Packit Service |
a1bd4f |
nmt_page_wifi_class_init(NmtPageWifiClass *wifi_class)
|
|
Packit |
5756e2 |
{
|
|
Packit Service |
a1bd4f |
GObjectClass *object_class = G_OBJECT_CLASS(wifi_class);
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
g_type_class_add_private(wifi_class, sizeof(NmtPageWifiPrivate));
|
|
Packit |
5756e2 |
|
|
Packit Service |
a1bd4f |
object_class->constructed = nmt_page_wifi_constructed;
|
|
Packit Service |
a1bd4f |
object_class->finalize = nmt_page_wifi_finalize;
|
|
Packit |
5756e2 |
}
|