[gnome-control-center] network: Use self variable name consistently
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] network: Use self variable name consistently
- Date: Tue, 22 Oct 2019 20:17:52 +0000 (UTC)
commit 708b1fdaf73e69017c5d6c83a38afbf788730787
Author: Robert Ancell <robert ancell canonical com>
Date: Fri Oct 18 11:47:17 2019 +1300
network: Use self variable name consistently
panels/network/cc-network-panel.c | 220 +++++-----
panels/network/cc-wifi-connection-list.c | 24 +-
panels/network/cc-wifi-connection-row.c | 108 ++---
.../connection-editor/ce-page-8021x-security.c | 74 ++--
panels/network/connection-editor/ce-page-details.c | 192 ++++-----
.../network/connection-editor/ce-page-ethernet.c | 86 ++--
panels/network/connection-editor/ce-page-ip4.c | 292 +++++++-------
panels/network/connection-editor/ce-page-ip6.c | 310 +++++++-------
.../network/connection-editor/ce-page-security.c | 99 ++---
panels/network/connection-editor/ce-page-vpn.c | 66 +--
panels/network/connection-editor/ce-page-wifi.c | 78 ++--
panels/network/connection-editor/ce-page.c | 52 +--
.../connection-editor/net-connection-editor.c | 350 ++++++++--------
panels/network/net-device-ethernet.c | 198 ++++-----
panels/network/net-device-mobile.c | 310 +++++++-------
panels/network/net-device-simple.c | 72 ++--
panels/network/net-device-wifi.c | 444 ++++++++++-----------
panels/network/net-device.c | 60 ++-
panels/network/net-object.c | 112 +++---
panels/network/net-proxy.c | 174 ++++----
panels/network/net-vpn.c | 170 ++++----
panels/network/wireless-security/eap-method-fast.c | 122 +++---
panels/network/wireless-security/eap-method-leap.c | 114 +++---
panels/network/wireless-security/eap-method-peap.c | 124 +++---
.../network/wireless-security/eap-method-simple.c | 152 +++----
panels/network/wireless-security/eap-method-tls.c | 92 ++---
panels/network/wireless-security/eap-method-ttls.c | 128 +++---
panels/network/wireless-security/eap-method.c | 120 +++---
.../network/wireless-security/wireless-security.c | 160 ++++----
panels/network/wireless-security/ws-dynamic-wep.c | 24 +-
panels/network/wireless-security/ws-leap.c | 58 +--
panels/network/wireless-security/ws-wep-key.c | 124 +++---
panels/network/wireless-security/ws-wpa-eap.c | 24 +-
panels/network/wireless-security/ws-wpa-psk.c | 48 +--
34 files changed, 2389 insertions(+), 2392 deletions(-)
---
diff --git a/panels/network/cc-network-panel.c b/panels/network/cc-network-panel.c
index 2f411e343..fca6b658a 100644
--- a/panels/network/cc-network-panel.c
+++ b/panels/network/cc-network-panel.c
@@ -89,8 +89,8 @@ enum {
PROP_PARAMETERS
};
-static NetObject *find_net_object_by_id (CcNetworkPanel *panel, const gchar *id);
-static void handle_argv (CcNetworkPanel *panel);
+static NetObject *find_net_object_by_id (CcNetworkPanel *self, const gchar *id);
+static void handle_argv (CcNetworkPanel *self);
CC_PANEL_REGISTER (CcNetworkPanel, cc_network_panel)
@@ -223,42 +223,42 @@ cc_network_panel_dispose (GObject *object)
static void
cc_network_panel_finalize (GObject *object)
{
- CcNetworkPanel *panel = CC_NETWORK_PANEL (object);
+ CcNetworkPanel *self = CC_NETWORK_PANEL (object);
- reset_command_line_args (panel);
+ reset_command_line_args (self);
G_OBJECT_CLASS (cc_network_panel_parent_class)->finalize (object);
}
static const char *
-cc_network_panel_get_help_uri (CcPanel *panel)
+cc_network_panel_get_help_uri (CcPanel *self)
{
return "help:gnome-help/net";
}
static void
-object_removed_cb (CcNetworkPanel *panel, NetObject *object)
+object_removed_cb (CcNetworkPanel *self, NetObject *object)
{
GtkWidget *stack;
/* remove device */
- stack = g_hash_table_lookup (panel->device_to_stack, object);
+ stack = g_hash_table_lookup (self->device_to_stack, object);
if (stack != NULL)
gtk_widget_destroy (stack);
}
GPtrArray *
-cc_network_panel_get_devices (CcNetworkPanel *panel)
+cc_network_panel_get_devices (CcNetworkPanel *self)
{
GPtrArray *devices;
guint i;
- g_return_val_if_fail (CC_IS_NETWORK_PANEL (panel), NULL);
+ g_return_val_if_fail (CC_IS_NETWORK_PANEL (self), NULL);
devices = g_ptr_array_new_with_free_func (g_object_unref);
- for (i = 0; i < panel->devices->len; i++) {
- NetObject *object = g_ptr_array_index (panel->devices, i);
+ for (i = 0; i < self->devices->len; i++) {
+ NetObject *object = g_ptr_array_index (self->devices, i);
if (!NET_IS_DEVICE (object))
continue;
@@ -270,7 +270,7 @@ cc_network_panel_get_devices (CcNetworkPanel *panel)
}
static void
-panel_refresh_device_titles (CcNetworkPanel *panel)
+panel_refresh_device_titles (CcNetworkPanel *self)
{
GPtrArray *ndarray, *nmdarray;
NetDevice **devices;
@@ -278,7 +278,7 @@ panel_refresh_device_titles (CcNetworkPanel *panel)
g_auto(GStrv) titles = NULL;
gint i, num_devices;
- ndarray = cc_network_panel_get_devices (panel);
+ ndarray = cc_network_panel_get_devices (self);
if (!ndarray->len) {
g_ptr_array_free (ndarray, TRUE);
return;
@@ -339,16 +339,16 @@ handle_argv_for_device (CcNetworkPanel *self,
}
static gboolean
-handle_argv_for_connection (CcNetworkPanel *panel,
+handle_argv_for_connection (CcNetworkPanel *self,
NMConnection *connection)
{
- if (panel->arg_operation == OPERATION_NULL)
+ if (self->arg_operation == OPERATION_NULL)
return TRUE;
- if (panel->arg_operation != OPERATION_SHOW_DEVICE)
+ if (self->arg_operation != OPERATION_SHOW_DEVICE)
return FALSE;
- if (g_strcmp0 (nm_connection_get_path (connection), panel->arg_device) == 0) {
- reset_command_line_args (panel);
+ if (g_strcmp0 (nm_connection_get_path (connection), self->arg_device) == 0) {
+ reset_command_line_args (self);
return TRUE;
}
@@ -357,30 +357,30 @@ handle_argv_for_connection (CcNetworkPanel *panel,
static void
-handle_argv (CcNetworkPanel *panel)
+handle_argv (CcNetworkPanel *self)
{
gint i;
- if (panel->arg_operation == OPERATION_NULL)
+ if (self->arg_operation == OPERATION_NULL)
return;
- for (i = 0; i < panel->devices->len; i++) {
+ for (i = 0; i < self->devices->len; i++) {
GObject *object_tmp;
gboolean done = FALSE;
- object_tmp = g_ptr_array_index (panel->devices, i);
+ object_tmp = g_ptr_array_index (self->devices, i);
if (NET_IS_DEVICE (object_tmp)) {
NMDevice *device = NULL; /* Autoptr macro not available:
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/270 */
g_object_get (object_tmp, "nm-device", &device, NULL);
- done = handle_argv_for_device (panel, device);
+ done = handle_argv_for_device (self, device);
g_object_unref (device);
} else if (NET_IS_VPN (object_tmp)) {
g_autoptr(NMConnection) connection = NULL;
g_object_get (object_tmp, "connection", &connection, NULL);
- done = handle_argv_for_connection (panel, connection);
+ done = handle_argv_for_connection (self, connection);
}
if (done)
@@ -446,7 +446,7 @@ add_device_stack (CcNetworkPanel *self, NetObject *object)
}
static void
-panel_add_device (CcNetworkPanel *panel, NMDevice *device)
+panel_add_device (CcNetworkPanel *self, NMDevice *device)
{
NMDeviceType type;
NetDevice *net_device;
@@ -458,7 +458,7 @@ panel_add_device (CcNetworkPanel *panel, NMDevice *device)
/* do we have an existing object with this id? */
udi = nm_device_get_udi (device);
- if (find_net_object_by_id (panel, udi) != NULL)
+ if (find_net_object_by_id (self, udi) != NULL)
return;
type = nm_device_get_device_type (device);
@@ -491,10 +491,10 @@ panel_add_device (CcNetworkPanel *panel, NMDevice *device)
/* create device */
net_device = g_object_new (device_g_type,
- "panel", panel,
+ "panel", self,
"removable", FALSE,
- "cancellable", panel->cancellable,
- "client", panel->client,
+ "cancellable", self->cancellable,
+ "client", self->client,
"nm-device", device,
"id", nm_device_get_udi (device),
NULL);
@@ -503,13 +503,13 @@ panel_add_device (CcNetworkPanel *panel, NMDevice *device)
g_str_has_prefix (nm_device_get_udi (device), "/org/freedesktop/ModemManager1/Modem/")) {
g_autoptr(GDBusObject) modem_object = NULL;
- if (panel->modem_manager == NULL) {
+ if (self->modem_manager == NULL) {
g_warning ("Cannot grab information for modem at %s: No ModemManager support",
nm_device_get_udi (device));
return;
}
- modem_object = g_dbus_object_manager_get_object (G_DBUS_OBJECT_MANAGER
(panel->modem_manager),
+ modem_object = g_dbus_object_manager_get_object (G_DBUS_OBJECT_MANAGER (self->modem_manager),
nm_device_get_udi (device));
if (modem_object == NULL) {
g_warning ("Cannot grab information for modem at %s: Not found",
@@ -527,51 +527,51 @@ panel_add_device (CcNetworkPanel *panel, NMDevice *device)
if (device_g_type != NET_TYPE_DEVICE) {
GtkWidget *stack;
- stack = add_device_stack (panel, NET_OBJECT (net_device));
+ stack = add_device_stack (self, NET_OBJECT (net_device));
if (device_g_type == NET_TYPE_DEVICE_SIMPLE)
- gtk_container_add (GTK_CONTAINER (panel->box_simple), stack);
+ gtk_container_add (GTK_CONTAINER (self->box_simple), stack);
else
- gtk_container_add (GTK_CONTAINER (panel->box_wired), stack);
+ gtk_container_add (GTK_CONTAINER (self->box_wired), stack);
}
/* Add to the devices array */
- g_ptr_array_add (panel->devices, net_device);
+ g_ptr_array_add (self->devices, net_device);
/* Update the device_simple section if we're adding a simple
* device. This is a temporary solution though, for these will
* be handled by the future Mobile Broadband panel */
if (device_g_type == NET_TYPE_DEVICE_SIMPLE)
- update_simple_section (panel);
+ update_simple_section (self);
g_signal_connect_object (net_device, "removed",
- G_CALLBACK (object_removed_cb), panel, G_CONNECT_SWAPPED);
+ G_CALLBACK (object_removed_cb), self, G_CONNECT_SWAPPED);
}
static void
-panel_remove_device (CcNetworkPanel *panel, NMDevice *device)
+panel_remove_device (CcNetworkPanel *self, NMDevice *device)
{
NetObject *object;
/* remove device from array */
- object = find_net_object_by_id (panel, nm_device_get_udi (device));
+ object = find_net_object_by_id (self, nm_device_get_udi (device));
if (object == NULL)
return;
/* NMObject will not fire the "removed" signal, so handle the UI removal explicitly */
- object_removed_cb (panel, object);
- g_ptr_array_remove (panel->devices, object);
+ object_removed_cb (self, object);
+ g_ptr_array_remove (self->devices, object);
/* update vpn widgets */
- update_vpn_section (panel);
+ update_vpn_section (self);
/* update device_simple widgets */
- update_simple_section (panel);
+ update_simple_section (self);
}
static void
-panel_add_proxy_device (CcNetworkPanel *panel)
+panel_add_proxy_device (CcNetworkPanel *self)
{
GtkWidget *stack;
NetProxy *proxy;
@@ -579,30 +579,30 @@ panel_add_proxy_device (CcNetworkPanel *panel)
proxy = net_proxy_new ();
/* add proxy to stack */
- stack = add_device_stack (panel, NET_OBJECT (proxy));
- gtk_container_add (GTK_CONTAINER (panel->box_proxy), stack);
+ stack = add_device_stack (self, NET_OBJECT (proxy));
+ gtk_container_add (GTK_CONTAINER (self->box_proxy), stack);
/* add proxy to device list */
net_object_set_title (NET_OBJECT (proxy), _("Network proxy"));
/* NOTE: No connect to notify::title here as it is guaranteed to not
* be changed by anyone.*/
- g_ptr_array_add (panel->devices, proxy);
+ g_ptr_array_add (self->devices, proxy);
}
static void
-connection_state_changed (CcNetworkPanel *panel)
+connection_state_changed (CcNetworkPanel *self)
{
}
static void
-active_connections_changed (CcNetworkPanel *panel)
+active_connections_changed (CcNetworkPanel *self)
{
const GPtrArray *connections;
int i, j;
g_debug ("Active connections changed:");
- connections = nm_client_get_active_connections (panel->client);
+ connections = nm_client_get_active_connections (self->client);
for (i = 0; connections && (i < connections->len); i++) {
NMActiveConnection *connection;
const GPtrArray *devices;
@@ -617,67 +617,67 @@ active_connections_changed (CcNetworkPanel *panel)
if (g_object_get_data (G_OBJECT (connection), "has-state-changed-handler") == NULL) {
g_signal_connect_object (connection, "notify::state",
- G_CALLBACK (connection_state_changed), panel,
G_CONNECT_SWAPPED);
+ G_CALLBACK (connection_state_changed), self,
G_CONNECT_SWAPPED);
g_object_set_data (G_OBJECT (connection), "has-state-changed-handler",
GINT_TO_POINTER (TRUE));
}
}
}
static void
-device_added_cb (CcNetworkPanel *panel, NMDevice *device)
+device_added_cb (CcNetworkPanel *self, NMDevice *device)
{
g_debug ("New device added");
- panel_add_device (panel, device);
- panel_refresh_device_titles (panel);
+ panel_add_device (self, device);
+ panel_refresh_device_titles (self);
}
static void
-device_removed_cb (CcNetworkPanel *panel, NMDevice *device)
+device_removed_cb (CcNetworkPanel *self, NMDevice *device)
{
g_debug ("Device removed");
- panel_remove_device (panel, device);
- panel_refresh_device_titles (panel);
+ panel_remove_device (self, device);
+ panel_refresh_device_titles (self);
}
static void
-manager_running (CcNetworkPanel *panel)
+manager_running (CcNetworkPanel *self)
{
const GPtrArray *devices;
int i;
NMDevice *device_tmp;
/* clear all devices we added */
- if (!nm_client_get_nm_running (panel->client)) {
+ if (!nm_client_get_nm_running (self->client)) {
g_debug ("NM disappeared");
goto out;
}
g_debug ("coldplugging devices");
- devices = nm_client_get_devices (panel->client);
+ devices = nm_client_get_devices (self->client);
if (devices == NULL) {
g_debug ("No devices to add");
return;
}
for (i = 0; i < devices->len; i++) {
device_tmp = g_ptr_array_index (devices, i);
- panel_add_device (panel, device_tmp);
+ panel_add_device (self, device_tmp);
}
out:
- panel_refresh_device_titles (panel);
+ panel_refresh_device_titles (self);
g_debug ("Calling handle_argv() after cold-plugging devices");
- handle_argv (panel);
+ handle_argv (self);
}
static NetObject *
-find_net_object_by_id (CcNetworkPanel *panel, const gchar *id)
+find_net_object_by_id (CcNetworkPanel *self, const gchar *id)
{
NetObject *object_tmp;
NetObject *object = NULL;
guint i;
- for (i = 0; i < panel->devices->len; i++) {
- object_tmp = g_ptr_array_index (panel->devices, i);
+ for (i = 0; i < self->devices->len; i++) {
+ object_tmp = g_ptr_array_index (self->devices, i);
if (g_strcmp0 (net_object_get_id (object_tmp), id) == 0) {
object = object_tmp;
@@ -689,7 +689,7 @@ find_net_object_by_id (CcNetworkPanel *panel, const gchar *id)
}
static void
-panel_add_vpn_device (CcNetworkPanel *panel, NMConnection *connection)
+panel_add_vpn_device (CcNetworkPanel *self, NMConnection *connection)
{
GtkWidget *stack;
NetVpn *net_vpn;
@@ -697,35 +697,35 @@ panel_add_vpn_device (CcNetworkPanel *panel, NMConnection *connection)
/* does already exist */
id = nm_connection_get_path (connection);
- if (find_net_object_by_id (panel, id) != NULL)
+ if (find_net_object_by_id (self, id) != NULL)
return;
/* add as a VPN object */
net_vpn = g_object_new (NET_TYPE_VPN,
- "panel", panel,
+ "panel", self,
"removable", TRUE,
"id", id,
"connection", connection,
- "client", panel->client,
+ "client", self->client,
NULL);
g_signal_connect_object (net_vpn, "removed",
- G_CALLBACK (object_removed_cb), panel, G_CONNECT_SWAPPED);
+ G_CALLBACK (object_removed_cb), self, G_CONNECT_SWAPPED);
/* add as a panel */
- stack = add_device_stack (panel, NET_OBJECT (net_vpn));
- gtk_container_add (GTK_CONTAINER (panel->box_vpn), stack);
+ stack = add_device_stack (self, NET_OBJECT (net_vpn));
+ gtk_container_add (GTK_CONTAINER (self->box_vpn), stack);
net_object_set_title (NET_OBJECT (net_vpn), nm_connection_get_id (connection));
/* store in the devices array */
- g_ptr_array_add (panel->devices, net_vpn);
+ g_ptr_array_add (self->devices, net_vpn);
/* update vpn widgets */
- update_vpn_section (panel);
+ update_vpn_section (self);
}
static void
-add_connection (CcNetworkPanel *panel,
+add_connection (CcNetworkPanel *self,
NMConnection *connection)
{
NMSettingConnection *s_con;
@@ -746,33 +746,33 @@ add_connection (CcNetworkPanel *panel,
type, g_type_name_from_instance ((GTypeInstance*)connection),
nm_connection_get_path (connection));
if (!iface)
- panel_add_vpn_device (panel, connection);
+ panel_add_vpn_device (self, connection);
}
static void
-notify_connection_added_cb (CcNetworkPanel *panel, NMRemoteConnection *connection)
+notify_connection_added_cb (CcNetworkPanel *self, NMRemoteConnection *connection)
{
- add_connection (panel, NM_CONNECTION (connection));
+ add_connection (self, NM_CONNECTION (connection));
}
static void
-panel_check_network_manager_version (CcNetworkPanel *panel)
+panel_check_network_manager_version (CcNetworkPanel *self)
{
const gchar *version;
/* parse running version */
- version = nm_client_get_version (panel->client);
+ version = nm_client_get_version (self->client);
if (version == NULL) {
GtkWidget *box;
GtkWidget *label;
g_autofree gchar *markup = NULL;
- gtk_container_remove (GTK_CONTAINER (panel), gtk_bin_get_child (GTK_BIN (panel)));
+ gtk_container_remove (GTK_CONTAINER (self), gtk_bin_get_child (GTK_BIN (self)));
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 20);
gtk_box_set_homogeneous (GTK_BOX (box), TRUE);
gtk_widget_set_vexpand (box, TRUE);
- gtk_container_add (GTK_CONTAINER (panel), box);
+ gtk_container_add (GTK_CONTAINER (self), box);
label = gtk_label_new (_("Oops, something has gone wrong. Please contact your software
vendor."));
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
@@ -789,7 +789,7 @@ panel_check_network_manager_version (CcNetworkPanel *panel)
gtk_widget_show_all (box);
} else {
- manager_running (panel);
+ manager_running (self);
}
}
@@ -807,11 +807,11 @@ create_connection_cb (GtkWidget *button,
static void
on_toplevel_map (GtkWidget *widget,
- CcNetworkPanel *panel)
+ CcNetworkPanel *self)
{
/* is the user compiling against a new version, but not running
* the daemon? */
- panel_check_network_manager_version (panel);
+ panel_check_network_manager_version (self);
}
@@ -845,7 +845,7 @@ cc_network_panel_class_init (CcNetworkPanelClass *klass)
}
static void
-cc_network_panel_init (CcNetworkPanel *panel)
+cc_network_panel_init (CcNetworkPanel *self)
{
g_autoptr(GError) error = NULL;
GtkWidget *toplevel;
@@ -855,14 +855,14 @@ cc_network_panel_init (CcNetworkPanel *panel)
g_resources_register (cc_network_get_resource ());
- gtk_widget_init_template (GTK_WIDGET (panel));
+ gtk_widget_init_template (GTK_WIDGET (self));
- panel->cancellable = g_cancellable_new ();
- panel->devices = g_ptr_array_new_with_free_func (g_object_unref);
- panel->device_to_stack = g_hash_table_new (g_direct_hash, g_direct_equal);
+ self->cancellable = g_cancellable_new ();
+ self->devices = g_ptr_array_new_with_free_func (g_object_unref);
+ self->device_to_stack = g_hash_table_new (g_direct_hash, g_direct_equal);
/* add the virtual proxy device */
- panel_add_proxy_device (panel);
+ panel_add_proxy_device (self);
/* Create and store a NMClient instance if it doesn't exist yet */
if (!cc_object_storage_has_object (CC_OBJECT_NMCLIENT)) {
@@ -871,16 +871,16 @@ cc_network_panel_init (CcNetworkPanel *panel)
}
/* use NetworkManager client */
- panel->client = cc_object_storage_get_object (CC_OBJECT_NMCLIENT);
+ self->client = cc_object_storage_get_object (CC_OBJECT_NMCLIENT);
- g_signal_connect_object (panel->client, "notify::nm-running" ,
- G_CALLBACK (manager_running), panel, G_CONNECT_SWAPPED);
- g_signal_connect_object (panel->client, "notify::active-connections",
- G_CALLBACK (active_connections_changed), panel, G_CONNECT_SWAPPED);
- g_signal_connect_object (panel->client, "device-added",
- G_CALLBACK (device_added_cb), panel, G_CONNECT_SWAPPED);
- g_signal_connect_object (panel->client, "device-removed",
- G_CALLBACK (device_removed_cb), panel, G_CONNECT_SWAPPED);
+ g_signal_connect_object (self->client, "notify::nm-running" ,
+ G_CALLBACK (manager_running), self, G_CONNECT_SWAPPED);
+ g_signal_connect_object (self->client, "notify::active-connections",
+ G_CALLBACK (active_connections_changed), self, G_CONNECT_SWAPPED);
+ g_signal_connect_object (self->client, "device-added",
+ G_CALLBACK (device_added_cb), self, G_CONNECT_SWAPPED);
+ g_signal_connect_object (self->client, "device-removed",
+ G_CALLBACK (device_removed_cb), self, G_CONNECT_SWAPPED);
/* Setup ModemManager client */
system_bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
@@ -888,29 +888,29 @@ cc_network_panel_init (CcNetworkPanel *panel)
g_warning ("Error connecting to system D-Bus: %s",
error->message);
} else {
- panel->modem_manager = mm_manager_new_sync (system_bus,
+ self->modem_manager = mm_manager_new_sync (system_bus,
G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE,
NULL,
&error);
- if (panel->modem_manager == NULL)
+ if (self->modem_manager == NULL)
g_warning ("Error connecting to ModemManager: %s",
error->message);
}
/* add remote settings such as VPN settings as virtual devices */
- g_signal_connect_object (panel->client, NM_CLIENT_CONNECTION_ADDED,
- G_CALLBACK (notify_connection_added_cb), panel, G_CONNECT_SWAPPED);
+ g_signal_connect_object (self->client, NM_CLIENT_CONNECTION_ADDED,
+ G_CALLBACK (notify_connection_added_cb), self, G_CONNECT_SWAPPED);
- toplevel = gtk_widget_get_toplevel (GTK_WIDGET (panel));
- g_signal_connect_after (toplevel, "map", G_CALLBACK (on_toplevel_map), panel);
+ toplevel = gtk_widget_get_toplevel (GTK_WIDGET (self));
+ g_signal_connect_after (toplevel, "map", G_CALLBACK (on_toplevel_map), self);
/* Cold-plug existing connections */
- connections = nm_client_get_connections (panel->client);
+ connections = nm_client_get_connections (self->client);
if (connections) {
for (i = 0; i < connections->len; i++)
- add_connection (panel, connections->pdata[i]);
+ add_connection (self, connections->pdata[i]);
}
g_debug ("Calling handle_argv() after cold-plugging connections");
- handle_argv (panel);
+ handle_argv (self);
}
diff --git a/panels/network/cc-wifi-connection-list.c b/panels/network/cc-wifi-connection-list.c
index 6b612bb74..02e9bb9fd 100644
--- a/panels/network/cc-wifi-connection-list.c
+++ b/panels/network/cc-wifi-connection-list.c
@@ -240,9 +240,9 @@ update_connections (CcWifiConnectionList *self)
}
static void
-on_row_configured_cb (CcWifiConnectionRow *row, CcWifiConnectionList *list)
+on_row_configured_cb (CcWifiConnectionRow *row, CcWifiConnectionList *self)
{
- g_signal_emit_by_name (list, "configure", row);
+ g_signal_emit_by_name (self, "configure", row);
}
static void
@@ -732,28 +732,28 @@ cc_wifi_connection_list_new (NMClient *client,
}
void
-cc_wifi_connection_list_freeze (CcWifiConnectionList *list)
+cc_wifi_connection_list_freeze (CcWifiConnectionList *self)
{
- g_return_if_fail (CC_WIFI_CONNECTION_LIST (list));
+ g_return_if_fail (CC_WIFI_CONNECTION_LIST (self));
- if (list->freeze_count == 0)
+ if (self->freeze_count == 0)
g_debug ("wifi connection list has been frozen");
- list->freeze_count += 1;
+ self->freeze_count += 1;
}
void
-cc_wifi_connection_list_thaw (CcWifiConnectionList *list)
+cc_wifi_connection_list_thaw (CcWifiConnectionList *self)
{
- g_return_if_fail (CC_WIFI_CONNECTION_LIST (list));
+ g_return_if_fail (CC_WIFI_CONNECTION_LIST (self));
- g_return_if_fail (list->freeze_count > 0);
+ g_return_if_fail (self->freeze_count > 0);
- list->freeze_count -= 1;
+ self->freeze_count -= 1;
- if (list->freeze_count == 0)
+ if (self->freeze_count == 0)
{
g_debug ("wifi connection list has been thawed");
- update_connections (list);
+ update_connections (self);
}
}
diff --git a/panels/network/cc-wifi-connection-row.c b/panels/network/cc-wifi-connection-row.c
index bd7b32f4a..613e6019a 100644
--- a/panels/network/cc-wifi-connection-row.c
+++ b/panels/network/cc-wifi-connection-row.c
@@ -481,22 +481,22 @@ cc_wifi_connection_row_class_init (CcWifiConnectionRowClass *klass)
}
static void
-configure_clicked_cb (CcWifiConnectionRow *row)
+configure_clicked_cb (CcWifiConnectionRow *self)
{
- g_signal_emit_by_name (row, "configure");
+ g_signal_emit_by_name (self, "configure");
}
void
-cc_wifi_connection_row_init (CcWifiConnectionRow *row)
+cc_wifi_connection_row_init (CcWifiConnectionRow *self)
{
- gtk_widget_init_template (GTK_WIDGET (row));
+ gtk_widget_init_template (GTK_WIDGET (self));
- g_signal_connect_swapped (row->configure_button, "clicked", G_CALLBACK (configure_clicked_cb), row);
+ g_signal_connect_swapped (self->configure_button, "clicked", G_CALLBACK (configure_clicked_cb), self);
- row->aps = g_ptr_array_new_with_free_func (g_object_unref);
+ self->aps = g_ptr_array_new_with_free_func (g_object_unref);
- g_object_bind_property (row, "checked",
- row->checkbutton, "active",
+ g_object_bind_property (self, "checked",
+ self->checkbutton, "active",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
}
@@ -515,76 +515,76 @@ cc_wifi_connection_row_new (NMDeviceWifi *device,
}
gboolean
-cc_wifi_connection_row_get_checkable (CcWifiConnectionRow *row)
+cc_wifi_connection_row_get_checkable (CcWifiConnectionRow *self)
{
- g_return_val_if_fail (CC_WIFI_CONNECTION_ROW (row), FALSE);
+ g_return_val_if_fail (CC_WIFI_CONNECTION_ROW (self), FALSE);
- return row->checkable;
+ return self->checkable;
}
gboolean
-cc_wifi_connection_row_get_checked (CcWifiConnectionRow *row)
+cc_wifi_connection_row_get_checked (CcWifiConnectionRow *self)
{
- g_return_val_if_fail (CC_WIFI_CONNECTION_ROW (row), FALSE);
+ g_return_val_if_fail (CC_WIFI_CONNECTION_ROW (self), FALSE);
- return row->checked;
+ return self->checked;
}
NMDeviceWifi*
-cc_wifi_connection_row_get_device (CcWifiConnectionRow *row)
+cc_wifi_connection_row_get_device (CcWifiConnectionRow *self)
{
- g_return_val_if_fail (CC_WIFI_CONNECTION_ROW (row), NULL);
+ g_return_val_if_fail (CC_WIFI_CONNECTION_ROW (self), NULL);
- return row->device;
+ return self->device;
}
const GPtrArray*
-cc_wifi_connection_row_get_access_points (CcWifiConnectionRow *row)
+cc_wifi_connection_row_get_access_points (CcWifiConnectionRow *self)
{
- g_return_val_if_fail (CC_WIFI_CONNECTION_ROW (row), NULL);
+ g_return_val_if_fail (CC_WIFI_CONNECTION_ROW (self), NULL);
- return row->aps;
+ return self->aps;
}
NMConnection*
-cc_wifi_connection_row_get_connection (CcWifiConnectionRow *row)
+cc_wifi_connection_row_get_connection (CcWifiConnectionRow *self)
{
- g_return_val_if_fail (CC_WIFI_CONNECTION_ROW (row), NULL);
+ g_return_val_if_fail (CC_WIFI_CONNECTION_ROW (self), NULL);
- return row->connection;
+ return self->connection;
}
void
-cc_wifi_connection_row_set_checked (CcWifiConnectionRow *row,
- gboolean value)
+cc_wifi_connection_row_set_checked (CcWifiConnectionRow *self,
+ gboolean value)
{
- g_return_if_fail (CC_WIFI_CONNECTION_ROW (row));
+ g_return_if_fail (CC_WIFI_CONNECTION_ROW (self));
- row->checked = value;
- g_object_notify_by_pspec (G_OBJECT (row), props[PROP_CHECKED]);
+ self->checked = value;
+ g_object_notify_by_pspec (G_OBJECT (self), props[PROP_CHECKED]);
}
NMAccessPoint*
-cc_wifi_connection_row_best_access_point (CcWifiConnectionRow *row)
+cc_wifi_connection_row_best_access_point (CcWifiConnectionRow *self)
{
NMAccessPoint *best_ap = NULL;
NMAccessPoint *active_ap = NULL;
guint8 strength = 0;
gint i;
- g_return_val_if_fail (CC_WIFI_CONNECTION_ROW (row), NULL);
+ g_return_val_if_fail (CC_WIFI_CONNECTION_ROW (self), NULL);
- if (row->aps->len == 0)
+ if (self->aps->len == 0)
return NULL;
- active_ap = nm_device_wifi_get_active_access_point (row->device);
+ active_ap = nm_device_wifi_get_active_access_point (self->device);
- for (i = 0; i < row->aps->len; i++)
+ for (i = 0; i < self->aps->len; i++)
{
NMAccessPoint *cur;
guint8 cur_strength;
- cur = g_ptr_array_index (row->aps, i);
+ cur = g_ptr_array_index (self->aps, i);
/* Prefer the active AP in all cases */
if (cur == active_ap)
@@ -603,49 +603,49 @@ cc_wifi_connection_row_best_access_point (CcWifiConnectionRow *row)
}
void
-cc_wifi_connection_row_add_access_point (CcWifiConnectionRow *row,
- NMAccessPoint *ap)
+cc_wifi_connection_row_add_access_point (CcWifiConnectionRow *self,
+ NMAccessPoint *ap)
{
- g_return_if_fail (CC_WIFI_CONNECTION_ROW (row));
+ g_return_if_fail (CC_WIFI_CONNECTION_ROW (self));
- g_ptr_array_add (row->aps, g_object_ref (ap));
- update_ui (row);
+ g_ptr_array_add (self->aps, g_object_ref (ap));
+ update_ui (self);
}
gboolean
-cc_wifi_connection_row_remove_access_point (CcWifiConnectionRow *row,
- NMAccessPoint *ap)
+cc_wifi_connection_row_remove_access_point (CcWifiConnectionRow *self,
+ NMAccessPoint *ap)
{
- g_return_val_if_fail (CC_WIFI_CONNECTION_ROW (row), FALSE);
+ g_return_val_if_fail (CC_WIFI_CONNECTION_ROW (self), FALSE);
- if (!g_ptr_array_remove (row->aps, g_object_ref (ap)))
+ if (!g_ptr_array_remove (self->aps, g_object_ref (ap)))
return FALSE;
/* Object might be invalid; this is alright if it is deleted right away */
- if (row->aps->len > 0 || row->connection)
+ if (self->aps->len > 0 || self->connection)
{
- g_object_notify_by_pspec (G_OBJECT (row), props[PROP_APS]);
- update_ui (row);
+ g_object_notify_by_pspec (G_OBJECT (self), props[PROP_APS]);
+ update_ui (self);
}
- return row->aps->len == 0;
+ return self->aps->len == 0;
}
gboolean
-cc_wifi_connection_row_has_access_point (CcWifiConnectionRow *row,
- NMAccessPoint *ap)
+cc_wifi_connection_row_has_access_point (CcWifiConnectionRow *self,
+ NMAccessPoint *ap)
{
- g_return_val_if_fail (CC_WIFI_CONNECTION_ROW (row), FALSE);
+ g_return_val_if_fail (CC_WIFI_CONNECTION_ROW (self), FALSE);
- return g_ptr_array_find (row->aps, ap, NULL);
+ return g_ptr_array_find (self->aps, ap, NULL);
}
void
-cc_wifi_connection_row_update (CcWifiConnectionRow *row)
+cc_wifi_connection_row_update (CcWifiConnectionRow *self)
{
- update_ui (row);
+ update_ui (self);
- gtk_list_box_row_changed (GTK_LIST_BOX_ROW (row));
+ gtk_list_box_row_changed (GTK_LIST_BOX_ROW (self));
}
diff --git a/panels/network/connection-editor/ce-page-8021x-security.c
b/panels/network/connection-editor/ce-page-8021x-security.c
index fc9e6c7a0..9a4e0c2b2 100644
--- a/panels/network/connection-editor/ce-page-8021x-security.c
+++ b/panels/network/connection-editor/ce-page-8021x-security.c
@@ -37,10 +37,10 @@
G_DEFINE_TYPE (CEPage8021xSecurity, ce_page_8021x_security, CE_TYPE_PAGE)
static void
-enable_toggled (CEPage8021xSecurity *page)
+enable_toggled (CEPage8021xSecurity *self)
{
- gtk_widget_set_sensitive (page->security_widget, gtk_switch_get_active (page->enable_8021x_switch));
- ce_page_changed (CE_PAGE (page));
+ gtk_widget_set_sensitive (self->security_widget, gtk_switch_get_active (self->enable_8021x_switch));
+ ce_page_changed (CE_PAGE (self));
}
static void
@@ -50,35 +50,35 @@ stuff_changed (WirelessSecurity *sec, gpointer user_data)
}
static void
-finish_setup (CEPage8021xSecurity *page, gpointer unused, GError *error, gpointer user_data)
+finish_setup (CEPage8021xSecurity *self, gpointer unused, GError *error, gpointer user_data)
{
GtkWidget *parent;
if (error)
return;
- page->group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+ self->group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
- page->security = (WirelessSecurity *) ws_wpa_eap_new (CE_PAGE (page)->connection, TRUE, FALSE);
- if (!page->security) {
+ self->security = (WirelessSecurity *) ws_wpa_eap_new (CE_PAGE (self)->connection, TRUE, FALSE);
+ if (!self->security) {
g_warning ("Could not load 802.1x user interface.");
return;
}
- wireless_security_set_changed_notify (page->security, stuff_changed, page);
- page->security_widget = wireless_security_get_widget (page->security);
- parent = gtk_widget_get_parent (page->security_widget);
+ wireless_security_set_changed_notify (self->security, stuff_changed, self);
+ self->security_widget = wireless_security_get_widget (self->security);
+ parent = gtk_widget_get_parent (self->security_widget);
if (parent)
- gtk_container_remove (GTK_CONTAINER (parent), page->security_widget);
+ gtk_container_remove (GTK_CONTAINER (parent), self->security_widget);
- gtk_switch_set_active (page->enable_8021x_switch, page->initial_have_8021x);
- g_signal_connect_swapped (page->enable_8021x_switch, "notify::active", G_CALLBACK (enable_toggled),
page);
- gtk_widget_set_sensitive (page->security_widget, page->initial_have_8021x);
+ gtk_switch_set_active (self->enable_8021x_switch, self->initial_have_8021x);
+ g_signal_connect_swapped (self->enable_8021x_switch, "notify::active", G_CALLBACK (enable_toggled),
self);
+ gtk_widget_set_sensitive (self->security_widget, self->initial_have_8021x);
- gtk_size_group_add_widget (page->group, GTK_WIDGET (page->security_label));
- wireless_security_add_to_size_group (page->security, page->group);
+ gtk_size_group_add_widget (self->group, GTK_WIDGET (self->security_label));
+ wireless_security_add_to_size_group (self->security, self->group);
- gtk_container_add (GTK_CONTAINER (page->box), page->security_widget);
+ gtk_container_add (GTK_CONTAINER (self->box), self->security_widget);
}
@@ -86,40 +86,40 @@ CEPage *
ce_page_8021x_security_new (NMConnection *connection,
NMClient *client)
{
- CEPage8021xSecurity *page;
+ CEPage8021xSecurity *self;
- page = CE_PAGE_8021X_SECURITY (ce_page_new (CE_TYPE_PAGE_8021X_SECURITY,
+ self = CE_PAGE_8021X_SECURITY (ce_page_new (CE_TYPE_PAGE_8021X_SECURITY,
connection,
client,
"/org/gnome/control-center/network/8021x-security-page.ui",
_("Security")));
- page->box = GTK_BOX (gtk_builder_get_object (CE_PAGE (page)->builder, "box"));
- page->enable_8021x_switch = GTK_SWITCH (gtk_builder_get_object (CE_PAGE (page)->builder,
"enable_8021x_switch"));
- page->security_label = GTK_LABEL (gtk_builder_get_object (CE_PAGE (page)->builder,
"security_label"));
+ self->box = GTK_BOX (gtk_builder_get_object (CE_PAGE (self)->builder, "box"));
+ self->enable_8021x_switch = GTK_SWITCH (gtk_builder_get_object (CE_PAGE (self)->builder,
"enable_8021x_switch"));
+ self->security_label = GTK_LABEL (gtk_builder_get_object (CE_PAGE (self)->builder,
"security_label"));
if (nm_connection_get_setting_802_1x (connection))
- page->initial_have_8021x = TRUE;
+ self->initial_have_8021x = TRUE;
- g_signal_connect (page, "initialized", G_CALLBACK (finish_setup), NULL);
+ g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
- if (page->initial_have_8021x)
- CE_PAGE (page)->security_setting = NM_SETTING_802_1X_SETTING_NAME;
+ if (self->initial_have_8021x)
+ CE_PAGE (self)->security_setting = NM_SETTING_802_1X_SETTING_NAME;
- return CE_PAGE (page);
+ return CE_PAGE (self);
}
static gboolean
validate (CEPage *cepage, NMConnection *connection, GError **error)
{
- CEPage8021xSecurity *page = CE_PAGE_8021X_SECURITY (cepage);
+ CEPage8021xSecurity *self = CE_PAGE_8021X_SECURITY (cepage);
gboolean valid = TRUE;
- if (gtk_switch_get_active (page->enable_8021x_switch)) {
+ if (gtk_switch_get_active (self->enable_8021x_switch)) {
NMSetting *s_8021x;
/* FIXME: get failed property and error out of wireless security objects */
- valid = wireless_security_validate (page->security, error);
+ valid = wireless_security_validate (self->security, error);
if (valid) {
g_autoptr(NMConnection) tmp_connection = NULL;
NMSetting *s_con;
@@ -134,7 +134,7 @@ validate (CEPage *cepage, NMConnection *connection, GError **error)
s_con = nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
nm_connection_add_setting (tmp_connection, nm_setting_duplicate (s_con));
- ws_802_1x_fill_connection (GTK_COMBO_BOX (gtk_builder_get_object
(page->security->builder, "auth_combo")), tmp_connection);
+ ws_802_1x_fill_connection (GTK_COMBO_BOX (gtk_builder_get_object
(self->security->builder, "auth_combo")), tmp_connection);
s_8021x = nm_connection_get_setting (tmp_connection, NM_TYPE_SETTING_802_1X);
nm_connection_add_setting (connection, NM_SETTING (g_object_ref (s_8021x)));
@@ -148,21 +148,21 @@ validate (CEPage *cepage, NMConnection *connection, GError **error)
}
static void
-ce_page_8021x_security_init (CEPage8021xSecurity *page)
+ce_page_8021x_security_init (CEPage8021xSecurity *self)
{
}
static void
dispose (GObject *object)
{
- CEPage8021xSecurity *page = CE_PAGE_8021X_SECURITY (object);
+ CEPage8021xSecurity *self = CE_PAGE_8021X_SECURITY (object);
- if (page->security) {
- wireless_security_unref (page->security);
- page->security = NULL;
+ if (self->security) {
+ wireless_security_unref (self->security);
+ self->security = NULL;
}
- g_clear_object (&page->group);
+ g_clear_object (&self->group);
G_OBJECT_CLASS (ce_page_8021x_security_parent_class)->dispose (object);
}
diff --git a/panels/network/connection-editor/ce-page-details.c
b/panels/network/connection-editor/ce-page-details.c
index eabec00a6..5a989ae90 100644
--- a/panels/network/connection-editor/ce-page-details.c
+++ b/panels/network/connection-editor/ce-page-details.c
@@ -32,9 +32,9 @@
G_DEFINE_TYPE (CEPageDetails, ce_page_details, CE_TYPE_PAGE)
static void
-forget_cb (CEPageDetails *page)
+forget_cb (CEPageDetails *self)
{
- net_connection_editor_forget (page->editor);
+ net_connection_editor_forget (self->editor);
}
static gchar *
@@ -77,7 +77,7 @@ get_ap_security_string (NMAccessPoint *ap)
}
static void
-update_last_used (CEPageDetails *page, NMConnection *connection)
+update_last_used (CEPageDetails *self, NMConnection *connection)
{
g_autofree gchar *last_used = NULL;
g_autoptr(GDateTime) now = NULL;
@@ -109,17 +109,17 @@ update_last_used (CEPageDetails *page, NMConnection *connection)
else
last_used = g_strdup_printf (ngettext ("%i day ago", "%i days ago", days), days);
out:
- panel_set_device_widget_details (page->last_used_heading_label, page->last_used_label, last_used);
+ panel_set_device_widget_details (self->last_used_heading_label, self->last_used_label, last_used);
}
static void
-all_user_changed (CEPageDetails *page)
+all_user_changed (CEPageDetails *self)
{
gboolean all_users;
NMSettingConnection *sc;
- sc = nm_connection_get_setting_connection (CE_PAGE (page)->connection);
- all_users = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->all_user_check));
+ sc = nm_connection_get_setting_connection (CE_PAGE (self)->connection);
+ all_users = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->all_user_check));
g_object_set (sc, "permissions", NULL, NULL);
if (!all_users)
@@ -127,14 +127,14 @@ all_user_changed (CEPageDetails *page)
}
static void
-restrict_data_changed (CEPageDetails *page)
+restrict_data_changed (CEPageDetails *self)
{
NMSettingConnection *s_con;
NMMetered metered;
- s_con = nm_connection_get_setting_connection (CE_PAGE (page)->connection);
+ s_con = nm_connection_get_setting_connection (CE_PAGE (self)->connection);
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->restrict_data_check)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->restrict_data_check)))
metered = NM_METERED_YES;
else
metered = NM_METERED_NO;
@@ -143,13 +143,13 @@ restrict_data_changed (CEPageDetails *page)
}
static void
-update_restrict_data (CEPageDetails *page)
+update_restrict_data (CEPageDetails *self)
{
NMSettingConnection *s_con;
NMMetered metered;
const gchar *type;
- s_con = nm_connection_get_setting_connection (CE_PAGE (page)->connection);
+ s_con = nm_connection_get_setting_connection (CE_PAGE (self)->connection);
if (s_con == NULL)
return;
@@ -162,16 +162,16 @@ update_restrict_data (CEPageDetails *page)
metered = nm_setting_connection_get_metered (s_con);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->restrict_data_check),
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->restrict_data_check),
metered == NM_METERED_YES || metered == NM_METERED_GUESS_YES);
- gtk_widget_show (GTK_WIDGET (page->restrict_data_check));
+ gtk_widget_show (GTK_WIDGET (self->restrict_data_check));
- g_signal_connect_swapped (page->restrict_data_check, "notify::active", G_CALLBACK
(restrict_data_changed), page);
- g_signal_connect_swapped (page->restrict_data_check, "notify::active", G_CALLBACK (ce_page_changed),
page);
+ g_signal_connect_swapped (self->restrict_data_check, "notify::active", G_CALLBACK
(restrict_data_changed), self);
+ g_signal_connect_swapped (self->restrict_data_check, "notify::active", G_CALLBACK (ce_page_changed),
self);
}
static void
-connect_details_page (CEPageDetails *page)
+connect_details_page (CEPageDetails *self)
{
NMSettingConnection *sc;
guint speed;
@@ -185,55 +185,55 @@ connect_details_page (CEPageDetails *page)
const gchar *strength_label;
gboolean device_is_active;
- sc = nm_connection_get_setting_connection (CE_PAGE (page)->connection);
+ sc = nm_connection_get_setting_connection (CE_PAGE (self)->connection);
type = nm_setting_connection_get_connection_type (sc);
- if (NM_IS_DEVICE_WIFI (page->device))
- active_ap = nm_device_wifi_get_active_access_point (NM_DEVICE_WIFI (page->device));
+ if (NM_IS_DEVICE_WIFI (self->device))
+ active_ap = nm_device_wifi_get_active_access_point (NM_DEVICE_WIFI (self->device));
else
active_ap = NULL;
- state = page->device ? nm_device_get_state (page->device) : NM_DEVICE_STATE_DISCONNECTED;
+ state = self->device ? nm_device_get_state (self->device) : NM_DEVICE_STATE_DISCONNECTED;
device_is_active = FALSE;
speed = 0;
- if (active_ap && page->ap == active_ap && state != NM_DEVICE_STATE_UNAVAILABLE) {
+ if (active_ap && self->ap == active_ap && state != NM_DEVICE_STATE_UNAVAILABLE) {
device_is_active = TRUE;
- if (NM_IS_DEVICE_WIFI (page->device))
- speed = nm_device_wifi_get_bitrate (NM_DEVICE_WIFI (page->device)) / 1000;
- } else if (page->device) {
+ if (NM_IS_DEVICE_WIFI (self->device))
+ speed = nm_device_wifi_get_bitrate (NM_DEVICE_WIFI (self->device)) / 1000;
+ } else if (self->device) {
NMActiveConnection *ac;
const gchar *p1, *p2;
- ac = nm_device_get_active_connection (page->device);
+ ac = nm_device_get_active_connection (self->device);
p1 = ac ? nm_active_connection_get_uuid (ac) : NULL;
- p2 = nm_connection_get_uuid (CE_PAGE (page)->connection);
+ p2 = nm_connection_get_uuid (CE_PAGE (self)->connection);
if (g_strcmp0 (p1, p2) == 0) {
device_is_active = TRUE;
- if (NM_IS_DEVICE_WIFI (page->device))
- speed = nm_device_wifi_get_bitrate (NM_DEVICE_WIFI (page->device)) / 1000;
- else if (NM_IS_DEVICE_ETHERNET (page->device))
- speed = nm_device_ethernet_get_speed (NM_DEVICE_ETHERNET (page->device));
+ if (NM_IS_DEVICE_WIFI (self->device))
+ speed = nm_device_wifi_get_bitrate (NM_DEVICE_WIFI (self->device)) / 1000;
+ else if (NM_IS_DEVICE_ETHERNET (self->device))
+ speed = nm_device_ethernet_get_speed (NM_DEVICE_ETHERNET (self->device));
}
}
if (speed > 0)
speed_label = g_strdup_printf (_("%d Mb/s"), speed);
- panel_set_device_widget_details (page->speed_heading_label, page->speed_label, speed_label);
+ panel_set_device_widget_details (self->speed_heading_label, self->speed_label, speed_label);
- if (NM_IS_DEVICE_WIFI (page->device))
- hw_address = nm_device_wifi_get_hw_address (NM_DEVICE_WIFI (page->device));
- else if (NM_IS_DEVICE_ETHERNET (page->device))
- hw_address = nm_device_ethernet_get_hw_address (NM_DEVICE_ETHERNET (page->device));
+ if (NM_IS_DEVICE_WIFI (self->device))
+ hw_address = nm_device_wifi_get_hw_address (NM_DEVICE_WIFI (self->device));
+ else if (NM_IS_DEVICE_ETHERNET (self->device))
+ hw_address = nm_device_ethernet_get_hw_address (NM_DEVICE_ETHERNET (self->device));
- panel_set_device_widget_details (page->mac_heading_label, page->mac_label, hw_address);
+ panel_set_device_widget_details (self->mac_heading_label, self->mac_label, hw_address);
if (device_is_active && active_ap)
security_string = get_ap_security_string (active_ap);
- panel_set_device_widget_details (page->security_heading_label, page->security_label,
security_string);
+ panel_set_device_widget_details (self->security_heading_label, self->security_label,
security_string);
strength = 0;
- if (page->ap != NULL)
- strength = nm_access_point_get_strength (page->ap);
+ if (self->ap != NULL)
+ strength = nm_access_point_get_strength (self->ap);
if (strength <= 0)
strength_label = NULL;
@@ -247,55 +247,55 @@ connect_details_page (CEPageDetails *page)
strength_label = C_("Signal strength", "Good");
else
strength_label = C_("Signal strength", "Excellent");
- panel_set_device_widget_details (page->strength_heading_label, page->strength_label, strength_label);
+ panel_set_device_widget_details (self->strength_heading_label, self->strength_label, strength_label);
/* set IP entries */
- panel_set_device_widgets (page->ipv4_heading_label, page->ipv4_label,
- page->ipv6_heading_label, page->ipv6_label,
- page->dns_heading_label, page->dns_label,
- page->route_heading_label, page->route_label,
- device_is_active ? page->device : NULL);
-
- if (!device_is_active && CE_PAGE (page)->connection)
- update_last_used (page, CE_PAGE (page)->connection);
+ panel_set_device_widgets (self->ipv4_heading_label, self->ipv4_label,
+ self->ipv6_heading_label, self->ipv6_label,
+ self->dns_heading_label, self->dns_label,
+ self->route_heading_label, self->route_label,
+ device_is_active ? self->device : NULL);
+
+ if (!device_is_active && CE_PAGE (self)->connection)
+ update_last_used (self, CE_PAGE (self)->connection);
else
- panel_set_device_widget_details (page->last_used_heading_label, page->last_used_label, NULL);
+ panel_set_device_widget_details (self->last_used_heading_label, self->last_used_label, NULL);
/* Auto connect check */
if (g_str_equal (type, NM_SETTING_VPN_SETTING_NAME)) {
- gtk_widget_hide (GTK_WIDGET (page->auto_connect_check));
+ gtk_widget_hide (GTK_WIDGET (self->auto_connect_check));
} else {
g_object_bind_property (sc, "autoconnect",
- page->auto_connect_check, "active",
+ self->auto_connect_check, "active",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
- g_signal_connect_swapped (page->auto_connect_check, "toggled", G_CALLBACK (ce_page_changed),
page);
+ g_signal_connect_swapped (self->auto_connect_check, "toggled", G_CALLBACK (ce_page_changed),
self);
}
/* All users check */
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->all_user_check),
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->all_user_check),
nm_setting_connection_get_num_permissions (sc) == 0);
- g_signal_connect_swapped (page->all_user_check, "toggled",
- G_CALLBACK (all_user_changed), page);
- g_signal_connect_swapped (page->all_user_check, "toggled", G_CALLBACK (ce_page_changed), page);
+ g_signal_connect_swapped (self->all_user_check, "toggled",
+ G_CALLBACK (all_user_changed), self);
+ g_signal_connect_swapped (self->all_user_check, "toggled", G_CALLBACK (ce_page_changed), self);
/* Restrict Data check */
- update_restrict_data (page);
+ update_restrict_data (self);
/* Forget button */
- g_signal_connect_swapped (page->forget_button, "clicked", G_CALLBACK (forget_cb), page);
+ g_signal_connect_swapped (self->forget_button, "clicked", G_CALLBACK (forget_cb), self);
if (g_str_equal (type, NM_SETTING_WIRELESS_SETTING_NAME))
- gtk_button_set_label (page->forget_button, _("Forget Connection"));
+ gtk_button_set_label (self->forget_button, _("Forget Connection"));
else if (g_str_equal (type, NM_SETTING_WIRED_SETTING_NAME))
- gtk_button_set_label (page->forget_button, _("Remove Connection Profile"));
+ gtk_button_set_label (self->forget_button, _("Remove Connection Profile"));
else if (g_str_equal (type, NM_SETTING_VPN_SETTING_NAME))
- gtk_button_set_label (page->forget_button, _("Remove VPN"));
+ gtk_button_set_label (self->forget_button, _("Remove VPN"));
else
- gtk_widget_hide (GTK_WIDGET (page->forget_button));
+ gtk_widget_hide (GTK_WIDGET (self->forget_button));
}
static void
-ce_page_details_init (CEPageDetails *page)
+ce_page_details_init (CEPageDetails *self)
{
}
@@ -311,42 +311,42 @@ ce_page_details_new (NMConnection *connection,
NMAccessPoint *ap,
NetConnectionEditor *editor)
{
- CEPageDetails *page;
+ CEPageDetails *self;
- page = CE_PAGE_DETAILS (ce_page_new (CE_TYPE_PAGE_DETAILS,
+ self = CE_PAGE_DETAILS (ce_page_new (CE_TYPE_PAGE_DETAILS,
connection,
client,
"/org/gnome/control-center/network/details-page.ui",
_("Details")));
- page->all_user_check = GTK_CHECK_BUTTON (gtk_builder_get_object (CE_PAGE (page)->builder,
"all_user_check"));
- page->auto_connect_check = GTK_CHECK_BUTTON (gtk_builder_get_object (CE_PAGE (page)->builder,
"auto_connect_check"));
- page->dns_heading_label = GTK_LABEL (gtk_builder_get_object (CE_PAGE (page)->builder,
"dns_heading_label"));
- page->dns_label = GTK_LABEL (gtk_builder_get_object (CE_PAGE (page)->builder, "dns_label"));
- page->forget_button = GTK_BUTTON (gtk_builder_get_object (CE_PAGE (page)->builder, "forget_button"));
- page->ipv4_heading_label = GTK_LABEL (gtk_builder_get_object (CE_PAGE (page)->builder,
"ipv4_heading_label"));
- page->ipv4_label = GTK_LABEL (gtk_builder_get_object (CE_PAGE (page)->builder, "ipv4_label"));
- page->ipv6_heading_label = GTK_LABEL (gtk_builder_get_object (CE_PAGE (page)->builder,
"ipv6_heading_label"));
- page->ipv6_label = GTK_LABEL (gtk_builder_get_object (CE_PAGE (page)->builder, "ipv6_label"));
- page->last_used_heading_label = GTK_LABEL (gtk_builder_get_object (CE_PAGE (page)->builder,
"last_used_heading_label"));
- page->last_used_label = GTK_LABEL (gtk_builder_get_object (CE_PAGE (page)->builder,
"last_used_label"));
- page->mac_heading_label = GTK_LABEL (gtk_builder_get_object (CE_PAGE (page)->builder,
"mac_heading_label"));
- page->mac_label = GTK_LABEL (gtk_builder_get_object (CE_PAGE (page)->builder, "mac_label"));
- page->restrict_data_check = GTK_CHECK_BUTTON (gtk_builder_get_object (CE_PAGE (page)->builder,
"restrict_data_check"));
- page->route_heading_label = GTK_LABEL (gtk_builder_get_object (CE_PAGE (page)->builder,
"route_heading_label"));
- page->route_label = GTK_LABEL (gtk_builder_get_object (CE_PAGE (page)->builder, "route_label"));
- page->security_heading_label = GTK_LABEL (gtk_builder_get_object (CE_PAGE (page)->builder,
"security_heading_label"));
- page->security_label = GTK_LABEL (gtk_builder_get_object (CE_PAGE (page)->builder,
"security_label"));
- page->speed_heading_label = GTK_LABEL (gtk_builder_get_object (CE_PAGE (page)->builder,
"speed_heading_label"));
- page->speed_label = GTK_LABEL (gtk_builder_get_object (CE_PAGE (page)->builder, "speed_label"));
- page->strength_heading_label = GTK_LABEL (gtk_builder_get_object (CE_PAGE (page)->builder,
"strength_heading_label"));
- page->strength_label = GTK_LABEL (gtk_builder_get_object (CE_PAGE (page)->builder,
"strength_label"));
-
- page->editor = editor;
- page->device = device;
- page->ap = ap;
-
- connect_details_page (page);
-
- return CE_PAGE (page);
+ self->all_user_check = GTK_CHECK_BUTTON (gtk_builder_get_object (CE_PAGE (self)->builder,
"all_user_check"));
+ self->auto_connect_check = GTK_CHECK_BUTTON (gtk_builder_get_object (CE_PAGE (self)->builder,
"auto_connect_check"));
+ self->dns_heading_label = GTK_LABEL (gtk_builder_get_object (CE_PAGE (self)->builder,
"dns_heading_label"));
+ self->dns_label = GTK_LABEL (gtk_builder_get_object (CE_PAGE (self)->builder, "dns_label"));
+ self->forget_button = GTK_BUTTON (gtk_builder_get_object (CE_PAGE (self)->builder, "forget_button"));
+ self->ipv4_heading_label = GTK_LABEL (gtk_builder_get_object (CE_PAGE (self)->builder,
"ipv4_heading_label"));
+ self->ipv4_label = GTK_LABEL (gtk_builder_get_object (CE_PAGE (self)->builder, "ipv4_label"));
+ self->ipv6_heading_label = GTK_LABEL (gtk_builder_get_object (CE_PAGE (self)->builder,
"ipv6_heading_label"));
+ self->ipv6_label = GTK_LABEL (gtk_builder_get_object (CE_PAGE (self)->builder, "ipv6_label"));
+ self->last_used_heading_label = GTK_LABEL (gtk_builder_get_object (CE_PAGE (self)->builder,
"last_used_heading_label"));
+ self->last_used_label = GTK_LABEL (gtk_builder_get_object (CE_PAGE (self)->builder,
"last_used_label"));
+ self->mac_heading_label = GTK_LABEL (gtk_builder_get_object (CE_PAGE (self)->builder,
"mac_heading_label"));
+ self->mac_label = GTK_LABEL (gtk_builder_get_object (CE_PAGE (self)->builder, "mac_label"));
+ self->restrict_data_check = GTK_CHECK_BUTTON (gtk_builder_get_object (CE_PAGE (self)->builder,
"restrict_data_check"));
+ self->route_heading_label = GTK_LABEL (gtk_builder_get_object (CE_PAGE (self)->builder,
"route_heading_label"));
+ self->route_label = GTK_LABEL (gtk_builder_get_object (CE_PAGE (self)->builder, "route_label"));
+ self->security_heading_label = GTK_LABEL (gtk_builder_get_object (CE_PAGE (self)->builder,
"security_heading_label"));
+ self->security_label = GTK_LABEL (gtk_builder_get_object (CE_PAGE (self)->builder,
"security_label"));
+ self->speed_heading_label = GTK_LABEL (gtk_builder_get_object (CE_PAGE (self)->builder,
"speed_heading_label"));
+ self->speed_label = GTK_LABEL (gtk_builder_get_object (CE_PAGE (self)->builder, "speed_label"));
+ self->strength_heading_label = GTK_LABEL (gtk_builder_get_object (CE_PAGE (self)->builder,
"strength_heading_label"));
+ self->strength_label = GTK_LABEL (gtk_builder_get_object (CE_PAGE (self)->builder,
"strength_label"));
+
+ self->editor = editor;
+ self->device = device;
+ self->ap = ap;
+
+ connect_details_page (self);
+
+ return CE_PAGE (self);
}
diff --git a/panels/network/connection-editor/ce-page-ethernet.c
b/panels/network/connection-editor/ce-page-ethernet.c
index 45e01c3c3..e53800797 100644
--- a/panels/network/connection-editor/ce-page-ethernet.c
+++ b/panels/network/connection-editor/ce-page-ethernet.c
@@ -34,69 +34,69 @@
G_DEFINE_TYPE (CEPageEthernet, ce_page_ethernet, CE_TYPE_PAGE)
static void
-mtu_changed (CEPageEthernet *page)
+mtu_changed (CEPageEthernet *self)
{
- if (gtk_spin_button_get_value_as_int (page->mtu) == 0)
- gtk_widget_hide (page->mtu_label);
+ if (gtk_spin_button_get_value_as_int (self->mtu) == 0)
+ gtk_widget_hide (self->mtu_label);
else
- gtk_widget_show (page->mtu_label);
+ gtk_widget_show (self->mtu_label);
}
static void
-mtu_output_cb (CEPageEthernet *page)
+mtu_output_cb (CEPageEthernet *self)
{
gint defvalue;
gint val;
g_autofree gchar *buf = NULL;
- val = gtk_spin_button_get_value_as_int (page->mtu);
- defvalue = ce_get_property_default (NM_SETTING (page->setting_wired), NM_SETTING_WIRED_MTU);
+ val = gtk_spin_button_get_value_as_int (self->mtu);
+ defvalue = ce_get_property_default (NM_SETTING (self->setting_wired), NM_SETTING_WIRED_MTU);
if (val == defvalue)
buf = g_strdup (_("automatic"));
else
buf = g_strdup_printf ("%d", val);
- if (strcmp (buf, gtk_entry_get_text (GTK_ENTRY (page->mtu))))
- gtk_entry_set_text (GTK_ENTRY (page->mtu), buf);
+ if (strcmp (buf, gtk_entry_get_text (GTK_ENTRY (self->mtu))))
+ gtk_entry_set_text (GTK_ENTRY (self->mtu), buf);
}
static void
-connect_ethernet_page (CEPageEthernet *page)
+connect_ethernet_page (CEPageEthernet *self)
{
- NMSettingWired *setting = page->setting_wired;
+ NMSettingWired *setting = self->setting_wired;
char **mac_list;
const char *s_mac_str;
const gchar *name;
const gchar *cloned_mac;
- name = nm_setting_connection_get_id (page->setting_connection);
- gtk_entry_set_text (page->name, name);
+ name = nm_setting_connection_get_id (self->setting_connection);
+ gtk_entry_set_text (self->name, name);
/* Device MAC address */
- mac_list = ce_page_get_mac_list (CE_PAGE (page)->client, NM_TYPE_DEVICE_ETHERNET,
+ mac_list = ce_page_get_mac_list (CE_PAGE (self)->client, NM_TYPE_DEVICE_ETHERNET,
NM_DEVICE_ETHERNET_PERMANENT_HW_ADDRESS);
s_mac_str = nm_setting_wired_get_mac_address (setting);
- ce_page_setup_mac_combo (page->device_mac, s_mac_str, mac_list);
+ ce_page_setup_mac_combo (self->device_mac, s_mac_str, mac_list);
g_strfreev (mac_list);
- g_signal_connect_swapped (page->device_mac, "changed", G_CALLBACK (ce_page_changed), page);
+ g_signal_connect_swapped (self->device_mac, "changed", G_CALLBACK (ce_page_changed), self);
/* Cloned MAC address */
cloned_mac = nm_setting_wired_get_cloned_mac_address (setting);
- ce_page_setup_cloned_mac_combo (page->cloned_mac, cloned_mac);
- g_signal_connect_swapped (page->cloned_mac, "changed", G_CALLBACK (ce_page_changed), page);
+ ce_page_setup_cloned_mac_combo (self->cloned_mac, cloned_mac);
+ g_signal_connect_swapped (self->cloned_mac, "changed", G_CALLBACK (ce_page_changed), self);
/* MTU */
- g_signal_connect_swapped (page->mtu, "output", G_CALLBACK (mtu_output_cb), page);
- gtk_spin_button_set_value (page->mtu, (gdouble) nm_setting_wired_get_mtu (setting));
- g_signal_connect_swapped (page->mtu, "value-changed", G_CALLBACK (mtu_changed), page);
- mtu_changed (page);
+ g_signal_connect_swapped (self->mtu, "output", G_CALLBACK (mtu_output_cb), self);
+ gtk_spin_button_set_value (self->mtu, (gdouble) nm_setting_wired_get_mtu (setting));
+ g_signal_connect_swapped (self->mtu, "value-changed", G_CALLBACK (mtu_changed), self);
+ mtu_changed (self);
- g_signal_connect_swapped (page->name, "changed", G_CALLBACK (ce_page_changed), page);
- g_signal_connect_swapped (page->mtu, "value-changed", G_CALLBACK (ce_page_changed), page);
+ g_signal_connect_swapped (self->name, "changed", G_CALLBACK (ce_page_changed), self);
+ g_signal_connect_swapped (self->mtu, "value-changed", G_CALLBACK (ce_page_changed), self);
}
static void
-ui_to_setting (CEPageEthernet *page)
+ui_to_setting (CEPageEthernet *self)
{
g_autofree gchar *device_mac = NULL;
g_autofree gchar *cloned_mac = NULL;
@@ -104,23 +104,23 @@ ui_to_setting (CEPageEthernet *page)
GtkWidget *entry;
GtkComboBoxText *combo;
- entry = gtk_bin_get_child (GTK_BIN (page->device_mac));
+ entry = gtk_bin_get_child (GTK_BIN (self->device_mac));
if (entry) {
text = gtk_entry_get_text (GTK_ENTRY (entry));
device_mac = ce_page_trim_address (text);
}
- combo = page->cloned_mac;
+ combo = self->cloned_mac;
cloned_mac = ce_page_cloned_mac_get (combo);
- g_object_set (page->setting_wired,
+ g_object_set (self->setting_wired,
NM_SETTING_WIRED_MAC_ADDRESS, device_mac,
NM_SETTING_WIRED_CLONED_MAC_ADDRESS, cloned_mac,
- NM_SETTING_WIRED_MTU, (guint32) gtk_spin_button_get_value_as_int (page->mtu),
+ NM_SETTING_WIRED_MTU, (guint32) gtk_spin_button_get_value_as_int (self->mtu),
NULL);
- g_object_set (page->setting_connection,
- NM_SETTING_CONNECTION_ID, gtk_entry_get_text (page->name),
+ g_object_set (self->setting_connection,
+ NM_SETTING_CONNECTION_ID, gtk_entry_get_text (self->name),
NULL);
}
@@ -162,7 +162,7 @@ validate (CEPage *page,
}
static void
-ce_page_ethernet_init (CEPageEthernet *page)
+ce_page_ethernet_init (CEPageEthernet *self)
{
}
@@ -178,24 +178,24 @@ CEPage *
ce_page_ethernet_new (NMConnection *connection,
NMClient *client)
{
- CEPageEthernet *page;
+ CEPageEthernet *self;
- page = CE_PAGE_ETHERNET (ce_page_new (CE_TYPE_PAGE_ETHERNET,
+ self = CE_PAGE_ETHERNET (ce_page_new (CE_TYPE_PAGE_ETHERNET,
connection,
client,
"/org/gnome/control-center/network/ethernet-page.ui",
_("Identity")));
- page->name = GTK_ENTRY (gtk_builder_get_object (CE_PAGE (page)->builder, "name_entry"));
- page->device_mac = GTK_COMBO_BOX_TEXT (gtk_builder_get_object (CE_PAGE (page)->builder,
"mac_combo"));
- page->cloned_mac = GTK_COMBO_BOX_TEXT (gtk_builder_get_object (CE_PAGE (page)->builder,
"cloned_mac_combo"));
- page->mtu = GTK_SPIN_BUTTON (gtk_builder_get_object (CE_PAGE (page)->builder, "mtu_spin"));
- page->mtu_label = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "mtu_label"));
+ self->name = GTK_ENTRY (gtk_builder_get_object (CE_PAGE (self)->builder, "name_entry"));
+ self->device_mac = GTK_COMBO_BOX_TEXT (gtk_builder_get_object (CE_PAGE (self)->builder,
"mac_combo"));
+ self->cloned_mac = GTK_COMBO_BOX_TEXT (gtk_builder_get_object (CE_PAGE (self)->builder,
"cloned_mac_combo"));
+ self->mtu = GTK_SPIN_BUTTON (gtk_builder_get_object (CE_PAGE (self)->builder, "mtu_spin"));
+ self->mtu_label = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (self)->builder, "mtu_label"));
- page->setting_connection = nm_connection_get_setting_connection (connection);
- page->setting_wired = nm_connection_get_setting_wired (connection);
+ self->setting_connection = nm_connection_get_setting_connection (connection);
+ self->setting_wired = nm_connection_get_setting_wired (connection);
- connect_ethernet_page (page);
+ connect_ethernet_page (self);
- return CE_PAGE (page);
+ return CE_PAGE (self);
}
diff --git a/panels/network/connection-editor/ce-page-ip4.c b/panels/network/connection-editor/ce-page-ip4.c
index add4e84e7..6f774404d 100644
--- a/panels/network/connection-editor/ce-page-ip4.c
+++ b/panels/network/connection-editor/ce-page-ip4.c
@@ -32,8 +32,8 @@
#include "ce-page-ip4.h"
#include "ui-helpers.h"
-static void ensure_empty_address_row (CEPageIP4 *page);
-static void ensure_empty_routes_row (CEPageIP4 *page);
+static void ensure_empty_address_row (CEPageIP4 *self);
+static void ensure_empty_routes_row (CEPageIP4 *self);
G_DEFINE_TYPE (CEPageIP4, ce_page_ip4, CE_TYPE_PAGE)
@@ -51,32 +51,32 @@ enum {
};
static void
-method_changed (CEPageIP4 *page)
+method_changed (CEPageIP4 *self)
{
gboolean addr_enabled;
gboolean dns_enabled;
gboolean routes_enabled;
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->disabled_radio))) {
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->disabled_radio))) {
addr_enabled = FALSE;
dns_enabled = FALSE;
routes_enabled = FALSE;
} else {
- addr_enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->manual_radio));
- dns_enabled = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->local_radio));
- routes_enabled = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->local_radio));
+ addr_enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->manual_radio));
+ dns_enabled = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->local_radio));
+ routes_enabled = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->local_radio));
}
- gtk_widget_set_visible (GTK_WIDGET (page->address_box), addr_enabled);
- gtk_widget_set_sensitive (GTK_WIDGET (page->dns_entry), dns_enabled);
- gtk_widget_set_sensitive (GTK_WIDGET (page->routes_list), routes_enabled);
- gtk_widget_set_sensitive (GTK_WIDGET (page->never_default_check), routes_enabled);
+ gtk_widget_set_visible (GTK_WIDGET (self->address_box), addr_enabled);
+ gtk_widget_set_sensitive (GTK_WIDGET (self->dns_entry), dns_enabled);
+ gtk_widget_set_sensitive (GTK_WIDGET (self->routes_list), routes_enabled);
+ gtk_widget_set_sensitive (GTK_WIDGET (self->never_default_check), routes_enabled);
- ce_page_changed (CE_PAGE (page));
+ ce_page_changed (CE_PAGE (self));
}
static void
-update_row_sensitivity (CEPageIP4 *page, GtkWidget *list)
+update_row_sensitivity (CEPageIP4 *self, GtkWidget *list)
{
GList *children, *l;
gint rows = 0, i = 0;
@@ -102,12 +102,12 @@ update_row_sensitivity (CEPageIP4 *page, GtkWidget *list)
}
static void
-update_row_gateway_sensitivity (CEPageIP4 *page)
+update_row_gateway_sensitivity (CEPageIP4 *self)
{
GList *children, *l;
gint rows = 0;
- children = gtk_container_get_children (GTK_CONTAINER (page->address_list));
+ children = gtk_container_get_children (GTK_CONTAINER (self->address_list));
for (l = children; l; l = l->next) {
GtkWidget *row = l->data;
GtkWidget *entry;
@@ -122,23 +122,23 @@ update_row_gateway_sensitivity (CEPageIP4 *page)
}
static void
-remove_row (CEPageIP4 *page)
+remove_row (CEPageIP4 *self)
{
GtkWidget *list;
GtkWidget *row;
GtkWidget *row_box;
- row_box = gtk_widget_get_parent (GTK_WIDGET (CE_PAGE (page)->page));
+ row_box = gtk_widget_get_parent (GTK_WIDGET (CE_PAGE (self)->page));
row = gtk_widget_get_parent (row_box);
list = gtk_widget_get_parent (row);
gtk_container_remove (GTK_CONTAINER (list), row);
- ce_page_changed (CE_PAGE (page));
+ ce_page_changed (CE_PAGE (self));
- update_row_sensitivity (page, list);
- if (list == page->address_list)
- update_row_gateway_sensitivity (page);
+ update_row_sensitivity (self, list);
+ if (list == self->address_list)
+ update_row_gateway_sensitivity (self);
}
static gboolean
@@ -187,7 +187,7 @@ sort_first_last (gconstpointer a, gconstpointer b, gpointer data)
}
static void
-add_address_row (CEPageIP4 *page,
+add_address_row (CEPageIP4 *self,
const gchar *address,
const gchar *network,
const gchar *gateway)
@@ -204,8 +204,8 @@ add_address_row (CEPageIP4 *page,
gtk_style_context_add_class (gtk_widget_get_style_context (row_box), "linked");
widget = gtk_entry_new ();
- g_signal_connect_swapped (widget, "changed", G_CALLBACK (ce_page_changed), page);
- g_signal_connect_swapped (widget, "activate", G_CALLBACK (ensure_empty_address_row), page);
+ g_signal_connect_swapped (widget, "changed", G_CALLBACK (ce_page_changed), self);
+ g_signal_connect_swapped (widget, "activate", G_CALLBACK (ensure_empty_address_row), self);
g_object_set_data (G_OBJECT (row), "address", widget);
gtk_entry_set_text (GTK_ENTRY (widget), address);
gtk_entry_set_width_chars (GTK_ENTRY (widget), 16);
@@ -213,8 +213,8 @@ add_address_row (CEPageIP4 *page,
gtk_container_add (GTK_CONTAINER (row_box), widget);
widget = gtk_entry_new ();
- g_signal_connect_swapped (widget, "changed", G_CALLBACK (ce_page_changed), page);
- g_signal_connect_swapped (widget, "activate", G_CALLBACK (ensure_empty_address_row), page);
+ g_signal_connect_swapped (widget, "changed", G_CALLBACK (ce_page_changed), self);
+ g_signal_connect_swapped (widget, "activate", G_CALLBACK (ensure_empty_address_row), self);
g_object_set_data (G_OBJECT (row), "network", widget);
gtk_entry_set_text (GTK_ENTRY (widget), network);
gtk_entry_set_width_chars (GTK_ENTRY (widget), 16);
@@ -222,8 +222,8 @@ add_address_row (CEPageIP4 *page,
gtk_container_add (GTK_CONTAINER (row_box), widget);
widget = gtk_entry_new ();
- g_signal_connect_swapped (widget, "changed", G_CALLBACK (ce_page_changed), page);
- g_signal_connect_swapped (widget, "activate", G_CALLBACK (ensure_empty_address_row), page);
+ g_signal_connect_swapped (widget, "changed", G_CALLBACK (ce_page_changed), self);
+ g_signal_connect_swapped (widget, "activate", G_CALLBACK (ensure_empty_address_row), self);
g_object_set_data (G_OBJECT (row), "gateway", widget);
gtk_entry_set_text (GTK_ENTRY (widget), gateway ? gateway : "");
gtk_entry_set_width_chars (GTK_ENTRY (widget), 16);
@@ -233,29 +233,29 @@ add_address_row (CEPageIP4 *page,
delete_button = gtk_button_new ();
gtk_widget_set_sensitive (delete_button, FALSE);
gtk_style_context_add_class (gtk_widget_get_style_context (delete_button), "image-button");
- g_signal_connect_swapped (delete_button, "clicked", G_CALLBACK (remove_row), page);
+ g_signal_connect_swapped (delete_button, "clicked", G_CALLBACK (remove_row), self);
image = gtk_image_new_from_icon_name ("edit-delete-symbolic", GTK_ICON_SIZE_MENU);
atk_object_set_name (gtk_widget_get_accessible (delete_button), _("Delete Address"));
gtk_button_set_image (GTK_BUTTON (delete_button), image);
gtk_container_add (GTK_CONTAINER (row_box), delete_button);
g_object_set_data (G_OBJECT (row), "delete-button", delete_button);
- gtk_size_group_add_widget (page->address_sizegroup, delete_button);
+ gtk_size_group_add_widget (self->address_sizegroup, delete_button);
gtk_container_add (GTK_CONTAINER (row), row_box);
gtk_widget_show_all (row);
- gtk_container_add (GTK_CONTAINER (page->address_list), row);
+ gtk_container_add (GTK_CONTAINER (self->address_list), row);
- update_row_gateway_sensitivity (page);
- update_row_sensitivity (page, page->address_list);
+ update_row_gateway_sensitivity (self);
+ update_row_sensitivity (self, self->address_list);
}
static void
-ensure_empty_address_row (CEPageIP4 *page)
+ensure_empty_address_row (CEPageIP4 *self)
{
GList *children, *l;
- children = gtk_container_get_children (GTK_CONTAINER (page->address_list));
+ children = gtk_container_get_children (GTK_CONTAINER (self->address_list));
l = children;
while (l && l->next)
@@ -263,61 +263,61 @@ ensure_empty_address_row (CEPageIP4 *page)
/* Add the last, stub row if needed*/
if (!l || validate_row (l->data))
- add_address_row (page, "", "", "");
+ add_address_row (self, "", "", "");
g_list_free (children);
}
static void
-add_address_box (CEPageIP4 *page)
+add_address_box (CEPageIP4 *self)
{
GtkWidget *list;
gint i;
- page->address_list = list = gtk_list_box_new ();
+ self->address_list = list = gtk_list_box_new ();
gtk_list_box_set_selection_mode (GTK_LIST_BOX (list), GTK_SELECTION_NONE);
gtk_list_box_set_header_func (GTK_LIST_BOX (list), cc_list_box_update_header_func, NULL, NULL);
gtk_list_box_set_sort_func (GTK_LIST_BOX (list), (GtkListBoxSortFunc)sort_first_last, NULL, NULL);
- gtk_container_add (GTK_CONTAINER (page->address_box), list);
+ gtk_container_add (GTK_CONTAINER (self->address_box), list);
- for (i = 0; i < nm_setting_ip_config_get_num_addresses (page->setting); i++) {
+ for (i = 0; i < nm_setting_ip_config_get_num_addresses (self->setting); i++) {
NMIPAddress *addr;
struct in_addr tmp_addr;
gchar network[INET_ADDRSTRLEN + 1];
- addr = nm_setting_ip_config_get_address (page->setting, i);
+ addr = nm_setting_ip_config_get_address (self->setting, i);
if (!addr)
continue;
tmp_addr.s_addr = nm_utils_ip4_prefix_to_netmask (nm_ip_address_get_prefix (addr));
(void) inet_ntop (AF_INET, &tmp_addr, &network[0], sizeof (network));
- add_address_row (page,
+ add_address_row (self,
nm_ip_address_get_address (addr),
network,
- i == 0 ? nm_setting_ip_config_get_gateway (page->setting) : "");
+ i == 0 ? nm_setting_ip_config_get_gateway (self->setting) : "");
}
- if (nm_setting_ip_config_get_num_addresses (page->setting) == 0)
- ensure_empty_address_row (page);
+ if (nm_setting_ip_config_get_num_addresses (self->setting) == 0)
+ ensure_empty_address_row (self);
- gtk_widget_show_all (GTK_WIDGET (page->address_box));
+ gtk_widget_show_all (GTK_WIDGET (self->address_box));
}
static void
-add_dns_section (CEPageIP4 *page)
+add_dns_section (CEPageIP4 *self)
{
GString *string;
gint i;
- gtk_switch_set_active (page->auto_dns_switch, !nm_setting_ip_config_get_ignore_auto_dns
(page->setting));
- g_signal_connect_swapped (page->auto_dns_switch, "notify::active", G_CALLBACK (ce_page_changed),
page);
+ gtk_switch_set_active (self->auto_dns_switch, !nm_setting_ip_config_get_ignore_auto_dns
(self->setting));
+ g_signal_connect_swapped (self->auto_dns_switch, "notify::active", G_CALLBACK (ce_page_changed),
self);
string = g_string_new ("");
- for (i = 0; i < nm_setting_ip_config_get_num_dns (page->setting); i++) {
+ for (i = 0; i < nm_setting_ip_config_get_num_dns (self->setting); i++) {
const char *address;
- address = nm_setting_ip_config_get_dns (page->setting, i);
+ address = nm_setting_ip_config_get_dns (self->setting, i);
if (i > 0)
g_string_append (string, ", ");
@@ -325,15 +325,15 @@ add_dns_section (CEPageIP4 *page)
g_string_append (string, address);
}
- gtk_entry_set_text (page->dns_entry, string->str);
+ gtk_entry_set_text (self->dns_entry, string->str);
- g_signal_connect_swapped (page->dns_entry, "notify::text", G_CALLBACK (ce_page_changed), page);
+ g_signal_connect_swapped (self->dns_entry, "notify::text", G_CALLBACK (ce_page_changed), self);
g_string_free (string, TRUE);
}
static void
-add_route_row (CEPageIP4 *page,
+add_route_row (CEPageIP4 *self,
const gchar *address,
const gchar *netmask,
const gchar *gateway,
@@ -351,8 +351,8 @@ add_route_row (CEPageIP4 *page,
gtk_style_context_add_class (gtk_widget_get_style_context (row_box), "linked");
widget = gtk_entry_new ();
- g_signal_connect_swapped (widget, "changed", G_CALLBACK (ce_page_changed), page);
- g_signal_connect_swapped (widget, "activate", G_CALLBACK (ensure_empty_routes_row), page);
+ g_signal_connect_swapped (widget, "changed", G_CALLBACK (ce_page_changed), self);
+ g_signal_connect_swapped (widget, "activate", G_CALLBACK (ensure_empty_routes_row), self);
g_object_set_data (G_OBJECT (row), "address", widget);
gtk_entry_set_text (GTK_ENTRY (widget), address);
gtk_entry_set_width_chars (GTK_ENTRY (widget), 16);
@@ -360,8 +360,8 @@ add_route_row (CEPageIP4 *page,
gtk_container_add (GTK_CONTAINER (row_box), widget);
widget = gtk_entry_new ();
- g_signal_connect_swapped (widget, "changed", G_CALLBACK (ce_page_changed), page);
- g_signal_connect_swapped (widget, "activate", G_CALLBACK (ensure_empty_routes_row), page);
+ g_signal_connect_swapped (widget, "changed", G_CALLBACK (ce_page_changed), self);
+ g_signal_connect_swapped (widget, "activate", G_CALLBACK (ensure_empty_routes_row), self);
g_object_set_data (G_OBJECT (row), "netmask", widget);
gtk_entry_set_text (GTK_ENTRY (widget), netmask);
gtk_entry_set_width_chars (GTK_ENTRY (widget), 16);
@@ -369,8 +369,8 @@ add_route_row (CEPageIP4 *page,
gtk_container_add (GTK_CONTAINER (row_box), widget);
widget = gtk_entry_new ();
- g_signal_connect_swapped (widget, "changed", G_CALLBACK (ce_page_changed), page);
- g_signal_connect_swapped (widget, "activate", G_CALLBACK (ensure_empty_routes_row), page);
+ g_signal_connect_swapped (widget, "changed", G_CALLBACK (ce_page_changed), self);
+ g_signal_connect_swapped (widget, "activate", G_CALLBACK (ensure_empty_routes_row), self);
g_object_set_data (G_OBJECT (row), "gateway", widget);
gtk_entry_set_text (GTK_ENTRY (widget), gateway ? gateway : "");
gtk_entry_set_width_chars (GTK_ENTRY (widget), 16);
@@ -378,8 +378,8 @@ add_route_row (CEPageIP4 *page,
gtk_container_add (GTK_CONTAINER (row_box), widget);
widget = gtk_entry_new ();
- g_signal_connect_swapped (widget, "changed", G_CALLBACK (ce_page_changed), page);
- g_signal_connect_swapped (widget, "activate", G_CALLBACK (ensure_empty_routes_row), page);
+ g_signal_connect_swapped (widget, "changed", G_CALLBACK (ce_page_changed), self);
+ g_signal_connect_swapped (widget, "activate", G_CALLBACK (ensure_empty_routes_row), self);
g_object_set_data (G_OBJECT (row), "metric", widget);
if (metric >= 0) {
g_autofree gchar *s = g_strdup_printf ("%d", metric);
@@ -389,11 +389,11 @@ add_route_row (CEPageIP4 *page,
gtk_widget_set_hexpand (widget, TRUE);
gtk_container_add (GTK_CONTAINER (row_box), widget);
- gtk_size_group_add_widget (page->routes_metric_sizegroup, widget);
+ gtk_size_group_add_widget (self->routes_metric_sizegroup, widget);
delete_button = gtk_button_new ();
gtk_style_context_add_class (gtk_widget_get_style_context (delete_button), "image-button");
- g_signal_connect_swapped (delete_button, "clicked", G_CALLBACK (remove_row), page);
+ g_signal_connect_swapped (delete_button, "clicked", G_CALLBACK (remove_row), self);
image = gtk_image_new_from_icon_name ("edit-delete-symbolic", GTK_ICON_SIZE_MENU);
atk_object_set_name (gtk_widget_get_accessible (delete_button), _("Delete Route"));
gtk_button_set_image (GTK_BUTTON (delete_button), image);
@@ -402,21 +402,21 @@ add_route_row (CEPageIP4 *page,
gtk_container_add (GTK_CONTAINER (row_box), delete_button);
g_object_set_data (G_OBJECT (row), "delete-button", delete_button);
- gtk_size_group_add_widget (page->routes_sizegroup, delete_button);
+ gtk_size_group_add_widget (self->routes_sizegroup, delete_button);
gtk_container_add (GTK_CONTAINER (row), row_box);
gtk_widget_show_all (row);
- gtk_container_add (GTK_CONTAINER (page->routes_list), row);
+ gtk_container_add (GTK_CONTAINER (self->routes_list), row);
- update_row_sensitivity (page, page->routes_list);
+ update_row_sensitivity (self, self->routes_list);
}
static void
-ensure_empty_routes_row (CEPageIP4 *page)
+ensure_empty_routes_row (CEPageIP4 *self)
{
GList *children, *l;
- children = gtk_container_get_children (GTK_CONTAINER (page->routes_list));
+ children = gtk_container_get_children (GTK_CONTAINER (self->routes_list));
l = children;
while (l && l->next)
@@ -424,48 +424,48 @@ ensure_empty_routes_row (CEPageIP4 *page)
/* Add the last, stub row if needed*/
if (!l || validate_row (l->data))
- add_route_row (page, "", "", "", -1);
+ add_route_row (self, "", "", "", -1);
g_list_free (children);
}
static void
-add_routes_box (CEPageIP4 *page)
+add_routes_box (CEPageIP4 *self)
{
GtkWidget *list;
gint i;
- page->routes_list = list = gtk_list_box_new ();
+ self->routes_list = list = gtk_list_box_new ();
gtk_list_box_set_selection_mode (GTK_LIST_BOX (list), GTK_SELECTION_NONE);
gtk_list_box_set_header_func (GTK_LIST_BOX (list), cc_list_box_update_header_func, NULL, NULL);
gtk_list_box_set_sort_func (GTK_LIST_BOX (list), (GtkListBoxSortFunc)sort_first_last, NULL, NULL);
- gtk_container_add (GTK_CONTAINER (page->routes_box), list);
- gtk_switch_set_active (page->auto_routes_switch, !nm_setting_ip_config_get_ignore_auto_routes
(page->setting));
- g_signal_connect_swapped (page->auto_routes_switch, "notify::active", G_CALLBACK (ce_page_changed),
page);
+ gtk_container_add (GTK_CONTAINER (self->routes_box), list);
+ gtk_switch_set_active (self->auto_routes_switch, !nm_setting_ip_config_get_ignore_auto_routes
(self->setting));
+ g_signal_connect_swapped (self->auto_routes_switch, "notify::active", G_CALLBACK (ce_page_changed),
self);
- for (i = 0; i < nm_setting_ip_config_get_num_routes (page->setting); i++) {
+ for (i = 0; i < nm_setting_ip_config_get_num_routes (self->setting); i++) {
NMIPRoute *route;
struct in_addr tmp_addr;
gchar netmask[INET_ADDRSTRLEN + 1];
- route = nm_setting_ip_config_get_route (page->setting, i);
+ route = nm_setting_ip_config_get_route (self->setting, i);
if (!route)
continue;
tmp_addr.s_addr = nm_utils_ip4_prefix_to_netmask (nm_ip_route_get_prefix (route));
(void) inet_ntop (AF_INET, &tmp_addr, &netmask[0], sizeof (netmask));
- add_route_row (page,
+ add_route_row (self,
nm_ip_route_get_dest (route),
netmask,
nm_ip_route_get_next_hop (route),
nm_ip_route_get_metric (route));
}
- if (nm_setting_ip_config_get_num_routes (page->setting) == 0)
- ensure_empty_routes_row (page);
+ if (nm_setting_ip_config_get_num_routes (self->setting) == 0)
+ ensure_empty_routes_row (self);
- gtk_widget_show_all (GTK_WIDGET (page->routes_box));
+ gtk_widget_show_all (GTK_WIDGET (self->routes_box));
}
enum
@@ -478,37 +478,37 @@ enum
};
static void
-connect_ip4_page (CEPageIP4 *page)
+connect_ip4_page (CEPageIP4 *self)
{
const gchar *str_method;
gboolean disabled;
guint method;
- page->address_box = GTK_BOX (gtk_builder_get_object (CE_PAGE (page)->builder, "address_box"));
- page->address_sizegroup = GTK_SIZE_GROUP (gtk_builder_get_object (CE_PAGE (page)->builder,
"address_sizegroup"));
- page->auto_dns_switch = GTK_SWITCH (gtk_builder_get_object (CE_PAGE (page)->builder,
"auto_dns_switch"));
- page->auto_routes_switch = GTK_SWITCH (gtk_builder_get_object (CE_PAGE (page)->builder,
"auto_routes_switch"));
- page->automatic_radio = GTK_RADIO_BUTTON (gtk_builder_get_object (CE_PAGE (page)->builder,
"automatic_radio"));
- page->content_box = GTK_BOX (gtk_builder_get_object (CE_PAGE (page)->builder, "content_box"));
- page->disabled_radio = GTK_RADIO_BUTTON (gtk_builder_get_object (CE_PAGE (page)->builder,
"disabled_radio"));
- page->dns_entry = GTK_ENTRY (gtk_builder_get_object (CE_PAGE (page)->builder, "dns_entry"));
- page->local_radio = GTK_RADIO_BUTTON (gtk_builder_get_object (CE_PAGE (page)->builder,
"local_radio"));
- page->manual_radio = GTK_RADIO_BUTTON (gtk_builder_get_object (CE_PAGE (page)->builder,
"manual_radio"));
- page->never_default_check = GTK_CHECK_BUTTON (gtk_builder_get_object (CE_PAGE (page)->builder,
"never_default_check"));
- page->routes_box = GTK_BOX (gtk_builder_get_object (CE_PAGE (page)->builder, "routes_box"));
- page->routes_metric_sizegroup = GTK_SIZE_GROUP (gtk_builder_get_object (CE_PAGE (page)->builder,
"routes_metric_sizegroup"));
- page->routes_sizegroup = GTK_SIZE_GROUP (gtk_builder_get_object (CE_PAGE (page)->builder,
"routes_sizegroup"));
-
- add_address_box (page);
- add_dns_section (page);
- add_routes_box (page);
-
- str_method = nm_setting_ip_config_get_method (page->setting);
+ self->address_box = GTK_BOX (gtk_builder_get_object (CE_PAGE (self)->builder, "address_box"));
+ self->address_sizegroup = GTK_SIZE_GROUP (gtk_builder_get_object (CE_PAGE (self)->builder,
"address_sizegroup"));
+ self->auto_dns_switch = GTK_SWITCH (gtk_builder_get_object (CE_PAGE (self)->builder,
"auto_dns_switch"));
+ self->auto_routes_switch = GTK_SWITCH (gtk_builder_get_object (CE_PAGE (self)->builder,
"auto_routes_switch"));
+ self->automatic_radio = GTK_RADIO_BUTTON (gtk_builder_get_object (CE_PAGE (self)->builder,
"automatic_radio"));
+ self->content_box = GTK_BOX (gtk_builder_get_object (CE_PAGE (self)->builder, "content_box"));
+ self->disabled_radio = GTK_RADIO_BUTTON (gtk_builder_get_object (CE_PAGE (self)->builder,
"disabled_radio"));
+ self->dns_entry = GTK_ENTRY (gtk_builder_get_object (CE_PAGE (self)->builder, "dns_entry"));
+ self->local_radio = GTK_RADIO_BUTTON (gtk_builder_get_object (CE_PAGE (self)->builder,
"local_radio"));
+ self->manual_radio = GTK_RADIO_BUTTON (gtk_builder_get_object (CE_PAGE (self)->builder,
"manual_radio"));
+ self->never_default_check = GTK_CHECK_BUTTON (gtk_builder_get_object (CE_PAGE (self)->builder,
"never_default_check"));
+ self->routes_box = GTK_BOX (gtk_builder_get_object (CE_PAGE (self)->builder, "routes_box"));
+ self->routes_metric_sizegroup = GTK_SIZE_GROUP (gtk_builder_get_object (CE_PAGE (self)->builder,
"routes_metric_sizegroup"));
+ self->routes_sizegroup = GTK_SIZE_GROUP (gtk_builder_get_object (CE_PAGE (self)->builder,
"routes_sizegroup"));
+
+ add_address_box (self);
+ add_dns_section (self);
+ add_routes_box (self);
+
+ str_method = nm_setting_ip_config_get_method (self->setting);
disabled = g_strcmp0 (str_method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED) == 0;
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->disabled_radio), disabled);
- g_signal_connect_swapped (page->disabled_radio, "notify::active", G_CALLBACK (ce_page_changed),
page);
- g_object_bind_property (page->disabled_radio, "active",
- page->content_box, "sensitive",
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->disabled_radio), disabled);
+ g_signal_connect_swapped (self->disabled_radio, "notify::active", G_CALLBACK (ce_page_changed),
self);
+ g_object_bind_property (self->disabled_radio, "active",
+ self->content_box, "sensitive",
G_BINDING_SYNC_CREATE | G_BINDING_INVERT_BOOLEAN);
method = IP4_METHOD_AUTO;
@@ -522,33 +522,33 @@ connect_ip4_page (CEPageIP4 *page)
method = IP4_METHOD_DISABLED;
}
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->never_default_check),
- nm_setting_ip_config_get_never_default (page->setting));
- g_signal_connect_swapped (page->never_default_check, "toggled", G_CALLBACK (ce_page_changed), page);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->never_default_check),
+ nm_setting_ip_config_get_never_default (self->setting));
+ g_signal_connect_swapped (self->never_default_check, "toggled", G_CALLBACK (ce_page_changed), self);
- g_signal_connect_swapped (page->automatic_radio, "toggled", G_CALLBACK (method_changed), page);
- g_signal_connect_swapped (page->local_radio, "toggled", G_CALLBACK (method_changed), page);
- g_signal_connect_swapped (page->manual_radio, "toggled", G_CALLBACK (method_changed), page);
- g_signal_connect_swapped (page->disabled_radio, "toggled", G_CALLBACK (method_changed), page);
+ g_signal_connect_swapped (self->automatic_radio, "toggled", G_CALLBACK (method_changed), self);
+ g_signal_connect_swapped (self->local_radio, "toggled", G_CALLBACK (method_changed), self);
+ g_signal_connect_swapped (self->manual_radio, "toggled", G_CALLBACK (method_changed), self);
+ g_signal_connect_swapped (self->disabled_radio, "toggled", G_CALLBACK (method_changed), self);
switch (method) {
case IP4_METHOD_AUTO:
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->automatic_radio), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->automatic_radio), TRUE);
break;
case IP4_METHOD_LINK_LOCAL:
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->local_radio), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->local_radio), TRUE);
break;
case IP4_METHOD_MANUAL:
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->manual_radio), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->manual_radio), TRUE);
break;
case IP4_METHOD_DISABLED:
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->disabled_radio), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->disabled_radio), TRUE);
break;
default:
break;
}
- method_changed (page);
+ method_changed (self);
}
static gboolean
@@ -578,7 +578,7 @@ parse_netmask (const char *str, guint32 *prefix)
}
static gboolean
-ui_to_setting (CEPageIP4 *page)
+ui_to_setting (CEPageIP4 *self)
{
const gchar *method;
gboolean ignore_auto_dns;
@@ -594,20 +594,20 @@ ui_to_setting (CEPageIP4 *page)
gchar *dns_text = NULL;
guint i;
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->disabled_radio))) {
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->disabled_radio))) {
method = NM_SETTING_IP4_CONFIG_METHOD_DISABLED;
} else {
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->automatic_radio)))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->automatic_radio)))
method = NM_SETTING_IP4_CONFIG_METHOD_AUTO;
- else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->local_radio)))
+ else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->local_radio)))
method = NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL;
- else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->manual_radio)))
+ else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->manual_radio)))
method = NM_SETTING_IP4_CONFIG_METHOD_MANUAL;
}
addresses = g_ptr_array_new_with_free_func ((GDestroyNotify) nm_ip_address_unref);
if (g_str_equal (method, NM_SETTING_IP4_CONFIG_METHOD_MANUAL))
- children = gtk_container_get_children (GTK_CONTAINER (page->address_list));
+ children = gtk_container_get_children (GTK_CONTAINER (self->address_list));
else
children = NULL;
@@ -674,7 +674,7 @@ ui_to_setting (CEPageIP4 *page)
g_ptr_array_add (addresses, addr);
if (!l || !l->next)
- ensure_empty_address_row (page);
+ ensure_empty_address_row (self);
}
g_list_free (children);
@@ -684,7 +684,7 @@ ui_to_setting (CEPageIP4 *page)
}
dns_servers = g_ptr_array_new_with_free_func (g_free);
- dns_text = g_strstrip (g_strdup (gtk_entry_get_text (GTK_ENTRY (page->dns_entry))));
+ dns_text = g_strstrip (g_strdup (gtk_entry_get_text (GTK_ENTRY (self->dns_entry))));
if (g_str_equal (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO) ||
g_str_equal (method, NM_SETTING_IP4_CONFIG_METHOD_MANUAL))
dns_addresses = g_strsplit_set (dns_text, ", ", -1);
@@ -701,11 +701,11 @@ ui_to_setting (CEPageIP4 *page)
if (!nm_utils_ipaddr_valid (AF_INET, text)) {
g_ptr_array_remove_range (dns_servers, 0, dns_servers->len);
- widget_set_error (GTK_WIDGET (page->dns_entry));
+ widget_set_error (GTK_WIDGET (self->dns_entry));
ret = FALSE;
break;
} else {
- widget_unset_error (GTK_WIDGET (page->dns_entry));
+ widget_unset_error (GTK_WIDGET (self->dns_entry));
g_ptr_array_add (dns_servers, g_strdup (text));
}
}
@@ -721,7 +721,7 @@ ui_to_setting (CEPageIP4 *page)
routes = g_ptr_array_new_with_free_func ((GDestroyNotify) nm_ip_route_unref);
if (g_str_equal (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO) ||
g_str_equal (method, NM_SETTING_IP4_CONFIG_METHOD_MANUAL))
- children = gtk_container_get_children (GTK_CONTAINER (page->routes_list));
+ children = gtk_container_get_children (GTK_CONTAINER (self->routes_list));
else
children = NULL;
@@ -793,7 +793,7 @@ ui_to_setting (CEPageIP4 *page)
g_ptr_array_add (routes, route);
if (!l || !l->next)
- ensure_empty_routes_row (page);
+ ensure_empty_routes_row (self);
}
g_list_free (children);
@@ -805,11 +805,11 @@ ui_to_setting (CEPageIP4 *page)
if (!ret)
goto out;
- ignore_auto_dns = !gtk_switch_get_active (page->auto_dns_switch);
- ignore_auto_routes = !gtk_switch_get_active (page->auto_routes_switch);
- never_default = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->never_default_check));
+ ignore_auto_dns = !gtk_switch_get_active (self->auto_dns_switch);
+ ignore_auto_routes = !gtk_switch_get_active (self->auto_routes_switch);
+ never_default = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->never_default_check));
- g_object_set (page->setting,
+ g_object_set (self->setting,
NM_SETTING_IP_CONFIG_METHOD, method,
NM_SETTING_IP_CONFIG_ADDRESSES, addresses,
NM_SETTING_IP_CONFIG_GATEWAY, default_gateway,
@@ -836,18 +836,18 @@ out:
}
static gboolean
-validate (CEPage *page,
+validate (CEPage *self,
NMConnection *connection,
GError **error)
{
- if (!ui_to_setting (CE_PAGE_IP4 (page)))
+ if (!ui_to_setting (CE_PAGE_IP4 (self)))
return FALSE;
- return nm_setting_verify (NM_SETTING (CE_PAGE_IP4 (page)->setting), NULL, error);
+ return nm_setting_verify (NM_SETTING (CE_PAGE_IP4 (self)->setting), NULL, error);
}
static void
-ce_page_ip4_init (CEPageIP4 *page)
+ce_page_ip4_init (CEPageIP4 *self)
{
}
@@ -863,21 +863,21 @@ CEPage *
ce_page_ip4_new (NMConnection *connection,
NMClient *client)
{
- CEPageIP4 *page;
+ CEPageIP4 *self;
- page = CE_PAGE_IP4 (ce_page_new (CE_TYPE_PAGE_IP4,
+ self = CE_PAGE_IP4 (ce_page_new (CE_TYPE_PAGE_IP4,
connection,
client,
"/org/gnome/control-center/network/ip4-page.ui",
_("IPv4")));
- page->setting = nm_connection_get_setting_ip4_config (connection);
- if (!page->setting) {
- page->setting = NM_SETTING_IP_CONFIG (nm_setting_ip4_config_new ());
- nm_connection_add_setting (connection, NM_SETTING (page->setting));
+ self->setting = nm_connection_get_setting_ip4_config (connection);
+ if (!self->setting) {
+ self->setting = NM_SETTING_IP_CONFIG (nm_setting_ip4_config_new ());
+ nm_connection_add_setting (connection, NM_SETTING (self->setting));
}
- connect_ip4_page (page);
+ connect_ip4_page (self);
- return CE_PAGE (page);
+ return CE_PAGE (self);
}
diff --git a/panels/network/connection-editor/ce-page-ip6.c b/panels/network/connection-editor/ce-page-ip6.c
index 524c1e285..95e063a2f 100644
--- a/panels/network/connection-editor/ce-page-ip6.c
+++ b/panels/network/connection-editor/ce-page-ip6.c
@@ -32,8 +32,8 @@
#include "ce-page-ip6.h"
#include "ui-helpers.h"
-static void ensure_empty_address_row (CEPageIP6 *page);
-static void ensure_empty_routes_row (CEPageIP6 *page);
+static void ensure_empty_address_row (CEPageIP6 *self);
+static void ensure_empty_routes_row (CEPageIP6 *self);
G_DEFINE_TYPE (CEPageIP6, ce_page_ip6, CE_TYPE_PAGE)
@@ -52,32 +52,32 @@ enum {
};
static void
-method_changed (CEPageIP6 *page)
+method_changed (CEPageIP6 *self)
{
gboolean addr_enabled;
gboolean dns_enabled;
gboolean routes_enabled;
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->disabled_radio))) {
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->disabled_radio))) {
addr_enabled = FALSE;
dns_enabled = FALSE;
routes_enabled = FALSE;
} else {
- addr_enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->manual_radio));
- dns_enabled = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->local_radio));
- routes_enabled = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->local_radio));
+ addr_enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->manual_radio));
+ dns_enabled = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->local_radio));
+ routes_enabled = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->local_radio));
}
- gtk_widget_set_visible (GTK_WIDGET (page->address_box), addr_enabled);
- gtk_widget_set_sensitive (GTK_WIDGET (page->dns_entry), dns_enabled);
- gtk_widget_set_sensitive (GTK_WIDGET (page->routes_list), routes_enabled);
- gtk_widget_set_sensitive (GTK_WIDGET (page->never_default_check), routes_enabled);
+ gtk_widget_set_visible (GTK_WIDGET (self->address_box), addr_enabled);
+ gtk_widget_set_sensitive (GTK_WIDGET (self->dns_entry), dns_enabled);
+ gtk_widget_set_sensitive (GTK_WIDGET (self->routes_list), routes_enabled);
+ gtk_widget_set_sensitive (GTK_WIDGET (self->never_default_check), routes_enabled);
- ce_page_changed (CE_PAGE (page));
+ ce_page_changed (CE_PAGE (self));
}
static void
-update_row_sensitivity (CEPageIP6 *page, GtkWidget *list)
+update_row_sensitivity (CEPageIP6 *self, GtkWidget *list)
{
GList *children, *l;
gint rows = 0, i = 0;
@@ -103,21 +103,21 @@ update_row_sensitivity (CEPageIP6 *page, GtkWidget *list)
}
static void
-remove_row (CEPageIP6 *page)
+remove_row (CEPageIP6 *self)
{
GtkWidget *row;
GtkWidget *row_box;
GtkWidget *list;
- row_box = gtk_widget_get_parent (GTK_WIDGET (CE_PAGE (page)->page));
+ row_box = gtk_widget_get_parent (GTK_WIDGET (CE_PAGE (self)->page));
row = gtk_widget_get_parent (row_box);
list = gtk_widget_get_parent (row);
gtk_container_remove (GTK_CONTAINER (list), row);
- ce_page_changed (CE_PAGE (page));
+ ce_page_changed (CE_PAGE (self));
- update_row_sensitivity (page, list);
+ update_row_sensitivity (self, list);
}
static gboolean
@@ -166,7 +166,7 @@ sort_first_last (gconstpointer a, gconstpointer b, gpointer data)
}
static void
-add_address_row (CEPageIP6 *page,
+add_address_row (CEPageIP6 *self,
const gchar *address,
const gchar *network,
const gchar *gateway)
@@ -183,8 +183,8 @@ add_address_row (CEPageIP6 *page,
gtk_style_context_add_class (gtk_widget_get_style_context (row_box), "linked");
widget = gtk_entry_new ();
- g_signal_connect_swapped (widget, "changed", G_CALLBACK (ce_page_changed), page);
- g_signal_connect_swapped (widget, "activate", G_CALLBACK (ensure_empty_address_row), page);
+ g_signal_connect_swapped (widget, "changed", G_CALLBACK (ce_page_changed), self);
+ g_signal_connect_swapped (widget, "activate", G_CALLBACK (ensure_empty_address_row), self);
g_object_set_data (G_OBJECT (row), "address", widget);
gtk_entry_set_text (GTK_ENTRY (widget), address);
gtk_entry_set_width_chars (GTK_ENTRY (widget), 16);
@@ -192,8 +192,8 @@ add_address_row (CEPageIP6 *page,
gtk_container_add (GTK_CONTAINER (row_box), widget);
widget = gtk_entry_new ();
- g_signal_connect_swapped (widget, "changed", G_CALLBACK (ce_page_changed), page);
- g_signal_connect_swapped (widget, "activate", G_CALLBACK (ensure_empty_address_row), page);
+ g_signal_connect_swapped (widget, "changed", G_CALLBACK (ce_page_changed), self);
+ g_signal_connect_swapped (widget, "activate", G_CALLBACK (ensure_empty_address_row), self);
g_object_set_data (G_OBJECT (row), "prefix", widget);
gtk_entry_set_text (GTK_ENTRY (widget), network);
gtk_entry_set_width_chars (GTK_ENTRY (widget), 16);
@@ -201,8 +201,8 @@ add_address_row (CEPageIP6 *page,
gtk_container_add (GTK_CONTAINER (row_box), widget);
widget = gtk_entry_new ();
- g_signal_connect_swapped (widget, "changed", G_CALLBACK (ce_page_changed), page);
- g_signal_connect_swapped (widget, "activate", G_CALLBACK (ensure_empty_address_row), page);
+ g_signal_connect_swapped (widget, "changed", G_CALLBACK (ce_page_changed), self);
+ g_signal_connect_swapped (widget, "activate", G_CALLBACK (ensure_empty_address_row), self);
g_object_set_data (G_OBJECT (row), "gateway", widget);
gtk_entry_set_text (GTK_ENTRY (widget), gateway ? gateway : "");
gtk_entry_set_width_chars (GTK_ENTRY (widget), 16);
@@ -212,28 +212,28 @@ add_address_row (CEPageIP6 *page,
delete_button = gtk_button_new ();
gtk_widget_set_sensitive (delete_button, FALSE);
gtk_style_context_add_class (gtk_widget_get_style_context (delete_button), "image-button");
- g_signal_connect_swapped (delete_button, "clicked", G_CALLBACK (remove_row), page);
+ g_signal_connect_swapped (delete_button, "clicked", G_CALLBACK (remove_row), self);
image = gtk_image_new_from_icon_name ("edit-delete-symbolic", GTK_ICON_SIZE_MENU);
atk_object_set_name (gtk_widget_get_accessible (delete_button), _("Delete Address"));
gtk_button_set_image (GTK_BUTTON (delete_button), image);
gtk_container_add (GTK_CONTAINER (row_box), delete_button);
g_object_set_data (G_OBJECT (row), "delete-button", delete_button);
- gtk_size_group_add_widget (page->address_sizegroup, delete_button);
+ gtk_size_group_add_widget (self->address_sizegroup, delete_button);
gtk_container_add (GTK_CONTAINER (row), row_box);
gtk_widget_show_all (row);
- gtk_container_add (GTK_CONTAINER (page->address_list), row);
+ gtk_container_add (GTK_CONTAINER (self->address_list), row);
- update_row_sensitivity (page, page->address_list);
+ update_row_sensitivity (self, self->address_list);
}
static void
-ensure_empty_address_row (CEPageIP6 *page)
+ensure_empty_address_row (CEPageIP6 *self)
{
GList *children, *l;
- children = gtk_container_get_children (GTK_CONTAINER (page->address_list));
+ children = gtk_container_get_children (GTK_CONTAINER (self->address_list));
l = children;
while (l && l->next)
@@ -241,53 +241,53 @@ ensure_empty_address_row (CEPageIP6 *page)
/* Add the last, stub row if needed*/
if (!l || validate_row (l->data))
- add_address_row (page, "", "", "");
+ add_address_row (self, "", "", "");
g_list_free (children);
}
static void
-add_address_box (CEPageIP6 *page)
+add_address_box (CEPageIP6 *self)
{
GtkWidget *list;
gint i;
- page->address_list = list = gtk_list_box_new ();
+ self->address_list = list = gtk_list_box_new ();
gtk_list_box_set_selection_mode (GTK_LIST_BOX (list), GTK_SELECTION_NONE);
gtk_list_box_set_header_func (GTK_LIST_BOX (list), cc_list_box_update_header_func, NULL, NULL);
gtk_list_box_set_sort_func (GTK_LIST_BOX (list), (GtkListBoxSortFunc)sort_first_last, NULL, NULL);
- gtk_container_add (GTK_CONTAINER (page->address_box), list);
+ gtk_container_add (GTK_CONTAINER (self->address_box), list);
- for (i = 0; i < nm_setting_ip_config_get_num_addresses (page->setting); i++) {
+ for (i = 0; i < nm_setting_ip_config_get_num_addresses (self->setting); i++) {
NMIPAddress *addr;
g_autofree gchar *netmask = NULL;
- addr = nm_setting_ip_config_get_address (page->setting, i);
+ addr = nm_setting_ip_config_get_address (self->setting, i);
netmask = g_strdup_printf ("%u", nm_ip_address_get_prefix (addr));
- add_address_row (page, nm_ip_address_get_address (addr), netmask,
- i == 0 ? nm_setting_ip_config_get_gateway (page->setting) : NULL);
+ add_address_row (self, nm_ip_address_get_address (addr), netmask,
+ i == 0 ? nm_setting_ip_config_get_gateway (self->setting) : NULL);
}
- if (nm_setting_ip_config_get_num_addresses (page->setting) == 0)
- ensure_empty_address_row (page);
+ if (nm_setting_ip_config_get_num_addresses (self->setting) == 0)
+ ensure_empty_address_row (self);
- gtk_widget_show_all (GTK_WIDGET (page->address_box));
+ gtk_widget_show_all (GTK_WIDGET (self->address_box));
}
static void
-add_dns_section (CEPageIP6 *page)
+add_dns_section (CEPageIP6 *self)
{
GString *string;
gint i;
- gtk_switch_set_active (page->auto_dns_switch, !nm_setting_ip_config_get_ignore_auto_dns
(page->setting));
- g_signal_connect_swapped (page->auto_dns_switch, "notify::active", G_CALLBACK (ce_page_changed),
page);
+ gtk_switch_set_active (self->auto_dns_switch, !nm_setting_ip_config_get_ignore_auto_dns
(self->setting));
+ g_signal_connect_swapped (self->auto_dns_switch, "notify::active", G_CALLBACK (ce_page_changed),
self);
string = g_string_new ("");
- for (i = 0; i < nm_setting_ip_config_get_num_dns (page->setting); i++) {
+ for (i = 0; i < nm_setting_ip_config_get_num_dns (self->setting); i++) {
const char *address;
- address = nm_setting_ip_config_get_dns (page->setting, i);
+ address = nm_setting_ip_config_get_dns (self->setting, i);
if (i > 0)
g_string_append (string, ", ");
@@ -296,15 +296,15 @@ add_dns_section (CEPageIP6 *page)
}
- gtk_entry_set_text (page->dns_entry, string->str);
+ gtk_entry_set_text (self->dns_entry, string->str);
- g_signal_connect_swapped (page->dns_entry, "notify::text", G_CALLBACK (ce_page_changed), page);
+ g_signal_connect_swapped (self->dns_entry, "notify::text", G_CALLBACK (ce_page_changed), self);
g_string_free (string, TRUE);
}
static void
-add_route_row (CEPageIP6 *page,
+add_route_row (CEPageIP6 *self,
const gchar *address,
const gchar *prefix,
const gchar *gateway,
@@ -322,8 +322,8 @@ add_route_row (CEPageIP6 *page,
gtk_style_context_add_class (gtk_widget_get_style_context (row_box), "linked");
widget = gtk_entry_new ();
- g_signal_connect_swapped (widget, "changed", G_CALLBACK (ce_page_changed), page);
- g_signal_connect_swapped (widget, "activate", G_CALLBACK (ensure_empty_routes_row), page);
+ g_signal_connect_swapped (widget, "changed", G_CALLBACK (ce_page_changed), self);
+ g_signal_connect_swapped (widget, "activate", G_CALLBACK (ensure_empty_routes_row), self);
g_object_set_data (G_OBJECT (row), "address", widget);
gtk_entry_set_text (GTK_ENTRY (widget), address);
gtk_entry_set_width_chars (GTK_ENTRY (widget), 16);
@@ -331,8 +331,8 @@ add_route_row (CEPageIP6 *page,
gtk_container_add (GTK_CONTAINER (row_box), widget);
widget = gtk_entry_new ();
- g_signal_connect_swapped (widget, "changed", G_CALLBACK (ce_page_changed), page);
- g_signal_connect_swapped (widget, "activate", G_CALLBACK (ensure_empty_routes_row), page);
+ g_signal_connect_swapped (widget, "changed", G_CALLBACK (ce_page_changed), self);
+ g_signal_connect_swapped (widget, "activate", G_CALLBACK (ensure_empty_routes_row), self);
g_object_set_data (G_OBJECT (row), "prefix", widget);
gtk_entry_set_text (GTK_ENTRY (widget), prefix ? prefix : "");
gtk_entry_set_width_chars (GTK_ENTRY (widget), 16);
@@ -340,8 +340,8 @@ add_route_row (CEPageIP6 *page,
gtk_container_add (GTK_CONTAINER (row_box), widget);
widget = gtk_entry_new ();
- g_signal_connect_swapped (widget, "changed", G_CALLBACK (ce_page_changed), page);
- g_signal_connect_swapped (widget, "activate", G_CALLBACK (ensure_empty_routes_row), page);
+ g_signal_connect_swapped (widget, "changed", G_CALLBACK (ce_page_changed), self);
+ g_signal_connect_swapped (widget, "activate", G_CALLBACK (ensure_empty_routes_row), self);
g_object_set_data (G_OBJECT (row), "gateway", widget);
gtk_entry_set_text (GTK_ENTRY (widget), gateway);
gtk_entry_set_width_chars (GTK_ENTRY (widget), 16);
@@ -349,19 +349,19 @@ add_route_row (CEPageIP6 *page,
gtk_container_add (GTK_CONTAINER (row_box), widget);
widget = gtk_entry_new ();
- g_signal_connect_swapped (widget, "changed", G_CALLBACK (ce_page_changed), page);
- g_signal_connect_swapped (widget, "activate", G_CALLBACK (ensure_empty_routes_row), page);
+ g_signal_connect_swapped (widget, "changed", G_CALLBACK (ce_page_changed), self);
+ g_signal_connect_swapped (widget, "activate", G_CALLBACK (ensure_empty_routes_row), self);
g_object_set_data (G_OBJECT (row), "metric", widget);
gtk_entry_set_text (GTK_ENTRY (widget), metric ? metric : "");
gtk_entry_set_width_chars (GTK_ENTRY (widget), 5);
gtk_widget_set_hexpand (widget, TRUE);
gtk_container_add (GTK_CONTAINER (row_box), widget);
- gtk_size_group_add_widget (page->routes_metric_sizegroup, widget);
+ gtk_size_group_add_widget (self->routes_metric_sizegroup, widget);
delete_button = gtk_button_new ();
gtk_style_context_add_class (gtk_widget_get_style_context (delete_button), "image-button");
- g_signal_connect_swapped (delete_button, "clicked", G_CALLBACK (remove_row), page);
+ g_signal_connect_swapped (delete_button, "clicked", G_CALLBACK (remove_row), self);
image = gtk_image_new_from_icon_name ("edit-delete-symbolic", GTK_ICON_SIZE_MENU);
atk_object_set_name (gtk_widget_get_accessible (delete_button), _("Delete Route"));
gtk_button_set_image (GTK_BUTTON (delete_button), image);
@@ -370,21 +370,21 @@ add_route_row (CEPageIP6 *page,
gtk_container_add (GTK_CONTAINER (row_box), delete_button);
g_object_set_data (G_OBJECT (row), "delete-button", delete_button);
- gtk_size_group_add_widget (page->routes_sizegroup, delete_button);
+ gtk_size_group_add_widget (self->routes_sizegroup, delete_button);
gtk_container_add (GTK_CONTAINER (row), row_box);
gtk_widget_show_all (row);
- gtk_container_add (GTK_CONTAINER (page->routes_list), row);
+ gtk_container_add (GTK_CONTAINER (self->routes_list), row);
- update_row_sensitivity (page, page->routes_list);
+ update_row_sensitivity (self, self->routes_list);
}
static void
-ensure_empty_routes_row (CEPageIP6 *page)
+ensure_empty_routes_row (CEPageIP6 *self)
{
GList *children, *l;
- children = gtk_container_get_children (GTK_CONTAINER (page->routes_list));
+ children = gtk_container_get_children (GTK_CONTAINER (self->routes_list));
l = children;
while (l && l->next)
@@ -392,83 +392,83 @@ ensure_empty_routes_row (CEPageIP6 *page)
/* Add the last, stub row if needed*/
if (!l || validate_row (l->data))
- add_route_row (page, "", NULL, "", NULL);
+ add_route_row (self, "", NULL, "", NULL);
g_list_free (children);
}
static void
-add_empty_route_row (CEPageIP6 *page)
+add_empty_route_row (CEPageIP6 *self)
{
- add_route_row (page, "", NULL, "", NULL);
+ add_route_row (self, "", NULL, "", NULL);
}
static void
-add_routes_box (CEPageIP6 *page)
+add_routes_box (CEPageIP6 *self)
{
GtkWidget *list;
gint i;
- page->routes_list = list = gtk_list_box_new ();
+ self->routes_list = list = gtk_list_box_new ();
gtk_list_box_set_selection_mode (GTK_LIST_BOX (list), GTK_SELECTION_NONE);
gtk_list_box_set_header_func (GTK_LIST_BOX (list), cc_list_box_update_header_func, NULL, NULL);
gtk_list_box_set_sort_func (GTK_LIST_BOX (list), (GtkListBoxSortFunc)sort_first_last, NULL, NULL);
- gtk_container_add (GTK_CONTAINER (page->routes_box), list);
- gtk_switch_set_active (page->auto_routes_switch, !nm_setting_ip_config_get_ignore_auto_routes
(page->setting));
- g_signal_connect_swapped (page->auto_routes_switch, "notify::active", G_CALLBACK (ce_page_changed),
page);
+ gtk_container_add (GTK_CONTAINER (self->routes_box), list);
+ gtk_switch_set_active (self->auto_routes_switch, !nm_setting_ip_config_get_ignore_auto_routes
(self->setting));
+ g_signal_connect_swapped (self->auto_routes_switch, "notify::active", G_CALLBACK (ce_page_changed),
self);
- for (i = 0; i < nm_setting_ip_config_get_num_routes (page->setting); i++) {
+ for (i = 0; i < nm_setting_ip_config_get_num_routes (self->setting); i++) {
NMIPRoute *route;
g_autofree gchar *prefix = NULL;
g_autofree gchar *metric = NULL;
- route = nm_setting_ip_config_get_route (page->setting, i);
+ route = nm_setting_ip_config_get_route (self->setting, i);
prefix = g_strdup_printf ("%u", nm_ip_route_get_prefix (route));
metric = g_strdup_printf ("%u", (guint32) MIN (0, nm_ip_route_get_metric (route)));
- add_route_row (page, nm_ip_route_get_dest (route),
+ add_route_row (self, nm_ip_route_get_dest (route),
prefix,
nm_ip_route_get_next_hop (route),
metric);
}
- if (nm_setting_ip_config_get_num_routes (page->setting) == 0)
- add_empty_route_row (page);
+ if (nm_setting_ip_config_get_num_routes (self->setting) == 0)
+ add_empty_route_row (self);
- gtk_widget_show_all (GTK_WIDGET (page->routes_box));
+ gtk_widget_show_all (GTK_WIDGET (self->routes_box));
}
static void
-connect_ip6_page (CEPageIP6 *page)
+connect_ip6_page (CEPageIP6 *self)
{
const gchar *str_method;
gboolean disabled;
guint method;
- page->address_box = GTK_BOX (gtk_builder_get_object (CE_PAGE (page)->builder, "address_box"));
- page->address_sizegroup = GTK_SIZE_GROUP (gtk_builder_get_object (CE_PAGE (page)->builder,
"address_sizegroup"));
- page->auto_dns_switch = GTK_SWITCH (gtk_builder_get_object (CE_PAGE (page)->builder,
"auto_dns_switch"));
- page->auto_routes_switch = GTK_SWITCH (gtk_builder_get_object (CE_PAGE (page)->builder,
"auto_routes_switch"));
- page->automatic_radio = GTK_RADIO_BUTTON (gtk_builder_get_object (CE_PAGE (page)->builder,
"automatic_radio"));
- page->content_box = GTK_BOX (gtk_builder_get_object (CE_PAGE (page)->builder, "content_box"));
- page->dhcp_radio = GTK_RADIO_BUTTON (gtk_builder_get_object (CE_PAGE (page)->builder, "dhcp_radio"));
- page->disabled_radio = GTK_RADIO_BUTTON (gtk_builder_get_object (CE_PAGE (page)->builder,
"disabled_radio"));
- page->dns_entry = GTK_ENTRY (gtk_builder_get_object (CE_PAGE (page)->builder, "dns_entry"));
- page->local_radio = GTK_RADIO_BUTTON (gtk_builder_get_object (CE_PAGE (page)->builder,
"local_radio"));
- page->manual_radio = GTK_RADIO_BUTTON (gtk_builder_get_object (CE_PAGE (page)->builder,
"manual_radio"));
- page->never_default_check = GTK_CHECK_BUTTON (gtk_builder_get_object (CE_PAGE (page)->builder,
"never_default_check"));
- page->routes_box = GTK_BOX (gtk_builder_get_object (CE_PAGE (page)->builder, "routes_box"));
- page->routes_metric_sizegroup = GTK_SIZE_GROUP (gtk_builder_get_object (CE_PAGE (page)->builder,
"routes_metric_sizegroup"));
- page->routes_sizegroup = GTK_SIZE_GROUP (gtk_builder_get_object (CE_PAGE (page)->builder,
"routes_sizegroup"));
-
- add_address_box (page);
- add_dns_section (page);
- add_routes_box (page);
-
- str_method = nm_setting_ip_config_get_method (page->setting);
+ self->address_box = GTK_BOX (gtk_builder_get_object (CE_PAGE (self)->builder, "address_box"));
+ self->address_sizegroup = GTK_SIZE_GROUP (gtk_builder_get_object (CE_PAGE (self)->builder,
"address_sizegroup"));
+ self->auto_dns_switch = GTK_SWITCH (gtk_builder_get_object (CE_PAGE (self)->builder,
"auto_dns_switch"));
+ self->auto_routes_switch = GTK_SWITCH (gtk_builder_get_object (CE_PAGE (self)->builder,
"auto_routes_switch"));
+ self->automatic_radio = GTK_RADIO_BUTTON (gtk_builder_get_object (CE_PAGE (self)->builder,
"automatic_radio"));
+ self->content_box = GTK_BOX (gtk_builder_get_object (CE_PAGE (self)->builder, "content_box"));
+ self->dhcp_radio = GTK_RADIO_BUTTON (gtk_builder_get_object (CE_PAGE (self)->builder, "dhcp_radio"));
+ self->disabled_radio = GTK_RADIO_BUTTON (gtk_builder_get_object (CE_PAGE (self)->builder,
"disabled_radio"));
+ self->dns_entry = GTK_ENTRY (gtk_builder_get_object (CE_PAGE (self)->builder, "dns_entry"));
+ self->local_radio = GTK_RADIO_BUTTON (gtk_builder_get_object (CE_PAGE (self)->builder,
"local_radio"));
+ self->manual_radio = GTK_RADIO_BUTTON (gtk_builder_get_object (CE_PAGE (self)->builder,
"manual_radio"));
+ self->never_default_check = GTK_CHECK_BUTTON (gtk_builder_get_object (CE_PAGE (self)->builder,
"never_default_check"));
+ self->routes_box = GTK_BOX (gtk_builder_get_object (CE_PAGE (self)->builder, "routes_box"));
+ self->routes_metric_sizegroup = GTK_SIZE_GROUP (gtk_builder_get_object (CE_PAGE (self)->builder,
"routes_metric_sizegroup"));
+ self->routes_sizegroup = GTK_SIZE_GROUP (gtk_builder_get_object (CE_PAGE (self)->builder,
"routes_sizegroup"));
+
+ add_address_box (self);
+ add_dns_section (self);
+ add_routes_box (self);
+
+ str_method = nm_setting_ip_config_get_method (self->setting);
disabled = g_strcmp0 (str_method, NM_SETTING_IP6_CONFIG_METHOD_IGNORE) == 0;
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->disabled_radio), disabled);
- g_signal_connect_swapped (page->disabled_radio, "notify::active", G_CALLBACK (ce_page_changed),
page);
- g_object_bind_property (page->disabled_radio, "active",
- page->content_box, "sensitive",
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->disabled_radio), disabled);
+ g_signal_connect_swapped (self->disabled_radio, "notify::active", G_CALLBACK (ce_page_changed),
self);
+ g_object_bind_property (self->disabled_radio, "active",
+ self->content_box, "sensitive",
G_BINDING_SYNC_CREATE | G_BINDING_INVERT_BOOLEAN);
method = IP6_METHOD_AUTO;
@@ -484,42 +484,42 @@ connect_ip6_page (CEPageIP6 *page)
method = IP6_METHOD_IGNORE;
}
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->never_default_check),
- nm_setting_ip_config_get_never_default (page->setting));
- g_signal_connect_swapped (page->never_default_check, "toggled", G_CALLBACK (ce_page_changed), page);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->never_default_check),
+ nm_setting_ip_config_get_never_default (self->setting));
+ g_signal_connect_swapped (self->never_default_check, "toggled", G_CALLBACK (ce_page_changed), self);
- g_signal_connect_swapped (page->automatic_radio, "toggled", G_CALLBACK (method_changed), page);
- g_signal_connect_swapped (page->dhcp_radio, "toggled", G_CALLBACK (method_changed), page);
- g_signal_connect_swapped (page->local_radio, "toggled", G_CALLBACK (method_changed), page);
- g_signal_connect_swapped (page->manual_radio, "toggled", G_CALLBACK (method_changed), page);
- g_signal_connect_swapped (page->disabled_radio, "toggled", G_CALLBACK (method_changed), page);
+ g_signal_connect_swapped (self->automatic_radio, "toggled", G_CALLBACK (method_changed), self);
+ g_signal_connect_swapped (self->dhcp_radio, "toggled", G_CALLBACK (method_changed), self);
+ g_signal_connect_swapped (self->local_radio, "toggled", G_CALLBACK (method_changed), self);
+ g_signal_connect_swapped (self->manual_radio, "toggled", G_CALLBACK (method_changed), self);
+ g_signal_connect_swapped (self->disabled_radio, "toggled", G_CALLBACK (method_changed), self);
switch (method) {
case IP6_METHOD_AUTO:
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->automatic_radio), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->automatic_radio), TRUE);
break;
case IP6_METHOD_DHCP:
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->dhcp_radio), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->dhcp_radio), TRUE);
break;
case IP6_METHOD_LINK_LOCAL:
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->local_radio), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->local_radio), TRUE);
break;
case IP6_METHOD_MANUAL:
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->manual_radio), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->manual_radio), TRUE);
break;
case IP6_METHOD_IGNORE:
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (page->disabled_radio), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->disabled_radio), TRUE);
break;
default:
break;
}
- method_changed (page);
+ method_changed (self);
}
static gboolean
-ui_to_setting (CEPageIP6 *page)
+ui_to_setting (CEPageIP6 *self)
{
const gchar *method;
gboolean ignore_auto_dns;
@@ -531,25 +531,25 @@ ui_to_setting (CEPageIP6 *page)
gchar *dns_text = NULL;
guint i;
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->disabled_radio))) {
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->disabled_radio))) {
method = NM_SETTING_IP6_CONFIG_METHOD_IGNORE;
} else {
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->manual_radio))) {
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->manual_radio))) {
method = NM_SETTING_IP6_CONFIG_METHOD_MANUAL;
- } else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->local_radio))) {
+ } else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->local_radio))) {
method = NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL;
- } else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->dhcp_radio))) {
+ } else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->dhcp_radio))) {
method = NM_SETTING_IP6_CONFIG_METHOD_DHCP;
- } else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->automatic_radio))) {
+ } else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->automatic_radio))) {
method = NM_SETTING_IP6_CONFIG_METHOD_AUTO;
}
}
- nm_setting_ip_config_clear_addresses (page->setting);
+ nm_setting_ip_config_clear_addresses (self->setting);
if (g_str_equal (method, NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) {
- children = gtk_container_get_children (GTK_CONTAINER (page->address_list));
+ children = gtk_container_get_children (GTK_CONTAINER (self->address_list));
} else {
- g_object_set (G_OBJECT (page->setting),
+ g_object_set (G_OBJECT (self->setting),
NM_SETTING_IP_CONFIG_GATEWAY, NULL,
NULL);
children = NULL;
@@ -611,18 +611,18 @@ ui_to_setting (CEPageIP6 *page)
addr = nm_ip_address_new (AF_INET6, text_address, prefix, NULL);
if (have_gateway)
- g_object_set (G_OBJECT (page->setting),
+ g_object_set (G_OBJECT (self->setting),
NM_SETTING_IP_CONFIG_GATEWAY, text_gateway,
NULL);
- nm_setting_ip_config_add_address (page->setting, addr);
+ nm_setting_ip_config_add_address (self->setting, addr);
if (!l || !l->next)
- ensure_empty_address_row (page);
+ ensure_empty_address_row (self);
}
g_list_free (children);
- nm_setting_ip_config_clear_dns (page->setting);
- dns_text = g_strstrip (g_strdup (gtk_entry_get_text (GTK_ENTRY (page->dns_entry))));
+ nm_setting_ip_config_clear_dns (self->setting);
+ dns_text = g_strstrip (g_strdup (gtk_entry_get_text (GTK_ENTRY (self->dns_entry))));
if (g_str_equal (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO) ||
g_str_equal (method, NM_SETTING_IP6_CONFIG_METHOD_DHCP) ||
@@ -642,20 +642,20 @@ ui_to_setting (CEPageIP6 *page)
if (inet_pton (AF_INET6, text, &tmp_addr) <= 0) {
g_clear_pointer (&dns_addresses, g_strfreev);
- widget_set_error (GTK_WIDGET (page->dns_entry));
+ widget_set_error (GTK_WIDGET (self->dns_entry));
ret = FALSE;
break;
} else {
- widget_unset_error (GTK_WIDGET (page->dns_entry));
- nm_setting_ip_config_add_dns (page->setting, text);
+ widget_unset_error (GTK_WIDGET (self->dns_entry));
+ nm_setting_ip_config_add_dns (self->setting, text);
}
}
- nm_setting_ip_config_clear_routes (page->setting);
+ nm_setting_ip_config_clear_routes (self->setting);
if (g_str_equal (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO) ||
g_str_equal (method, NM_SETTING_IP6_CONFIG_METHOD_DHCP) ||
g_str_equal (method, NM_SETTING_IP6_CONFIG_METHOD_MANUAL))
- children = gtk_container_get_children (GTK_CONTAINER (page->routes_list));
+ children = gtk_container_get_children (GTK_CONTAINER (self->routes_list));
else
children = NULL;
@@ -728,22 +728,22 @@ ui_to_setting (CEPageIP6 *page)
continue;
route = nm_ip_route_new (AF_INET6, text_address, prefix, text_gateway, metric, NULL);
- nm_setting_ip_config_add_route (page->setting, route);
+ nm_setting_ip_config_add_route (self->setting, route);
nm_ip_route_unref (route);
if (!l || !l->next)
- ensure_empty_routes_row (page);
+ ensure_empty_routes_row (self);
}
g_list_free (children);
if (!ret)
goto out;
- ignore_auto_dns = !gtk_switch_get_active (page->auto_dns_switch);
- ignore_auto_routes = !gtk_switch_get_active (page->auto_routes_switch);
- never_default = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (page->never_default_check));
+ ignore_auto_dns = !gtk_switch_get_active (self->auto_dns_switch);
+ ignore_auto_routes = !gtk_switch_get_active (self->auto_routes_switch);
+ never_default = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->never_default_check));
- g_object_set (page->setting,
+ g_object_set (self->setting,
NM_SETTING_IP_CONFIG_METHOD, method,
NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS, ignore_auto_dns,
NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES, ignore_auto_routes,
@@ -758,18 +758,18 @@ out:
}
static gboolean
-validate (CEPage *page,
+validate (CEPage *self,
NMConnection *connection,
GError **error)
{
- if (!ui_to_setting (CE_PAGE_IP6 (page)))
+ if (!ui_to_setting (CE_PAGE_IP6 (self)))
return FALSE;
- return nm_setting_verify (NM_SETTING (CE_PAGE_IP6 (page)->setting), NULL, error);
+ return nm_setting_verify (NM_SETTING (CE_PAGE_IP6 (self)->setting), NULL, error);
}
static void
-ce_page_ip6_init (CEPageIP6 *page)
+ce_page_ip6_init (CEPageIP6 *self)
{
}
@@ -785,21 +785,21 @@ CEPage *
ce_page_ip6_new (NMConnection *connection,
NMClient *client)
{
- CEPageIP6 *page;
+ CEPageIP6 *self;
- page = CE_PAGE_IP6 (ce_page_new (CE_TYPE_PAGE_IP6,
+ self = CE_PAGE_IP6 (ce_page_new (CE_TYPE_PAGE_IP6,
connection,
client,
"/org/gnome/control-center/network/ip6-page.ui",
_("IPv6")));
- page->setting = nm_connection_get_setting_ip6_config (connection);
- if (!page->setting) {
- page->setting = NM_SETTING_IP_CONFIG (nm_setting_ip6_config_new ());
- nm_connection_add_setting (connection, NM_SETTING (page->setting));
+ self->setting = nm_connection_get_setting_ip6_config (connection);
+ if (!self->setting) {
+ self->setting = NM_SETTING_IP_CONFIG (nm_setting_ip6_config_new ());
+ nm_connection_add_setting (connection, NM_SETTING (self->setting));
}
- connect_ip6_page (page);
+ connect_ip6_page (self);
- return CE_PAGE (page);
+ return CE_PAGE (self);
}
diff --git a/panels/network/connection-editor/ce-page-security.c
b/panels/network/connection-editor/ce-page-security.c
index 8ff86288c..5582dc3a2 100644
--- a/panels/network/connection-editor/ce-page-security.c
+++ b/panels/network/connection-editor/ce-page-security.c
@@ -97,14 +97,14 @@ get_default_type_for_security (NMSettingWirelessSecurity *sec)
}
static WirelessSecurity *
-security_combo_get_active (CEPageSecurity *page)
+security_combo_get_active (CEPageSecurity *self)
{
GtkTreeIter iter;
GtkTreeModel *model;
WirelessSecurity *sec = NULL;
- model = gtk_combo_box_get_model (page->security_combo);
- gtk_combo_box_get_active_iter (page->security_combo, &iter);
+ model = gtk_combo_box_get_model (self->security_combo);
+ gtk_combo_box_get_active_iter (self->security_combo, &iter);
gtk_tree_model_get (model, &iter, S_SEC_COLUMN, &sec, -1);
return sec;
@@ -124,19 +124,19 @@ wsec_size_group_clear (GtkSizeGroup *group)
}
static void
-security_combo_changed (CEPageSecurity *page)
+security_combo_changed (CEPageSecurity *self)
{
GList *l, *children;
g_autoptr(WirelessSecurity) sec = NULL;
- wsec_size_group_clear (page->group);
+ wsec_size_group_clear (self->group);
- children = gtk_container_get_children (GTK_CONTAINER (page->box));
+ children = gtk_container_get_children (GTK_CONTAINER (self->box));
for (l = children; l; l = l->next) {
- gtk_container_remove (GTK_CONTAINER (page->box), GTK_WIDGET (l->data));
+ gtk_container_remove (GTK_CONTAINER (self->box), GTK_WIDGET (l->data));
}
- sec = security_combo_get_active (page);
+ sec = security_combo_get_active (self);
if (sec) {
GtkWidget *sec_widget;
GtkWidget *parent;
@@ -147,13 +147,13 @@ security_combo_changed (CEPageSecurity *page)
if (parent)
gtk_container_remove (GTK_CONTAINER (parent), sec_widget);
- gtk_size_group_add_widget (page->group, GTK_WIDGET (page->security_label));
- wireless_security_add_to_size_group (sec, page->group);
+ gtk_size_group_add_widget (self->group, GTK_WIDGET (self->security_label));
+ wireless_security_add_to_size_group (sec, self->group);
- gtk_container_add (GTK_CONTAINER (page->box), sec_widget);
+ gtk_container_add (GTK_CONTAINER (self->box), sec_widget);
}
- ce_page_changed (CE_PAGE (page));
+ ce_page_changed (CE_PAGE (self));
}
static void
@@ -163,14 +163,14 @@ stuff_changed_cb (WirelessSecurity *sec, gpointer user_data)
}
static void
-add_security_item (CEPageSecurity *page,
+add_security_item (CEPageSecurity *self,
WirelessSecurity *sec,
GtkListStore *model,
GtkTreeIter *iter,
const char *text,
gboolean adhoc_valid)
{
- wireless_security_set_changed_notify (sec, stuff_changed_cb, page);
+ wireless_security_set_changed_notify (sec, stuff_changed_cb, self);
gtk_list_store_append (model, iter);
gtk_list_store_set (model, iter,
S_NAME_COLUMN, text,
@@ -198,9 +198,9 @@ set_sensitive (GtkCellLayout *cell_layout,
}
static void
-finish_setup (CEPageSecurity *page)
+finish_setup (CEPageSecurity *self)
{
- NMConnection *connection = CE_PAGE (page)->connection;
+ NMConnection *connection = CE_PAGE (self)->connection;
NMSettingWireless *sw;
NMSettingWirelessSecurity *sws;
gboolean is_adhoc = FALSE;
@@ -216,11 +216,11 @@ finish_setup (CEPageSecurity *page)
sw = nm_connection_get_setting_wireless (connection);
g_assert (sw);
- page->group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+ self->group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
- page->box = GTK_BOX (gtk_builder_get_object (CE_PAGE (page)->builder, "box"));
- page->security_label = GTK_LABEL (gtk_builder_get_object (CE_PAGE (page)->builder,
"security_label"));
- page->security_combo = GTK_COMBO_BOX (gtk_builder_get_object (CE_PAGE (page)->builder,
"security_combo"));
+ self->box = GTK_BOX (gtk_builder_get_object (CE_PAGE (self)->builder, "box"));
+ self->security_label = GTK_LABEL (gtk_builder_get_object (CE_PAGE (self)->builder,
"security_label"));
+ self->security_combo = GTK_COMBO_BOX (gtk_builder_get_object (CE_PAGE (self)->builder,
"security_combo"));
dev_caps = NM_WIFI_DEVICE_CAP_CIPHER_WEP40
| NM_WIFI_DEVICE_CAP_CIPHER_WEP104
@@ -232,7 +232,7 @@ finish_setup (CEPageSecurity *page)
mode = nm_setting_wireless_get_mode (sw);
if (mode && !strcmp (mode, "adhoc"))
is_adhoc = TRUE;
- page->adhoc = is_adhoc;
+ self->adhoc = is_adhoc;
sws = nm_connection_get_setting_wireless_security (connection);
if (sws)
@@ -264,7 +264,7 @@ finish_setup (CEPageSecurity *page)
ws_wep = ws_wep_key_new (connection, NM_WEP_KEY_TYPE_KEY, FALSE, FALSE);
if (ws_wep) {
- add_security_item (page, WIRELESS_SECURITY (ws_wep), sec_model,
+ add_security_item (self, WIRELESS_SECURITY (ws_wep), sec_model,
&iter, _("WEP 40/128-bit Key (Hex or ASCII)"),
TRUE);
if ((active < 0) && (default_type == NMU_SEC_STATIC_WEP) && (wep_type ==
NM_WEP_KEY_TYPE_KEY))
@@ -274,7 +274,7 @@ finish_setup (CEPageSecurity *page)
ws_wep = ws_wep_key_new (connection, NM_WEP_KEY_TYPE_PASSPHRASE, FALSE, FALSE);
if (ws_wep) {
- add_security_item (page, WIRELESS_SECURITY (ws_wep), sec_model,
+ add_security_item (self, WIRELESS_SECURITY (ws_wep), sec_model,
&iter, _("WEP 128-bit Passphrase"), TRUE);
if ((active < 0) && (default_type == NMU_SEC_STATIC_WEP) && (wep_type ==
NM_WEP_KEY_TYPE_PASSPHRASE))
active = item;
@@ -287,7 +287,7 @@ finish_setup (CEPageSecurity *page)
ws_leap = ws_leap_new (connection, FALSE);
if (ws_leap) {
- add_security_item (page, WIRELESS_SECURITY (ws_leap), sec_model,
+ add_security_item (self, WIRELESS_SECURITY (ws_leap), sec_model,
&iter, _("LEAP"), FALSE);
if ((active < 0) && (default_type == NMU_SEC_LEAP))
active = item;
@@ -300,7 +300,7 @@ finish_setup (CEPageSecurity *page)
ws_dynamic_wep = ws_dynamic_wep_new (connection, TRUE, FALSE);
if (ws_dynamic_wep) {
- add_security_item (page, WIRELESS_SECURITY (ws_dynamic_wep), sec_model,
+ add_security_item (self, WIRELESS_SECURITY (ws_dynamic_wep), sec_model,
&iter, _("Dynamic WEP (802.1x)"), FALSE);
if ((active < 0) && (default_type == NMU_SEC_DYNAMIC_WEP))
active = item;
@@ -314,7 +314,7 @@ finish_setup (CEPageSecurity *page)
ws_wpa_psk = ws_wpa_psk_new (connection, FALSE);
if (ws_wpa_psk) {
- add_security_item (page, WIRELESS_SECURITY (ws_wpa_psk), sec_model,
+ add_security_item (self, WIRELESS_SECURITY (ws_wpa_psk), sec_model,
&iter, _("WPA & WPA2 Personal"), FALSE);
if ((active < 0) && ((default_type == NMU_SEC_WPA_PSK) || (default_type ==
NMU_SEC_WPA2_PSK)))
active = item;
@@ -328,7 +328,7 @@ finish_setup (CEPageSecurity *page)
ws_wpa_eap = ws_wpa_eap_new (connection, TRUE, FALSE);
if (ws_wpa_eap) {
- add_security_item (page, WIRELESS_SECURITY (ws_wpa_eap), sec_model,
+ add_security_item (self, WIRELESS_SECURITY (ws_wpa_eap), sec_model,
&iter, _("WPA & WPA2 Enterprise"), FALSE);
if ((active < 0) && ((default_type == NMU_SEC_WPA_ENTERPRISE) || (default_type ==
NMU_SEC_WPA2_ENTERPRISE)))
active = item;
@@ -336,19 +336,19 @@ finish_setup (CEPageSecurity *page)
}
}
- gtk_combo_box_set_model (page->security_combo, GTK_TREE_MODEL (sec_model));
- gtk_cell_layout_clear (GTK_CELL_LAYOUT (page->security_combo));
+ gtk_combo_box_set_model (self->security_combo, GTK_TREE_MODEL (sec_model));
+ gtk_cell_layout_clear (GTK_CELL_LAYOUT (self->security_combo));
renderer = gtk_cell_renderer_text_new ();
- gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (page->security_combo), renderer, TRUE);
- gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (page->security_combo), renderer, "text",
S_NAME_COLUMN, NULL);
- gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (page->security_combo), renderer, set_sensitive,
&page->adhoc, NULL);
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (self->security_combo), renderer, TRUE);
+ gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (self->security_combo), renderer, "text",
S_NAME_COLUMN, NULL);
+ gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (self->security_combo), renderer, set_sensitive,
&self->adhoc, NULL);
- gtk_combo_box_set_active (page->security_combo, active < 0 ? 0 : (guint32) active);
+ gtk_combo_box_set_active (self->security_combo, active < 0 ? 0 : (guint32) active);
- security_combo_changed (page);
- g_signal_connect_swapped (page->security_combo, "changed",
- G_CALLBACK (security_combo_changed), page);
+ security_combo_changed (self);
+ g_signal_connect_swapped (self->security_combo, "changed",
+ G_CALLBACK (security_combo_changed), self);
}
static gboolean
@@ -356,6 +356,7 @@ validate (CEPage *page,
NMConnection *connection,
GError **error)
{
+ CEPageSecurity *self = CE_PAGE_SECURITY (page);
NMSettingWireless *sw;
g_autoptr(WirelessSecurity) sec = NULL;
gboolean valid = FALSE;
@@ -365,11 +366,11 @@ validate (CEPage *page,
mode = nm_setting_wireless_get_mode (sw);
if (g_strcmp0 (mode, NM_SETTING_WIRELESS_MODE_ADHOC) == 0)
- CE_PAGE_SECURITY (page)->adhoc = TRUE;
+ CE_PAGE_SECURITY (self)->adhoc = TRUE;
else
- CE_PAGE_SECURITY (page)->adhoc = FALSE;
+ CE_PAGE_SECURITY (self)->adhoc = FALSE;
- sec = security_combo_get_active (CE_PAGE_SECURITY (page));
+ sec = security_combo_get_active (CE_PAGE_SECURITY (self));
if (sec) {
GBytes *ssid = nm_setting_wireless_get_ssid (sw);
@@ -383,7 +384,7 @@ validate (CEPage *page,
valid = FALSE;
}
- if (CE_PAGE_SECURITY (page)->adhoc) {
+ if (self->adhoc) {
if (!wireless_security_adhoc_compatible (sec)) {
if (valid)
g_set_error (error, NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_INVALID_SETTING, "Security not compatible with Ad-Hoc mode");
@@ -401,16 +402,16 @@ validate (CEPage *page,
}
static void
-ce_page_security_init (CEPageSecurity *page)
+ce_page_security_init (CEPageSecurity *self)
{
}
static void
dispose (GObject *object)
{
- CEPageSecurity *page = CE_PAGE_SECURITY (object);
+ CEPageSecurity *self = CE_PAGE_SECURITY (object);
- g_clear_object (&page->group);
+ g_clear_object (&self->group);
G_OBJECT_CLASS (ce_page_security_parent_class)->dispose (object);
}
@@ -429,11 +430,11 @@ CEPage *
ce_page_security_new (NMConnection *connection,
NMClient *client)
{
- CEPageSecurity *page;
+ CEPageSecurity *self;
NMUtilsSecurityType default_type = NMU_SEC_NONE;
NMSettingWirelessSecurity *sws;
- page = CE_PAGE_SECURITY (ce_page_new (CE_TYPE_PAGE_SECURITY,
+ self = CE_PAGE_SECURITY (ce_page_new (CE_TYPE_PAGE_SECURITY,
connection,
client,
"/org/gnome/control-center/network/security-page.ui",
@@ -447,16 +448,16 @@ ce_page_security_new (NMConnection *connection,
default_type == NMU_SEC_LEAP ||
default_type == NMU_SEC_WPA_PSK ||
default_type == NMU_SEC_WPA2_PSK) {
- CE_PAGE (page)->security_setting = NM_SETTING_WIRELESS_SECURITY_SETTING_NAME;
+ CE_PAGE (self)->security_setting = NM_SETTING_WIRELESS_SECURITY_SETTING_NAME;
}
if (default_type == NMU_SEC_DYNAMIC_WEP ||
default_type == NMU_SEC_WPA_ENTERPRISE ||
default_type == NMU_SEC_WPA2_ENTERPRISE) {
- CE_PAGE (page)->security_setting = NM_SETTING_802_1X_SETTING_NAME;
+ CE_PAGE (self)->security_setting = NM_SETTING_802_1X_SETTING_NAME;
}
- g_signal_connect (page, "initialized", G_CALLBACK (finish_setup), NULL);
+ g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
- return CE_PAGE (page);
+ return CE_PAGE (self);
}
diff --git a/panels/network/connection-editor/ce-page-vpn.c b/panels/network/connection-editor/ce-page-vpn.c
index 5f004d112..f9ba9529e 100644
--- a/panels/network/connection-editor/ce-page-vpn.c
+++ b/panels/network/connection-editor/ce-page-vpn.c
@@ -73,40 +73,40 @@ vpn_gnome3ify_editor (GtkWidget *widget)
}
static void
-load_vpn_plugin (CEPageVpn *page, NMConnection *connection)
+load_vpn_plugin (CEPageVpn *self, NMConnection *connection)
{
GtkWidget *ui_widget;
- page->editor = nm_vpn_editor_plugin_get_editor (page->plugin,
+ self->editor = nm_vpn_editor_plugin_get_editor (self->plugin,
connection,
NULL);
ui_widget = NULL;
- if (page->editor)
- ui_widget = GTK_WIDGET (nm_vpn_editor_get_widget (page->editor));
+ if (self->editor)
+ ui_widget = GTK_WIDGET (nm_vpn_editor_get_widget (self->editor));
if (!ui_widget) {
- g_clear_object (&page->editor);
- page->plugin = NULL;
+ g_clear_object (&self->editor);
+ self->plugin = NULL;
return;
}
vpn_gnome3ify_editor (ui_widget);
- gtk_widget_destroy (GTK_WIDGET (page->failure_label));
+ gtk_widget_destroy (GTK_WIDGET (self->failure_label));
- gtk_box_pack_start (page->page, ui_widget, TRUE, TRUE, 0);
+ gtk_box_pack_start (self->page, ui_widget, TRUE, TRUE, 0);
gtk_widget_show_all (ui_widget);
- g_signal_connect_swapped (page->editor, "changed", G_CALLBACK (ce_page_changed), page);
+ g_signal_connect_swapped (self->editor, "changed", G_CALLBACK (ce_page_changed), self);
}
static void
-connect_vpn_page (CEPageVpn *page)
+connect_vpn_page (CEPageVpn *self)
{
const gchar *name;
- name = nm_setting_connection_get_id (page->setting_connection);
- gtk_entry_set_text (page->name_entry, name);
- g_signal_connect_swapped (page->name_entry, "changed", G_CALLBACK (ce_page_changed), page);
+ name = nm_setting_connection_get_id (self->setting_connection);
+ gtk_entry_set_text (self->name_entry, name);
+ g_signal_connect_swapped (self->name_entry, "changed", G_CALLBACK (ce_page_changed), self);
}
static gboolean
@@ -130,16 +130,16 @@ validate (CEPage *page,
}
static void
-ce_page_vpn_init (CEPageVpn *page)
+ce_page_vpn_init (CEPageVpn *self)
{
}
static void
dispose (GObject *object)
{
- CEPageVpn *page = CE_PAGE_VPN (object);
+ CEPageVpn *self = CE_PAGE_VPN (object);
- g_clear_object (&page->editor);
+ g_clear_object (&self->editor);
G_OBJECT_CLASS (ce_page_vpn_parent_class)->dispose (object);
}
@@ -156,41 +156,41 @@ ce_page_vpn_class_init (CEPageVpnClass *class)
}
static void
-finish_setup (CEPageVpn *page, gpointer unused, GError *error, gpointer user_data)
+finish_setup (CEPageVpn *self, gpointer unused, GError *error, gpointer user_data)
{
- NMConnection *connection = CE_PAGE (page)->connection;
+ NMConnection *connection = CE_PAGE (self)->connection;
const char *vpn_type;
- page->setting_connection = nm_connection_get_setting_connection (connection);
- page->setting_vpn = nm_connection_get_setting_vpn (connection);
- vpn_type = nm_setting_vpn_get_service_type (page->setting_vpn);
+ self->setting_connection = nm_connection_get_setting_connection (connection);
+ self->setting_vpn = nm_connection_get_setting_vpn (connection);
+ vpn_type = nm_setting_vpn_get_service_type (self->setting_vpn);
- page->plugin = vpn_get_plugin_by_service (vpn_type);
- if (page->plugin)
- load_vpn_plugin (page, connection);
+ self->plugin = vpn_get_plugin_by_service (vpn_type);
+ if (self->plugin)
+ load_vpn_plugin (self, connection);
- connect_vpn_page (page);
+ connect_vpn_page (self);
}
CEPage *
ce_page_vpn_new (NMConnection *connection,
NMClient *client)
{
- CEPageVpn *page;
+ CEPageVpn *self;
- page = CE_PAGE_VPN (ce_page_new (CE_TYPE_PAGE_VPN,
+ self = CE_PAGE_VPN (ce_page_new (CE_TYPE_PAGE_VPN,
connection,
client,
"/org/gnome/control-center/network/vpn-page.ui",
_("Identity")));
- page->failure_label = GTK_LABEL (gtk_builder_get_object (CE_PAGE (page)->builder, "failure_label"));
- page->name_entry = GTK_ENTRY (gtk_builder_get_object (CE_PAGE (page)->builder, "name_entry"));
- page->page = GTK_BOX (gtk_builder_get_object (CE_PAGE (page)->builder, "page"));
+ self->failure_label = GTK_LABEL (gtk_builder_get_object (CE_PAGE (self)->builder, "failure_label"));
+ self->name_entry = GTK_ENTRY (gtk_builder_get_object (CE_PAGE (self)->builder, "name_entry"));
+ self->page = GTK_BOX (gtk_builder_get_object (CE_PAGE (self)->builder, "page"));
- g_signal_connect (page, "initialized", G_CALLBACK (finish_setup), NULL);
+ g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);
- CE_PAGE (page)->security_setting = NM_SETTING_VPN_SETTING_NAME;
+ CE_PAGE (self)->security_setting = NM_SETTING_VPN_SETTING_NAME;
- return CE_PAGE (page);
+ return CE_PAGE (self);
}
diff --git a/panels/network/connection-editor/ce-page-wifi.c b/panels/network/connection-editor/ce-page-wifi.c
index 3efe41623..a771cad51 100644
--- a/panels/network/connection-editor/ce-page-wifi.c
+++ b/panels/network/connection-editor/ce-page-wifi.c
@@ -34,7 +34,7 @@
G_DEFINE_TYPE (CEPageWifi, ce_page_wifi, CE_TYPE_PAGE)
static void
-connect_wifi_page (CEPageWifi *page)
+connect_wifi_page (CEPageWifi *self)
{
GBytes *ssid;
g_autofree gchar *utf8_ssid = NULL;
@@ -46,40 +46,40 @@ connect_wifi_page (CEPageWifi *page)
const gchar *cloned_mac;
gint i;
- ssid = nm_setting_wireless_get_ssid (page->setting);
+ ssid = nm_setting_wireless_get_ssid (self->setting);
if (ssid)
utf8_ssid = nm_utils_ssid_to_utf8 (g_bytes_get_data (ssid, NULL), g_bytes_get_size (ssid));
else
utf8_ssid = g_strdup ("");
- gtk_entry_set_text (page->ssid_entry, utf8_ssid);
+ gtk_entry_set_text (self->ssid_entry, utf8_ssid);
- g_signal_connect_swapped (page->ssid_entry, "changed", G_CALLBACK (ce_page_changed), page);
+ g_signal_connect_swapped (self->ssid_entry, "changed", G_CALLBACK (ce_page_changed), self);
bssid_array = g_ptr_array_new ();
- for (i = 0; i < nm_setting_wireless_get_num_seen_bssids (page->setting); i++) {
- g_ptr_array_add (bssid_array, g_strdup (nm_setting_wireless_get_seen_bssid (page->setting,
i)));
+ for (i = 0; i < nm_setting_wireless_get_num_seen_bssids (self->setting); i++) {
+ g_ptr_array_add (bssid_array, g_strdup (nm_setting_wireless_get_seen_bssid (self->setting,
i)));
}
g_ptr_array_add (bssid_array, NULL);
bssid_list = (gchar **) g_ptr_array_free (bssid_array, FALSE);
- s_bssid_str = nm_setting_wireless_get_bssid (page->setting);
- ce_page_setup_mac_combo (page->bssid_combo, s_bssid_str, bssid_list);
+ s_bssid_str = nm_setting_wireless_get_bssid (self->setting);
+ ce_page_setup_mac_combo (self->bssid_combo, s_bssid_str, bssid_list);
g_strfreev (bssid_list);
- g_signal_connect_swapped (page->bssid_combo, "changed", G_CALLBACK (ce_page_changed), page);
+ g_signal_connect_swapped (self->bssid_combo, "changed", G_CALLBACK (ce_page_changed), self);
- mac_list = ce_page_get_mac_list (CE_PAGE (page)->client, NM_TYPE_DEVICE_WIFI,
+ mac_list = ce_page_get_mac_list (CE_PAGE (self)->client, NM_TYPE_DEVICE_WIFI,
NM_DEVICE_WIFI_PERMANENT_HW_ADDRESS);
- s_mac_str = nm_setting_wireless_get_mac_address (page->setting);
- ce_page_setup_mac_combo (page->mac_combo, s_mac_str, mac_list);
+ s_mac_str = nm_setting_wireless_get_mac_address (self->setting);
+ ce_page_setup_mac_combo (self->mac_combo, s_mac_str, mac_list);
g_strfreev (mac_list);
- g_signal_connect_swapped (page->mac_combo, "changed", G_CALLBACK (ce_page_changed), page);
+ g_signal_connect_swapped (self->mac_combo, "changed", G_CALLBACK (ce_page_changed), self);
- cloned_mac = nm_setting_wireless_get_cloned_mac_address (page->setting);
- ce_page_setup_cloned_mac_combo (page->cloned_mac_combo, cloned_mac);
- g_signal_connect_swapped (page->cloned_mac_combo, "changed", G_CALLBACK (ce_page_changed), page);
+ cloned_mac = nm_setting_wireless_get_cloned_mac_address (self->setting);
+ ce_page_setup_cloned_mac_combo (self->cloned_mac_combo, cloned_mac);
+ g_signal_connect_swapped (self->cloned_mac_combo, "changed", G_CALLBACK (ce_page_changed), self);
}
static void
-ui_to_setting (CEPageWifi *page)
+ui_to_setting (CEPageWifi *self)
{
g_autoptr(GBytes) ssid = NULL;
const gchar *utf8_ssid, *bssid;
@@ -87,21 +87,21 @@ ui_to_setting (CEPageWifi *page)
g_autofree gchar *device_mac = NULL;
g_autofree gchar *cloned_mac = NULL;
- utf8_ssid = gtk_entry_get_text (page->ssid_entry);
+ utf8_ssid = gtk_entry_get_text (self->ssid_entry);
if (!utf8_ssid || !*utf8_ssid)
ssid = NULL;
else {
ssid = g_bytes_new_static (utf8_ssid, strlen (utf8_ssid));
}
- entry = gtk_bin_get_child (GTK_BIN (page->bssid_combo));
+ entry = gtk_bin_get_child (GTK_BIN (self->bssid_combo));
bssid = gtk_entry_get_text (GTK_ENTRY (entry));
if (*bssid == '\0')
bssid = NULL;
- entry = gtk_bin_get_child (GTK_BIN (page->mac_combo));
+ entry = gtk_bin_get_child (GTK_BIN (self->mac_combo));
device_mac = ce_page_trim_address (gtk_entry_get_text (GTK_ENTRY (entry)));
- cloned_mac = ce_page_cloned_mac_get (page->cloned_mac_combo);
+ cloned_mac = ce_page_cloned_mac_get (self->cloned_mac_combo);
- g_object_set (page->setting,
+ g_object_set (self->setting,
NM_SETTING_WIRELESS_SSID, ssid,
NM_SETTING_WIRELESS_BSSID, bssid,
NM_SETTING_WIRELESS_MAC_ADDRESS, device_mac,
@@ -114,11 +114,11 @@ validate (CEPage *parent,
NMConnection *connection,
GError **error)
{
- CEPageWifi *page = (CEPageWifi *) parent;
+ CEPageWifi *self = (CEPageWifi *) parent;
GtkWidget *entry;
gboolean ret = TRUE;
- entry = gtk_bin_get_child (GTK_BIN (page->bssid_combo));
+ entry = gtk_bin_get_child (GTK_BIN (self->bssid_combo));
if (!ce_page_address_is_valid (gtk_entry_get_text (GTK_ENTRY (entry)))) {
widget_set_error (entry);
ret = FALSE;
@@ -126,7 +126,7 @@ validate (CEPage *parent,
widget_unset_error (entry);
}
- entry = gtk_bin_get_child (GTK_BIN (page->mac_combo));
+ entry = gtk_bin_get_child (GTK_BIN (self->mac_combo));
if (!ce_page_address_is_valid (gtk_entry_get_text (GTK_ENTRY (entry)))) {
widget_set_error (entry);
ret = FALSE;
@@ -134,23 +134,23 @@ validate (CEPage *parent,
widget_unset_error (entry);
}
- if (!ce_page_cloned_mac_combo_valid (page->cloned_mac_combo)) {
- widget_set_error (gtk_bin_get_child (GTK_BIN (page->cloned_mac_combo)));
+ if (!ce_page_cloned_mac_combo_valid (self->cloned_mac_combo)) {
+ widget_set_error (gtk_bin_get_child (GTK_BIN (self->cloned_mac_combo)));
ret = FALSE;
} else {
- widget_unset_error (gtk_bin_get_child (GTK_BIN (page->cloned_mac_combo)));
+ widget_unset_error (gtk_bin_get_child (GTK_BIN (self->cloned_mac_combo)));
}
if (!ret)
return ret;
- ui_to_setting (CE_PAGE_WIFI (page));
+ ui_to_setting (CE_PAGE_WIFI (self));
return ret;
}
static void
-ce_page_wifi_init (CEPageWifi *page)
+ce_page_wifi_init (CEPageWifi *self)
{
}
@@ -166,22 +166,22 @@ CEPage *
ce_page_wifi_new (NMConnection *connection,
NMClient *client)
{
- CEPageWifi *page;
+ CEPageWifi *self;
- page = CE_PAGE_WIFI (ce_page_new (CE_TYPE_PAGE_WIFI,
+ self = CE_PAGE_WIFI (ce_page_new (CE_TYPE_PAGE_WIFI,
connection,
client,
"/org/gnome/control-center/network/wifi-page.ui",
_("Identity")));
- page->bssid_combo = GTK_COMBO_BOX_TEXT (gtk_builder_get_object (CE_PAGE (page)->builder,
"bssid_combo"));
- page->cloned_mac_combo = GTK_COMBO_BOX_TEXT (gtk_builder_get_object (CE_PAGE (page)->builder,
"cloned_mac_combo"));
- page->mac_combo = GTK_COMBO_BOX_TEXT (gtk_builder_get_object (CE_PAGE (page)->builder, "mac_combo"));
- page->ssid_entry = GTK_ENTRY (gtk_builder_get_object (CE_PAGE (page)->builder, "ssid_entry"));
+ self->bssid_combo = GTK_COMBO_BOX_TEXT (gtk_builder_get_object (CE_PAGE (self)->builder,
"bssid_combo"));
+ self->cloned_mac_combo = GTK_COMBO_BOX_TEXT (gtk_builder_get_object (CE_PAGE (self)->builder,
"cloned_mac_combo"));
+ self->mac_combo = GTK_COMBO_BOX_TEXT (gtk_builder_get_object (CE_PAGE (self)->builder, "mac_combo"));
+ self->ssid_entry = GTK_ENTRY (gtk_builder_get_object (CE_PAGE (self)->builder, "ssid_entry"));
- page->setting = nm_connection_get_setting_wireless (connection);
+ self->setting = nm_connection_get_setting_wireless (connection);
- connect_wifi_page (page);
+ connect_wifi_page (self);
- return CE_PAGE (page);
+ return CE_PAGE (self);
}
diff --git a/panels/network/connection-editor/ce-page.c b/panels/network/connection-editor/ce-page.c
index 434c22eda..45d9abcab 100644
--- a/panels/network/connection-editor/ce-page.c
+++ b/panels/network/connection-editor/ce-page.c
@@ -50,13 +50,13 @@ enum {
static guint signals[LAST_SIGNAL] = { 0 };
gboolean
-ce_page_validate (CEPage *page, NMConnection *connection, GError **error)
+ce_page_validate (CEPage *self, NMConnection *connection, GError **error)
{
- g_return_val_if_fail (CE_IS_PAGE (page), FALSE);
+ g_return_val_if_fail (CE_IS_PAGE (self), FALSE);
g_return_val_if_fail (NM_IS_CONNECTION (connection), FALSE);
- if (CE_PAGE_GET_CLASS (page)->validate)
- return CE_PAGE_GET_CLASS (page)->validate (page, connection, error);
+ if (CE_PAGE_GET_CLASS (self)->validate)
+ return CE_PAGE_GET_CLASS (self)->validate (self, connection, error);
return TRUE;
}
@@ -221,43 +221,43 @@ ce_page_new (GType type,
const gchar *ui_resource,
const gchar *title)
{
- g_autoptr(CEPage) page = NULL;
+ g_autoptr(CEPage) self = NULL;
g_autoptr(GError) error = NULL;
- page = CE_PAGE (g_object_new (type,
+ self = CE_PAGE (g_object_new (type,
"connection", connection,
NULL));
- page->title = g_strdup (title);
- page->client = client;
+ self->title = g_strdup (title);
+ self->client = client;
if (ui_resource) {
- if (!gtk_builder_add_from_resource (page->builder, ui_resource, &error)) {
+ if (!gtk_builder_add_from_resource (self->builder, ui_resource, &error)) {
g_warning ("Couldn't load builder file: %s", error->message);
return NULL;
}
- page->page = GTK_WIDGET (gtk_builder_get_object (page->builder, "page"));
- if (!page->page) {
+ self->page = GTK_WIDGET (gtk_builder_get_object (self->builder, "page"));
+ if (!self->page) {
g_warning ("Couldn't load page widget from %s", ui_resource);
return NULL;
}
- g_object_ref_sink (page->page);
+ g_object_ref_sink (self->page);
}
- return g_steal_pointer (&page);
+ return g_steal_pointer (&self);
}
static void
-emit_initialized (CEPage *page,
+emit_initialized (CEPage *self,
GError *error)
{
- page->initialized = TRUE;
- g_signal_emit (page, signals[INITIALIZED], 0, error);
+ self->initialized = TRUE;
+ g_signal_emit (self, signals[INITIALIZED], 0, error);
g_clear_error (&error);
}
void
-ce_page_complete_init (CEPage *page,
+ce_page_complete_init (CEPage *self,
const gchar *setting_name,
GVariant *secrets,
GError *error)
@@ -266,8 +266,8 @@ ce_page_complete_init (CEPage *page,
g_autoptr(GVariant) setting_dict = NULL;
gboolean ignore_error = FALSE;
- g_return_if_fail (page != NULL);
- g_return_if_fail (CE_IS_PAGE (page));
+ g_return_if_fail (self != NULL);
+ g_return_if_fail (CE_IS_PAGE (self));
if (error) {
ignore_error = g_error_matches (error, NM_CONNECTION_ERROR,
NM_CONNECTION_ERROR_SETTING_NOT_FOUND) ||
@@ -276,11 +276,11 @@ ce_page_complete_init (CEPage *page,
/* Ignore missing settings errors */
if (error && !ignore_error) {
- emit_initialized (page, error);
+ emit_initialized (self, error);
return;
} else if (!setting_name || !secrets || g_variant_n_children (secrets) == 0) {
/* Success, no secrets */
- emit_initialized (page, NULL);
+ emit_initialized (self, NULL);
return;
}
@@ -290,18 +290,18 @@ ce_page_complete_init (CEPage *page,
setting_dict = g_variant_lookup_value (secrets, setting_name, NM_VARIANT_TYPE_SETTING);
if (!setting_dict) {
/* Success, no secrets */
- emit_initialized (page, NULL);
+ emit_initialized (self, NULL);
return;
}
/* Update the connection with the new secrets */
- if (!nm_connection_update_secrets (page->connection,
+ if (!nm_connection_update_secrets (self->connection,
setting_name,
secrets,
&update_error))
g_warning ("Couldn't update secrets: %s", update_error->message);
- emit_initialized (page, NULL);
+ emit_initialized (self, NULL);
}
gchar **
@@ -481,9 +481,9 @@ ce_page_cloned_mac_combo_valid (GtkComboBoxText *combo)
}
const gchar *
-ce_page_get_security_setting (CEPage *page)
+ce_page_get_security_setting (CEPage *self)
{
- return page->security_setting;
+ return self->security_setting;
}
gint
diff --git a/panels/network/connection-editor/net-connection-editor.c
b/panels/network/connection-editor/net-connection-editor.c
index 869868b26..162659c73 100644
--- a/panels/network/connection-editor/net-connection-editor.c
+++ b/panels/network/connection-editor/net-connection-editor.c
@@ -49,42 +49,42 @@ static guint signals[LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE (NetConnectionEditor, net_connection_editor, GTK_TYPE_DIALOG)
-static void page_changed (NetConnectionEditor *editor);
+static void page_changed (NetConnectionEditor *self);
static void
-cancel_editing (NetConnectionEditor *editor)
+cancel_editing (NetConnectionEditor *self)
{
- gtk_widget_hide (GTK_WIDGET (editor));
- g_signal_emit (editor, signals[DONE], 0, FALSE);
+ gtk_widget_hide (GTK_WIDGET (self));
+ g_signal_emit (self, signals[DONE], 0, FALSE);
}
static void
-delete_event_cb (NetConnectionEditor *editor)
+delete_event_cb (NetConnectionEditor *self)
{
- cancel_editing (editor);
+ cancel_editing (self);
}
static void
-cancel_clicked_cb (NetConnectionEditor *editor)
+cancel_clicked_cb (NetConnectionEditor *self)
{
- cancel_editing (editor);
+ cancel_editing (self);
}
static void
-update_connection (NetConnectionEditor *editor)
+update_connection (NetConnectionEditor *self)
{
g_autoptr(GVariant) settings = NULL;
- settings = nm_connection_to_dbus (editor->connection, NM_CONNECTION_SERIALIZE_ALL);
- nm_connection_replace_settings (editor->orig_connection, settings, NULL);
+ settings = nm_connection_to_dbus (self->connection, NM_CONNECTION_SERIALIZE_ALL);
+ nm_connection_replace_settings (self->orig_connection, settings, NULL);
}
static void
-update_complete (NetConnectionEditor *editor,
+update_complete (NetConnectionEditor *self,
gboolean success)
{
- gtk_widget_hide (GTK_WIDGET (editor));
- g_signal_emit (editor, signals[DONE], 0, success);
+ gtk_widget_hide (GTK_WIDGET (self));
+ g_signal_emit (self, signals[DONE], 0, success);
}
static void
@@ -92,7 +92,7 @@ updated_connection_cb (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
- NetConnectionEditor *editor;
+ NetConnectionEditor *self;
g_autoptr(GError) error = NULL;
gboolean success = TRUE;
@@ -105,8 +105,8 @@ updated_connection_cb (GObject *source_object,
nm_connection_clear_secrets (NM_CONNECTION (source_object));
- editor = user_data;
- update_complete (editor, success);
+ self = user_data;
+ update_complete (self, success);
}
static void
@@ -114,7 +114,7 @@ added_connection_cb (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
- NetConnectionEditor *editor;
+ NetConnectionEditor *self;
g_autoptr(GError) error = NULL;
gboolean success = TRUE;
@@ -125,55 +125,55 @@ added_connection_cb (GObject *source_object,
// return; FIXME return if cancelled
}
- editor = user_data;
- update_complete (editor, success);
+ self = user_data;
+ update_complete (self, success);
}
static void
-apply_clicked_cb (NetConnectionEditor *editor)
+apply_clicked_cb (NetConnectionEditor *self)
{
- update_connection (editor);
+ update_connection (self);
- eap_method_ca_cert_ignore_save (editor->connection);
+ eap_method_ca_cert_ignore_save (self->connection);
- if (editor->is_new_connection) {
- nm_client_add_connection_async (editor->client,
- editor->orig_connection,
+ if (self->is_new_connection) {
+ nm_client_add_connection_async (self->client,
+ self->orig_connection,
TRUE,
NULL,
added_connection_cb,
- editor);
+ self);
} else {
- nm_remote_connection_commit_changes_async (NM_REMOTE_CONNECTION (editor->orig_connection),
+ nm_remote_connection_commit_changes_async (NM_REMOTE_CONNECTION (self->orig_connection),
TRUE,
NULL,
- updated_connection_cb, editor);
+ updated_connection_cb, self);
}
}
static void
-net_connection_editor_init (NetConnectionEditor *editor)
+net_connection_editor_init (NetConnectionEditor *self)
{
- gtk_widget_init_template (GTK_WIDGET (editor));
+ gtk_widget_init_template (GTK_WIDGET (self));
}
static void
net_connection_editor_finalize (GObject *object)
{
- NetConnectionEditor *editor = NET_CONNECTION_EDITOR (object);
+ NetConnectionEditor *self = NET_CONNECTION_EDITOR (object);
GSList *l;
- for (l = editor->pages; l != NULL; l = l->next)
- g_signal_handlers_disconnect_by_func (l->data, page_changed, editor);
+ for (l = self->pages; l != NULL; l = l->next)
+ g_signal_handlers_disconnect_by_func (l->data, page_changed, self);
- if (editor->permission_id > 0 && editor->client)
- g_signal_handler_disconnect (editor->client, editor->permission_id);
- g_clear_object (&editor->connection);
- g_clear_object (&editor->orig_connection);
- g_clear_object (&editor->parent_window);
- g_clear_object (&editor->device);
- g_clear_object (&editor->client);
- g_clear_object (&editor->ap);
+ if (self->permission_id > 0 && self->client)
+ g_signal_handler_disconnect (self->client, self->permission_id);
+ g_clear_object (&self->connection);
+ g_clear_object (&self->orig_connection);
+ g_clear_object (&self->parent_window);
+ g_clear_object (&self->device);
+ g_clear_object (&self->client);
+ g_clear_object (&self->ap);
G_OBJECT_CLASS (net_connection_editor_parent_class)->finalize (object);
}
@@ -209,17 +209,17 @@ net_connection_editor_class_init (NetConnectionEditorClass *class)
}
static void
-net_connection_editor_error_dialog (NetConnectionEditor *editor,
+net_connection_editor_error_dialog (NetConnectionEditor *self,
const char *primary_text,
const char *secondary_text)
{
GtkWidget *dialog;
GtkWindow *parent;
- if (gtk_widget_is_visible (GTK_WIDGET (editor)))
- parent = GTK_WINDOW (editor);
+ if (gtk_widget_is_visible (GTK_WIDGET (self)))
+ parent = GTK_WINDOW (self);
else
- parent = GTK_WINDOW (editor->parent_window);
+ parent = GTK_WINDOW (self->parent_window);
dialog = gtk_message_dialog_new (parent,
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -238,38 +238,38 @@ net_connection_editor_error_dialog (NetConnectionEditor *editor,
}
static void
-net_connection_editor_do_fallback (NetConnectionEditor *editor, const gchar *type)
+net_connection_editor_do_fallback (NetConnectionEditor *self, const gchar *type)
{
g_autofree gchar *cmdline = NULL;
g_autoptr(GError) error = NULL;
- if (editor->is_new_connection) {
+ if (self->is_new_connection) {
cmdline = g_strdup_printf ("nm-connection-editor --type='%s' --create", type);
} else {
cmdline = g_strdup_printf ("nm-connection-editor --edit='%s'",
- nm_connection_get_uuid (editor->connection));
+ nm_connection_get_uuid (self->connection));
}
g_spawn_command_line_async (cmdline, &error);
if (error)
- net_connection_editor_error_dialog (editor,
+ net_connection_editor_error_dialog (self,
_("Unable to open connection editor"),
error->message);
- g_signal_emit (editor, signals[DONE], 0, FALSE);
+ g_signal_emit (self, signals[DONE], 0, FALSE);
}
static void
-net_connection_editor_update_title (NetConnectionEditor *editor)
+net_connection_editor_update_title (NetConnectionEditor *self)
{
g_autofree gchar *id = NULL;
- if (editor->title_set)
+ if (self->title_set)
return;
- if (editor->is_new_connection) {
- if (editor->device) {
+ if (self->is_new_connection) {
+ if (self->device) {
id = g_strdup (_("New Profile"));
} else {
/* Leave it set to "Add New Connection" */
@@ -277,63 +277,63 @@ net_connection_editor_update_title (NetConnectionEditor *editor)
}
} else {
NMSettingWireless *sw;
- sw = nm_connection_get_setting_wireless (editor->connection);
+ sw = nm_connection_get_setting_wireless (self->connection);
if (sw) {
GBytes *ssid;
ssid = nm_setting_wireless_get_ssid (sw);
id = nm_utils_ssid_to_utf8 (g_bytes_get_data (ssid, NULL), g_bytes_get_size (ssid));
} else {
- id = g_strdup (nm_connection_get_id (editor->connection));
+ id = g_strdup (nm_connection_get_id (self->connection));
}
}
- gtk_window_set_title (GTK_WINDOW (editor), id);
+ gtk_window_set_title (GTK_WINDOW (self), id);
}
static gboolean
-editor_is_initialized (NetConnectionEditor *editor)
+editor_is_initialized (NetConnectionEditor *self)
{
- return editor->initializing_pages == NULL;
+ return self->initializing_pages == NULL;
}
static void
-update_sensitivity (NetConnectionEditor *editor)
+update_sensitivity (NetConnectionEditor *self)
{
NMSettingConnection *sc;
gboolean sensitive;
GtkWidget *widget;
GSList *l;
- if (!editor_is_initialized (editor))
+ if (!editor_is_initialized (self))
return;
- sc = nm_connection_get_setting_connection (editor->connection);
+ sc = nm_connection_get_setting_connection (self->connection);
if (nm_setting_connection_get_read_only (sc)) {
sensitive = FALSE;
} else {
- sensitive = editor->can_modify;
+ sensitive = self->can_modify;
}
- for (l = editor->pages; l; l = l->next) {
+ for (l = self->pages; l; l = l->next) {
widget = ce_page_get_page (CE_PAGE (l->data));
gtk_widget_set_sensitive (widget, sensitive);
}
}
static void
-validate (NetConnectionEditor *editor)
+validate (NetConnectionEditor *self)
{
gboolean valid = FALSE;
GSList *l;
- if (!editor_is_initialized (editor))
+ if (!editor_is_initialized (self))
goto done;
valid = TRUE;
- for (l = editor->pages; l; l = l->next) {
+ for (l = self->pages; l; l = l->next) {
g_autoptr(GError) error = NULL;
- if (!ce_page_validate (CE_PAGE (l->data), editor->connection, &error)) {
+ if (!ce_page_validate (CE_PAGE (l->data), self->connection, &error)) {
valid = FALSE;
if (error) {
g_debug ("Invalid setting %s: %s", ce_page_get_title (CE_PAGE (l->data)),
error->message);
@@ -343,17 +343,17 @@ validate (NetConnectionEditor *editor)
}
}
- update_sensitivity (editor);
+ update_sensitivity (self);
done:
- gtk_widget_set_sensitive (GTK_WIDGET (editor->apply_button), valid && editor->is_changed);
+ gtk_widget_set_sensitive (GTK_WIDGET (self->apply_button), valid && self->is_changed);
}
static void
-page_changed (NetConnectionEditor *editor)
+page_changed (NetConnectionEditor *self)
{
- if (editor_is_initialized (editor))
- editor->is_changed = TRUE;
- validate (editor);
+ if (editor_is_initialized (self))
+ self->is_changed = TRUE;
+ validate (self);
}
static gboolean
@@ -365,21 +365,21 @@ idle_validate (gpointer user_data)
}
static void
-recheck_initialization (NetConnectionEditor *editor)
+recheck_initialization (NetConnectionEditor *self)
{
- if (!editor_is_initialized (editor))
+ if (!editor_is_initialized (self))
return;
- gtk_notebook_set_current_page (editor->notebook, 0);
+ gtk_notebook_set_current_page (self->notebook, 0);
- if (editor->show_when_initialized)
- gtk_window_present (GTK_WINDOW (editor));
+ if (self->show_when_initialized)
+ gtk_window_present (GTK_WINDOW (self));
- g_idle_add (idle_validate, editor);
+ g_idle_add (idle_validate, self);
}
static void
-page_initialized (NetConnectionEditor *editor, GError *error, CEPage *page)
+page_initialized (NetConnectionEditor *self, GError *error, CEPage *page)
{
GtkWidget *widget;
GtkWidget *label;
@@ -390,7 +390,7 @@ page_initialized (NetConnectionEditor *editor, GError *error, CEPage *page)
widget = ce_page_get_page (page);
position = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (page), "position"));
g_object_set_data (G_OBJECT (widget), "position", GINT_TO_POINTER (position));
- children = gtk_container_get_children (GTK_CONTAINER (editor->notebook));
+ children = gtk_container_get_children (GTK_CONTAINER (self->notebook));
for (l = children, i = 0; l; l = l->next, i++) {
gint pos = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (l->data), "position"));
if (pos > position)
@@ -400,12 +400,12 @@ page_initialized (NetConnectionEditor *editor, GError *error, CEPage *page)
label = gtk_label_new (ce_page_get_title (page));
- gtk_notebook_insert_page (editor->notebook, widget, label, i);
+ gtk_notebook_insert_page (self->notebook, widget, label, i);
- editor->initializing_pages = g_slist_remove (editor->initializing_pages, page);
- editor->pages = g_slist_append (editor->pages, page);
+ self->initializing_pages = g_slist_remove (self->initializing_pages, page);
+ self->pages = g_slist_append (self->pages, page);
- recheck_initialization (editor);
+ recheck_initialization (self);
}
typedef struct {
@@ -437,18 +437,18 @@ get_secrets_cb (GObject *source_object,
}
static void
-get_secrets_for_page (NetConnectionEditor *editor,
+get_secrets_for_page (NetConnectionEditor *self,
CEPage *page,
const gchar *setting_name)
{
GetSecretsInfo *info;
info = g_new0 (GetSecretsInfo, 1);
- info->editor = editor;
+ info->editor = self;
info->page = page;
info->setting_name = setting_name;
- nm_remote_connection_get_secrets_async (NM_REMOTE_CONNECTION (editor->orig_connection),
+ nm_remote_connection_get_secrets_async (NM_REMOTE_CONNECTION (self->orig_connection),
setting_name,
NULL, //FIXME
get_secrets_cb,
@@ -456,21 +456,21 @@ get_secrets_for_page (NetConnectionEditor *editor,
}
static void
-add_page (NetConnectionEditor *editor, CEPage *page)
+add_page (NetConnectionEditor *self, CEPage *page)
{
gint position;
- position = g_slist_length (editor->initializing_pages);
+ position = g_slist_length (self->initializing_pages);
g_object_set_data (G_OBJECT (page), "position", GINT_TO_POINTER (position));
- editor->initializing_pages = g_slist_append (editor->initializing_pages, page);
+ self->initializing_pages = g_slist_append (self->initializing_pages, page);
- g_signal_connect_swapped (page, "changed", G_CALLBACK (page_changed), editor);
- g_signal_connect_swapped (page, "initialized", G_CALLBACK (page_initialized), editor);
+ g_signal_connect_swapped (page, "changed", G_CALLBACK (page_changed), self);
+ g_signal_connect_swapped (page, "initialized", G_CALLBACK (page_initialized), self);
}
static void
-net_connection_editor_set_connection (NetConnectionEditor *editor,
+net_connection_editor_set_connection (NetConnectionEditor *self,
NMConnection *connection)
{
GSList *pages, *l;
@@ -480,20 +480,20 @@ net_connection_editor_set_connection (NetConnectionEditor *editor,
gboolean is_wifi;
gboolean is_vpn;
- editor->is_new_connection = !nm_client_get_connection_by_uuid (editor->client,
+ self->is_new_connection = !nm_client_get_connection_by_uuid (self->client,
nm_connection_get_uuid (connection));
- if (editor->is_new_connection) {
- gtk_button_set_label (editor->apply_button, _("_Add"));
- editor->is_changed = TRUE;
+ if (self->is_new_connection) {
+ gtk_button_set_label (self->apply_button, _("_Add"));
+ self->is_changed = TRUE;
}
- editor->connection = nm_simple_connection_new_clone (connection);
- editor->orig_connection = g_object_ref (connection);
+ self->connection = nm_simple_connection_new_clone (connection);
+ self->orig_connection = g_object_ref (connection);
- net_connection_editor_update_title (editor);
+ net_connection_editor_update_title (self);
- eap_method_ca_cert_ignore_load (editor->connection);
+ eap_method_ca_cert_ignore_load (self->connection);
sc = nm_connection_get_setting_connection (connection);
type = nm_setting_connection_get_connection_type (sc);
@@ -502,46 +502,46 @@ net_connection_editor_set_connection (NetConnectionEditor *editor,
is_wifi = g_str_equal (type, NM_SETTING_WIRELESS_SETTING_NAME);
is_vpn = g_str_equal (type, NM_SETTING_VPN_SETTING_NAME);
- if (!editor->is_new_connection)
- add_page (editor, ce_page_details_new (editor->connection, editor->client, editor->device,
editor->ap, editor));
+ if (!self->is_new_connection)
+ add_page (self, ce_page_details_new (self->connection, self->client, self->device, self->ap,
self));
if (is_wifi)
- add_page (editor, ce_page_wifi_new (editor->connection, editor->client));
+ add_page (self, ce_page_wifi_new (self->connection, self->client));
else if (is_wired)
- add_page (editor, ce_page_ethernet_new (editor->connection, editor->client));
+ add_page (self, ce_page_ethernet_new (self->connection, self->client));
else if (is_vpn)
- add_page (editor, ce_page_vpn_new (editor->connection, editor->client));
+ add_page (self, ce_page_vpn_new (self->connection, self->client));
else {
/* Unsupported type */
- net_connection_editor_do_fallback (editor, type);
+ net_connection_editor_do_fallback (self, type);
return;
}
- add_page (editor, ce_page_ip4_new (editor->connection, editor->client));
- add_page (editor, ce_page_ip6_new (editor->connection, editor->client));
+ add_page (self, ce_page_ip4_new (self->connection, self->client));
+ add_page (self, ce_page_ip6_new (self->connection, self->client));
if (is_wifi)
- add_page (editor, ce_page_security_new (editor->connection, editor->client));
+ add_page (self, ce_page_security_new (self->connection, self->client));
else if (is_wired)
- add_page (editor, ce_page_8021x_security_new (editor->connection, editor->client));
+ add_page (self, ce_page_8021x_security_new (self->connection, self->client));
- pages = g_slist_copy (editor->initializing_pages);
+ pages = g_slist_copy (self->initializing_pages);
for (l = pages; l; l = l->next) {
CEPage *page = l->data;
const gchar *security_setting;
security_setting = ce_page_get_security_setting (page);
- if (!security_setting || editor->is_new_connection) {
+ if (!security_setting || self->is_new_connection) {
ce_page_complete_init (page, NULL, NULL, NULL);
} else {
- get_secrets_for_page (editor, page, security_setting);
+ get_secrets_for_page (self, page, security_setting);
}
}
g_slist_free (pages);
}
static NMConnection *
-complete_vpn_connection (NetConnectionEditor *editor, NMConnection *connection)
+complete_vpn_connection (NetConnectionEditor *self, NMConnection *connection)
{
NMSettingConnection *s_con;
NMSetting *s_type;
@@ -566,7 +566,7 @@ complete_vpn_connection (NetConnectionEditor *editor, NMConnection *connection)
const GPtrArray *connections;
g_autofree gchar *id = NULL;
- connections = nm_client_get_connections (editor->client);
+ connections = nm_client_get_connections (self->client);
id = ce_page_get_next_available_name (connections, NAME_FORMAT_TYPE, _("VPN"));
g_object_set (s_con,
NM_SETTING_CONNECTION_ID, id,
@@ -589,37 +589,37 @@ complete_vpn_connection (NetConnectionEditor *editor, NMConnection *connection)
}
static void
-finish_add_connection (NetConnectionEditor *editor, NMConnection *connection)
+finish_add_connection (NetConnectionEditor *self, NMConnection *connection)
{
GtkBin *frame;
- frame = GTK_BIN (editor->add_connection_frame);
+ frame = GTK_BIN (self->add_connection_frame);
gtk_widget_destroy (gtk_bin_get_child (frame));
- gtk_notebook_set_current_page (editor->toplevel_notebook, 0);
- gtk_widget_show (GTK_WIDGET (editor->apply_button));
+ gtk_notebook_set_current_page (self->toplevel_notebook, 0);
+ gtk_widget_show (GTK_WIDGET (self->apply_button));
if (connection)
- net_connection_editor_set_connection (editor, connection);
+ net_connection_editor_set_connection (self, connection);
}
static void
vpn_import_complete (NMConnection *connection, gpointer user_data)
{
- NetConnectionEditor *editor = user_data;
+ NetConnectionEditor *self = user_data;
if (!connection) {
/* The import code shows its own error dialogs. */
- g_signal_emit (editor, signals[DONE], 0, FALSE);
+ g_signal_emit (self, signals[DONE], 0, FALSE);
return;
}
- complete_vpn_connection (editor, connection);
- finish_add_connection (editor, connection);
+ complete_vpn_connection (self, connection);
+ finish_add_connection (self, connection);
}
static void
-vpn_type_activated (GtkListBox *list, GtkWidget *row, NetConnectionEditor *editor)
+vpn_type_activated (GtkListBox *list, GtkWidget *row, NetConnectionEditor *self)
{
const char *service_name = g_object_get_data (G_OBJECT (row), "service_name");
NMConnection *connection;
@@ -627,11 +627,11 @@ vpn_type_activated (GtkListBox *list, GtkWidget *row, NetConnectionEditor *edito
NMSettingConnection *s_con;
if (!strcmp (service_name, "import")) {
- vpn_import (GTK_WINDOW (editor), vpn_import_complete, editor);
+ vpn_import (GTK_WINDOW (self), vpn_import_complete, self);
return;
}
- connection = complete_vpn_connection (editor, NULL);
+ connection = complete_vpn_connection (self, NULL);
s_vpn = nm_connection_get_setting_vpn (connection);
g_object_set (s_vpn, NM_SETTING_VPN_SERVICE_TYPE, service_name, NULL);
@@ -640,11 +640,11 @@ vpn_type_activated (GtkListBox *list, GtkWidget *row, NetConnectionEditor *edito
g_object_set (s_con, NM_SETTING_CONNECTION_AUTOCONNECT, FALSE, NULL);
nm_setting_connection_add_permission (s_con, "user", g_get_user_name (), NULL);
- finish_add_connection (editor, connection);
+ finish_add_connection (self, connection);
}
static void
-select_vpn_type (NetConnectionEditor *editor, GtkListBox *list)
+select_vpn_type (NetConnectionEditor *self, GtkListBox *list)
{
GSList *vpn_plugins, *iter;
GList *l;
@@ -721,46 +721,46 @@ select_vpn_type (NetConnectionEditor *editor, GtkListBox *list)
gtk_container_add (GTK_CONTAINER (list), row);
g_signal_connect (list, "row-activated",
- G_CALLBACK (vpn_type_activated), editor);
+ G_CALLBACK (vpn_type_activated), self);
}
static void
-net_connection_editor_add_connection (NetConnectionEditor *editor)
+net_connection_editor_add_connection (NetConnectionEditor *self)
{
GtkContainer *frame;
GtkListBox *list;
- frame = GTK_CONTAINER (editor->add_connection_frame);
+ frame = GTK_CONTAINER (self->add_connection_frame);
list = GTK_LIST_BOX (gtk_list_box_new ());
gtk_list_box_set_selection_mode (list, GTK_SELECTION_NONE);
gtk_list_box_set_header_func (list, cc_list_box_update_header_func, NULL, NULL);
- select_vpn_type (editor, list);
+ select_vpn_type (self, list);
gtk_widget_show_all (GTK_WIDGET (list));
gtk_container_add (frame, GTK_WIDGET (list));
- gtk_notebook_set_current_page (editor->toplevel_notebook, 1);
- gtk_widget_hide (GTK_WIDGET (editor->apply_button));
- gtk_window_set_title (GTK_WINDOW (editor), _("Add VPN"));
+ gtk_notebook_set_current_page (self->toplevel_notebook, 1);
+ gtk_widget_hide (GTK_WIDGET (self->apply_button));
+ gtk_window_set_title (GTK_WINDOW (self), _("Add VPN"));
}
static void
permission_changed (NMClient *client,
NMClientPermission permission,
NMClientPermissionResult result,
- NetConnectionEditor *editor)
+ NetConnectionEditor *self)
{
if (permission != NM_CLIENT_PERMISSION_SETTINGS_MODIFY_SYSTEM)
return;
if (result == NM_CLIENT_PERMISSION_RESULT_YES || result == NM_CLIENT_PERMISSION_RESULT_AUTH)
- editor->can_modify = TRUE;
+ self->can_modify = TRUE;
else
- editor->can_modify = FALSE;
+ self->can_modify = FALSE;
- validate (editor);
+ validate (self);
}
NetConnectionEditor *
@@ -770,44 +770,44 @@ net_connection_editor_new (GtkWindow *parent_window,
NMAccessPoint *ap,
NMClient *client)
{
- NetConnectionEditor *editor;
+ NetConnectionEditor *self;
- editor = g_object_new (NET_TYPE_CONNECTION_EDITOR,
- /* This doesn't seem to work for a template, so it is also hardcoded. */
- "use-header-bar", 1,
- NULL);
+ self = g_object_new (NET_TYPE_CONNECTION_EDITOR,
+ /* This doesn't seem to work for a template, so it is also hardcoded. */
+ "use-header-bar", 1,
+ NULL);
if (parent_window) {
- editor->parent_window = GTK_WIDGET (g_object_ref (parent_window));
- gtk_window_set_transient_for (GTK_WINDOW (editor),
+ self->parent_window = GTK_WIDGET (g_object_ref (parent_window));
+ gtk_window_set_transient_for (GTK_WINDOW (self),
parent_window);
}
if (ap)
- editor->ap = g_object_ref (ap);
+ self->ap = g_object_ref (ap);
if (device)
- editor->device = g_object_ref (device);
- editor->client = g_object_ref (client);
+ self->device = g_object_ref (device);
+ self->client = g_object_ref (client);
- editor->can_modify = nm_client_get_permission_result (client,
NM_CLIENT_PERMISSION_SETTINGS_MODIFY_SYSTEM);
- editor->permission_id = g_signal_connect (editor->client, "permission-changed",
- G_CALLBACK (permission_changed), editor);
+ self->can_modify = nm_client_get_permission_result (client,
NM_CLIENT_PERMISSION_SETTINGS_MODIFY_SYSTEM);
+ self->permission_id = g_signal_connect (self->client, "permission-changed",
+ G_CALLBACK (permission_changed), self);
if (connection)
- net_connection_editor_set_connection (editor, connection);
+ net_connection_editor_set_connection (self, connection);
else
- net_connection_editor_add_connection (editor);
+ net_connection_editor_add_connection (self);
- return editor;
+ return self;
}
void
-net_connection_editor_run (NetConnectionEditor *editor)
+net_connection_editor_run (NetConnectionEditor *self)
{
- if (!editor_is_initialized (editor)) {
- editor->show_when_initialized = TRUE;
+ if (!editor_is_initialized (self)) {
+ self->show_when_initialized = TRUE;
return;
}
- gtk_window_present (GTK_WINDOW (editor));
+ gtk_window_present (GTK_WINDOW (self));
}
static void
@@ -816,7 +816,7 @@ forgotten_cb (GObject *source_object,
gpointer user_data)
{
NMRemoteConnection *connection = NM_REMOTE_CONNECTION (source_object);
- NetConnectionEditor *editor = user_data;
+ NetConnectionEditor *self = user_data;
g_autoptr(GError) error = NULL;
if (!nm_remote_connection_delete_finish (connection, res, &error)) {
@@ -827,29 +827,29 @@ forgotten_cb (GObject *source_object,
return;
}
- cancel_editing (editor);
+ cancel_editing (self);
}
void
-net_connection_editor_forget (NetConnectionEditor *editor)
+net_connection_editor_forget (NetConnectionEditor *self)
{
- nm_remote_connection_delete_async (NM_REMOTE_CONNECTION (editor->orig_connection),
- NULL, forgotten_cb, editor);
+ nm_remote_connection_delete_async (NM_REMOTE_CONNECTION (self->orig_connection),
+ NULL, forgotten_cb, self);
}
void
-net_connection_editor_reset (NetConnectionEditor *editor)
+net_connection_editor_reset (NetConnectionEditor *self)
{
g_autoptr(GVariant) settings = NULL;
- settings = nm_connection_to_dbus (editor->orig_connection, NM_CONNECTION_SERIALIZE_ALL);
- nm_connection_replace_settings (editor->connection, settings, NULL);
+ settings = nm_connection_to_dbus (self->orig_connection, NM_CONNECTION_SERIALIZE_ALL);
+ nm_connection_replace_settings (self->connection, settings, NULL);
}
void
-net_connection_editor_set_title (NetConnectionEditor *editor,
+net_connection_editor_set_title (NetConnectionEditor *self,
const gchar *title)
{
- gtk_window_set_title (GTK_WINDOW (editor), title);
- editor->title_set = TRUE;
+ gtk_window_set_title (GTK_WINDOW (self), title);
+ self->title_set = TRUE;
}
diff --git a/panels/network/net-device-ethernet.c b/panels/network/net-device-ethernet.c
index 4d9b94a73..eee67357a 100644
--- a/panels/network/net-device-ethernet.c
+++ b/panels/network/net-device-ethernet.c
@@ -78,10 +78,10 @@ device_ethernet_add_to_stack (NetObject *object,
GtkStack *stack,
GtkSizeGroup *heading_size_group)
{
- NetDeviceEthernet *device = NET_DEVICE_ETHERNET (object);
+ NetDeviceEthernet *self = NET_DEVICE_ETHERNET (object);
- gtk_stack_add_named (stack, GTK_WIDGET (device->box), net_object_get_id (object));
- return GTK_WIDGET (device->box);
+ gtk_stack_add_named (stack, GTK_WIDGET (self->box), net_object_get_id (object));
+ return GTK_WIDGET (self->box);
}
static void
@@ -183,7 +183,7 @@ add_details (GtkWidget *details, NMDevice *device, NMConnection *connection)
}
}
-static void populate_ui (NetDeviceEthernet *device);
+static void populate_ui (NetDeviceEthernet *self);
static gboolean
device_state_to_off_switch (NMDeviceState state)
@@ -201,41 +201,41 @@ device_state_to_off_switch (NMDeviceState state)
}
static void
-device_ethernet_refresh_ui (NetDeviceEthernet *device)
+device_ethernet_refresh_ui (NetDeviceEthernet *self)
{
NMDevice *nm_device;
NMDeviceState state;
g_autofree gchar *speed = NULL;
g_autofree gchar *status = NULL;
- nm_device = net_device_get_nm_device (NET_DEVICE (device));
+ nm_device = net_device_get_nm_device (NET_DEVICE (self));
- gtk_label_set_label (device->device_label, net_object_get_title (NET_OBJECT (device)));
+ gtk_label_set_label (self->device_label, net_object_get_title (NET_OBJECT (self)));
state = nm_device_get_state (nm_device);
- gtk_widget_set_sensitive (GTK_WIDGET (device->device_off_switch),
+ gtk_widget_set_sensitive (GTK_WIDGET (self->device_off_switch),
state != NM_DEVICE_STATE_UNAVAILABLE
&& state != NM_DEVICE_STATE_UNMANAGED);
- device->updating_device = TRUE;
- gtk_switch_set_active (device->device_off_switch, device_state_to_off_switch (state));
- device->updating_device = FALSE;
+ self->updating_device = TRUE;
+ gtk_switch_set_active (self->device_off_switch, device_state_to_off_switch (state));
+ self->updating_device = FALSE;
if (state != NM_DEVICE_STATE_UNAVAILABLE)
- speed = net_device_simple_get_speed (NET_DEVICE_SIMPLE (device));
+ speed = net_device_simple_get_speed (NET_DEVICE_SIMPLE (self));
status = panel_device_status_to_localized_string (nm_device, speed);
- hdy_action_row_set_title (device->details_row, status);
+ hdy_action_row_set_title (self->details_row, status);
- populate_ui (device);
+ populate_ui (self);
}
static void
-editor_done (NetDeviceEthernet *device)
+editor_done (NetDeviceEthernet *self)
{
- device_ethernet_refresh_ui (device);
+ device_ethernet_refresh_ui (self);
}
static void
-show_details (NetDeviceEthernet *device, GtkButton *button, const gchar *title)
+show_details (NetDeviceEthernet *self, GtkButton *button, const gchar *title)
{
GtkWidget *row;
NMConnection *connection;
@@ -244,39 +244,39 @@ show_details (NetDeviceEthernet *device, GtkButton *button, const gchar *title)
NMClient *client;
NMDevice *nmdev;
- window = gtk_widget_get_toplevel (GTK_WIDGET (device->box));
+ window = gtk_widget_get_toplevel (GTK_WIDGET (self->box));
row = g_object_get_data (G_OBJECT (button), "row");
connection = NM_CONNECTION (g_object_get_data (G_OBJECT (row), "connection"));
- nmdev = net_device_get_nm_device (NET_DEVICE (device));
- client = net_object_get_client (NET_OBJECT (device));
+ nmdev = net_device_get_nm_device (NET_DEVICE (self));
+ client = net_object_get_client (NET_OBJECT (self));
editor = net_connection_editor_new (GTK_WINDOW (window), connection, nmdev, NULL, client);
if (title)
net_connection_editor_set_title (editor, title);
- g_signal_connect_swapped (editor, "done", G_CALLBACK (editor_done), device);
+ g_signal_connect_swapped (editor, "done", G_CALLBACK (editor_done), self);
net_connection_editor_run (editor);
}
static void
-show_details_for_row (NetDeviceEthernet *device, GtkButton *button)
+show_details_for_row (NetDeviceEthernet *self, GtkButton *button)
{
- show_details (device, button, NULL);
+ show_details (self, button, NULL);
}
static void
-show_details_for_wired (NetDeviceEthernet *device)
+show_details_for_wired (NetDeviceEthernet *self)
{
/* Translators: This is used as the title of the connection
* details window for ethernet, if there is only a single
* profile. It is also used to display ethernet in the
* device list.
*/
- show_details (device, device->details_button, _("Wired"));
+ show_details (self, self->details_button, _("Wired"));
}
static void
-add_row (NetDeviceEthernet *device, NMConnection *connection)
+add_row (NetDeviceEthernet *self, NMConnection *connection)
{
GtkWidget *row;
GtkWidget *widget;
@@ -289,7 +289,7 @@ add_row (NetDeviceEthernet *device, NMConnection *connection)
active = FALSE;
- nmdev = net_device_get_nm_device (NET_DEVICE (device));
+ nmdev = net_device_get_nm_device (NET_DEVICE (self));
aconn = nm_device_get_active_connection (nmdev);
if (aconn) {
const gchar *uuid1, *uuid2;
@@ -344,75 +344,75 @@ add_row (NetDeviceEthernet *device, NMConnection *connection)
gtk_box_pack_start (GTK_BOX (box), widget, FALSE, TRUE, 0);
g_object_set_data (G_OBJECT (widget), "edit", widget);
g_object_set_data (G_OBJECT (widget), "row", row);
- g_signal_connect_swapped (widget, "clicked", G_CALLBACK (show_details_for_row), device);
+ g_signal_connect_swapped (widget, "clicked", G_CALLBACK (show_details_for_row), self);
gtk_widget_show_all (row);
g_object_set_data (G_OBJECT (row), "connection", connection);
- gtk_container_add (GTK_CONTAINER (device->list), row);
+ gtk_container_add (GTK_CONTAINER (self->list), row);
}
static void
-connection_removed (NetDeviceEthernet *device, NMRemoteConnection *connection)
+connection_removed (NetDeviceEthernet *self, NMRemoteConnection *connection)
{
- if (g_hash_table_remove (device->connections, connection))
- device_ethernet_refresh_ui (device);
+ if (g_hash_table_remove (self->connections, connection))
+ device_ethernet_refresh_ui (self);
}
static void
-populate_ui (NetDeviceEthernet *device)
+populate_ui (NetDeviceEthernet *self)
{
GList *children, *c;
GSList *connections, *l;
NMConnection *connection;
gint n_connections;
- children = gtk_container_get_children (GTK_CONTAINER (device->list));
+ children = gtk_container_get_children (GTK_CONTAINER (self->list));
for (c = children; c; c = c->next) {
- gtk_container_remove (GTK_CONTAINER (device->list), c->data);
+ gtk_container_remove (GTK_CONTAINER (self->list), c->data);
}
g_list_free (children);
- connections = net_device_get_valid_connections (NET_DEVICE (device));
+ connections = net_device_get_valid_connections (NET_DEVICE (self));
for (l = connections; l; l = l->next) {
NMConnection *connection = l->data;
- if (!g_hash_table_contains (device->connections, connection)) {
- g_hash_table_add (device->connections, connection);
+ if (!g_hash_table_contains (self->connections, connection)) {
+ g_hash_table_add (self->connections, connection);
}
}
n_connections = g_slist_length (connections);
if (n_connections > 1) {
- gtk_widget_hide (GTK_WIDGET (device->details_frame));
+ gtk_widget_hide (GTK_WIDGET (self->details_frame));
for (l = connections; l; l = l->next) {
NMConnection *connection = l->data;
- add_row (device, connection);
+ add_row (self, connection);
}
- gtk_widget_show (GTK_WIDGET (device->scrolled_window));
+ gtk_widget_show (GTK_WIDGET (self->scrolled_window));
} else if (n_connections == 1) {
connection = connections->data;
- gtk_widget_hide (GTK_WIDGET (device->scrolled_window));
- gtk_widget_show_all (GTK_WIDGET (device->details_frame));
- g_object_set_data (G_OBJECT (device->details_button), "row", device->details_button);
- g_object_set_data (G_OBJECT (device->details_button), "connection", connection);
+ gtk_widget_hide (GTK_WIDGET (self->scrolled_window));
+ gtk_widget_show_all (GTK_WIDGET (self->details_frame));
+ g_object_set_data (G_OBJECT (self->details_button), "row", self->details_button);
+ g_object_set_data (G_OBJECT (self->details_button), "connection", connection);
} else {
- gtk_widget_hide (GTK_WIDGET (device->scrolled_window));
- gtk_widget_hide (GTK_WIDGET (device->details_frame));
+ gtk_widget_hide (GTK_WIDGET (self->scrolled_window));
+ gtk_widget_hide (GTK_WIDGET (self->details_frame));
}
g_slist_free (connections);
}
static void
-client_connection_added_cb (NetDeviceEthernet *device)
+client_connection_added_cb (NetDeviceEthernet *self)
{
- device_ethernet_refresh_ui (device);
+ device_ethernet_refresh_ui (self);
}
static void
-add_profile (NetDeviceEthernet *device)
+add_profile (NetDeviceEthernet *self)
{
NMConnection *connection;
NMSettingConnection *sc;
@@ -430,7 +430,7 @@ add_profile (NetDeviceEthernet *device)
uuid = nm_utils_uuid_generate ();
- client = net_object_get_client (NET_OBJECT (device));
+ client = net_object_get_client (NET_OBJECT (self));
connections = nm_client_get_connections (client);
id = ce_page_get_next_available_name (connections, NAME_FORMAT_PROFILE, NULL);
@@ -443,29 +443,29 @@ add_profile (NetDeviceEthernet *device)
nm_connection_add_setting (connection, nm_setting_wired_new ());
- window = gtk_widget_get_toplevel (GTK_WIDGET (device->box));
+ window = gtk_widget_get_toplevel (GTK_WIDGET (self->box));
- nmdev = net_device_get_nm_device (NET_DEVICE (device));
+ nmdev = net_device_get_nm_device (NET_DEVICE (self));
editor = net_connection_editor_new (GTK_WINDOW (window), connection, nmdev, NULL, client);
- g_signal_connect_swapped (editor, "done", G_CALLBACK (editor_done), device);
+ g_signal_connect_swapped (editor, "done", G_CALLBACK (editor_done), self);
net_connection_editor_run (editor);
}
static void
-device_off_toggled (NetDeviceEthernet *device)
+device_off_toggled (NetDeviceEthernet *self)
{
NMClient *client;
NMDevice *nm_device;
NMConnection *connection;
- if (device->updating_device)
+ if (self->updating_device)
return;
- client = net_object_get_client (NET_OBJECT (device));
- nm_device = net_device_get_nm_device (NET_DEVICE (device));
+ client = net_object_get_client (NET_OBJECT (self));
+ nm_device = net_device_get_nm_device (NET_DEVICE (self));
- if (gtk_switch_get_active (device->device_off_switch)) {
- connection = net_device_get_find_connection (NET_DEVICE (device));
+ if (gtk_switch_get_active (self->device_off_switch)) {
+ connection = net_device_get_find_connection (NET_DEVICE (self));
if (connection != NULL) {
nm_client_activate_connection_async (client,
connection,
@@ -478,20 +478,20 @@ device_off_toggled (NetDeviceEthernet *device)
}
static void
-device_title_changed (NetDeviceEthernet *device)
+device_title_changed (NetDeviceEthernet *self)
{
- device_ethernet_refresh_ui (device);
+ device_ethernet_refresh_ui (self);
}
static void
-connection_activated (NetDeviceEthernet *device, GtkListBoxRow *row)
+connection_activated (NetDeviceEthernet *self, GtkListBoxRow *row)
{
NMClient *client;
NMDevice *nm_device;
NMConnection *connection;
- client = net_object_get_client (NET_OBJECT (device));
- nm_device = net_device_get_nm_device (NET_DEVICE (device));
+ client = net_object_get_client (NET_OBJECT (self));
+ nm_device = net_device_get_nm_device (NET_DEVICE (self));
if (!NM_IS_DEVICE_ETHERNET (nm_device) ||
!nm_device_ethernet_get_carrier (NM_DEVICE_ETHERNET (nm_device)))
@@ -508,42 +508,42 @@ connection_activated (NetDeviceEthernet *device, GtkListBoxRow *row)
static void
device_ethernet_constructed (GObject *object)
{
- NetDeviceEthernet *device = NET_DEVICE_ETHERNET (object);
+ NetDeviceEthernet *self = NET_DEVICE_ETHERNET (object);
NMClient *client;
- g_signal_connect_swapped (device->device_off_switch, "notify::active",
- G_CALLBACK (device_off_toggled), device);
+ g_signal_connect_swapped (self->device_off_switch, "notify::active",
+ G_CALLBACK (device_off_toggled), self);
- device->list = GTK_LIST_BOX (gtk_list_box_new ());
- gtk_list_box_set_selection_mode (device->list, GTK_SELECTION_NONE);
- gtk_list_box_set_header_func (device->list, cc_list_box_update_header_func, NULL, NULL);
- gtk_container_add (GTK_CONTAINER (device->scrolled_window), GTK_WIDGET (device->list));
- g_signal_connect_swapped (device->list, "row-activated",
- G_CALLBACK (connection_activated), device);
- gtk_widget_show (GTK_WIDGET (device->list));
+ self->list = GTK_LIST_BOX (gtk_list_box_new ());
+ gtk_list_box_set_selection_mode (self->list, GTK_SELECTION_NONE);
+ gtk_list_box_set_header_func (self->list, cc_list_box_update_header_func, NULL, NULL);
+ gtk_container_add (GTK_CONTAINER (self->scrolled_window), GTK_WIDGET (self->list));
+ g_signal_connect_swapped (self->list, "row-activated",
+ G_CALLBACK (connection_activated), self);
+ gtk_widget_show (GTK_WIDGET (self->list));
- g_signal_connect_swapped (device->details_button, "clicked",
- G_CALLBACK (show_details_for_wired), device);
+ g_signal_connect_swapped (self->details_button, "clicked",
+ G_CALLBACK (show_details_for_wired), self);
- g_signal_connect_swapped (device->add_profile_button, "clicked",
- G_CALLBACK (add_profile), device);
+ g_signal_connect_swapped (self->add_profile_button, "clicked",
+ G_CALLBACK (add_profile), self);
client = net_object_get_client (NET_OBJECT (object));
g_signal_connect_object (client, NM_CLIENT_CONNECTION_ADDED,
G_CALLBACK (client_connection_added_cb), object, G_CONNECT_SWAPPED);
g_signal_connect_object (client, NM_CLIENT_CONNECTION_REMOVED,
- G_CALLBACK (connection_removed), device, G_CONNECT_SWAPPED);
+ G_CALLBACK (connection_removed), self, G_CONNECT_SWAPPED);
- device_ethernet_refresh_ui (device);
+ device_ethernet_refresh_ui (self);
}
static void
device_ethernet_finalize (GObject *object)
{
- NetDeviceEthernet *device = NET_DEVICE_ETHERNET (object);
+ NetDeviceEthernet *self = NET_DEVICE_ETHERNET (object);
- g_object_unref (device->builder);
- g_hash_table_destroy (device->connections);
+ g_object_unref (self->builder);
+ g_hash_table_destroy (self->connections);
G_OBJECT_CLASS (net_device_ethernet_parent_class)->finalize (object);
}
@@ -551,8 +551,8 @@ device_ethernet_finalize (GObject *object)
static void
device_ethernet_refresh (NetObject *object)
{
- NetDeviceEthernet *device = NET_DEVICE_ETHERNET (object);
- device_ethernet_refresh_ui (device);
+ NetDeviceEthernet *self = NET_DEVICE_ETHERNET (object);
+ device_ethernet_refresh_ui (self);
}
static void
@@ -570,12 +570,12 @@ net_device_ethernet_class_init (NetDeviceEthernetClass *klass)
}
static void
-net_device_ethernet_init (NetDeviceEthernet *device)
+net_device_ethernet_init (NetDeviceEthernet *self)
{
g_autoptr(GError) error = NULL;
- device->builder = gtk_builder_new ();
- gtk_builder_add_from_resource (device->builder,
+ self->builder = gtk_builder_new ();
+ gtk_builder_add_from_resource (self->builder,
"/org/gnome/control-center/network/network-ethernet.ui",
&error);
if (error != NULL) {
@@ -583,16 +583,16 @@ net_device_ethernet_init (NetDeviceEthernet *device)
return;
}
- device->add_profile_button = GTK_BUTTON (gtk_builder_get_object (device->builder,
"add_profile_button"));
- device->box = GTK_BOX (gtk_builder_get_object (device->builder, "box"));
- device->details_button = GTK_BUTTON (gtk_builder_get_object (device->builder, "details_button"));
- device->details_frame = GTK_FRAME (gtk_builder_get_object (device->builder, "details_frame"));
- device->details_row = HDY_ACTION_ROW (gtk_builder_get_object (device->builder, "details_row"));
- device->device_label = GTK_LABEL (gtk_builder_get_object (device->builder, "device_label"));
- device->device_off_switch = GTK_SWITCH (gtk_builder_get_object (device->builder,
"device_off_switch"));
- device->scrolled_window = GTK_SCROLLED_WINDOW (gtk_builder_get_object (device->builder,
"scrolled_window"));
+ self->add_profile_button = GTK_BUTTON (gtk_builder_get_object (self->builder, "add_profile_button"));
+ self->box = GTK_BOX (gtk_builder_get_object (self->builder, "box"));
+ self->details_button = GTK_BUTTON (gtk_builder_get_object (self->builder, "details_button"));
+ self->details_frame = GTK_FRAME (gtk_builder_get_object (self->builder, "details_frame"));
+ self->details_row = HDY_ACTION_ROW (gtk_builder_get_object (self->builder, "details_row"));
+ self->device_label = GTK_LABEL (gtk_builder_get_object (self->builder, "device_label"));
+ self->device_off_switch = GTK_SWITCH (gtk_builder_get_object (self->builder, "device_off_switch"));
+ self->scrolled_window = GTK_SCROLLED_WINDOW (gtk_builder_get_object (self->builder,
"scrolled_window"));
- device->connections = g_hash_table_new (NULL, NULL);
+ self->connections = g_hash_table_new (NULL, NULL);
- g_signal_connect (device, "notify::title", G_CALLBACK (device_title_changed), NULL);
+ g_signal_connect (self, "notify::title", G_CALLBACK (device_title_changed), NULL);
}
diff --git a/panels/network/net-device-mobile.c b/panels/network/net-device-mobile.c
index cf3c98f05..044ddc934 100644
--- a/panels/network/net-device-mobile.c
+++ b/panels/network/net-device-mobile.c
@@ -33,7 +33,7 @@
#include "network-dialogs.h"
#include "net-device-mobile.h"
-static void nm_device_mobile_refresh_ui (NetDeviceMobile *device_mobile);
+static void nm_device_mobile_refresh_ui (NetDeviceMobile *self);
struct _NetDeviceMobile
{
@@ -93,14 +93,14 @@ device_mobile_proxy_add_to_stack (NetObject *object,
GtkStack *stack,
GtkSizeGroup *heading_size_group)
{
- NetDeviceMobile *device_mobile = NET_DEVICE_MOBILE (object);
+ NetDeviceMobile *self = NET_DEVICE_MOBILE (object);
/* add widgets to size group */
- gtk_size_group_add_widget (heading_size_group, GTK_WIDGET (device_mobile->imei_heading_label));
- gtk_size_group_add_widget (heading_size_group, GTK_WIDGET (device_mobile->network_label));
+ gtk_size_group_add_widget (heading_size_group, GTK_WIDGET (self->imei_heading_label));
+ gtk_size_group_add_widget (heading_size_group, GTK_WIDGET (self->network_label));
- gtk_stack_add_named (stack, GTK_WIDGET (device_mobile->box), net_object_get_id (object));
- return GTK_WIDGET (device_mobile->box);
+ gtk_stack_add_named (stack, GTK_WIDGET (self->box), net_object_get_id (object));
+ return GTK_WIDGET (self->box);
}
static void
@@ -117,7 +117,7 @@ connection_activate_cb (GObject *source_object,
}
static void
-mobile_connection_changed_cb (NetDeviceMobile *device_mobile)
+mobile_connection_changed_cb (NetDeviceMobile *self)
{
gboolean ret;
g_autofree gchar *object_path = NULL;
@@ -129,25 +129,25 @@ mobile_connection_changed_cb (NetDeviceMobile *device_mobile)
CcNetworkPanel *panel;
GtkWidget *toplevel;
- if (device_mobile->updating_device)
+ if (self->updating_device)
return;
- ret = gtk_combo_box_get_active_iter (device_mobile->network_combo, &iter);
+ ret = gtk_combo_box_get_active_iter (self->network_combo, &iter);
if (!ret)
return;
- device = net_device_get_nm_device (NET_DEVICE (device_mobile));
+ device = net_device_get_nm_device (NET_DEVICE (self));
if (device == NULL)
return;
- client = net_object_get_client (NET_OBJECT (device_mobile));
+ client = net_object_get_client (NET_OBJECT (self));
/* get entry */
- model = gtk_combo_box_get_model (device_mobile->network_combo);
+ model = gtk_combo_box_get_model (self->network_combo);
gtk_tree_model_get (model, &iter,
COLUMN_ID, &object_path,
-1);
if (g_strcmp0 (object_path, NULL) == 0) {
- panel = net_object_get_panel (NET_OBJECT (device_mobile));
+ panel = net_object_get_panel (NET_OBJECT (self));
toplevel = cc_shell_get_toplevel (cc_panel_get_shell (CC_PANEL (panel)));
cc_network_panel_connect_to_3g_network (toplevel,
client,
@@ -164,22 +164,22 @@ mobile_connection_changed_cb (NetDeviceMobile *device_mobile)
connection,
device, NULL, NULL,
connection_activate_cb,
- device_mobile);
+ self);
return;
}
}
static void
-mobilebb_enabled_toggled (NetDeviceMobile *device_mobile)
+mobilebb_enabled_toggled (NetDeviceMobile *self)
{
gboolean enabled = FALSE;
NMDevice *device;
- device = net_device_get_nm_device (NET_DEVICE (device_mobile));
+ device = net_device_get_nm_device (NET_DEVICE (self));
if (nm_device_get_device_type (device) != NM_DEVICE_TYPE_MODEM)
return;
- if (nm_client_wwan_get_enabled (net_object_get_client (NET_OBJECT (device_mobile)))) {
+ if (nm_client_wwan_get_enabled (net_object_get_client (NET_OBJECT (self)))) {
NMDeviceState state;
state = nm_device_get_state (device);
@@ -195,13 +195,13 @@ mobilebb_enabled_toggled (NetDeviceMobile *device_mobile)
}
}
- device_mobile->updating_device = TRUE;
- gtk_switch_set_active (device_mobile->device_off_switch, enabled);
- device_mobile->updating_device = FALSE;
+ self->updating_device = TRUE;
+ gtk_switch_set_active (self->device_off_switch, enabled);
+ self->updating_device = FALSE;
}
static void
-device_add_device_connections (NetDeviceMobile *device_mobile,
+device_add_device_connections (NetDeviceMobile *self,
NMDevice *nm_device,
GtkListStore *liststore,
GtkComboBox *combobox)
@@ -212,7 +212,7 @@ device_add_device_connections (NetDeviceMobile *device_mobile,
NMConnection *connection;
/* get the list of available connections for this device */
- list = net_device_get_valid_connections (NET_DEVICE (device_mobile));
+ list = net_device_get_valid_connections (NET_DEVICE (self));
gtk_list_store_clear (liststore);
active_connection = nm_device_get_active_connection (nm_device);
for (l = list; l; l = g_slist_next (l)) {
@@ -228,9 +228,9 @@ device_add_device_connections (NetDeviceMobile *device_mobile,
if (active_connection != NULL &&
g_strcmp0 (nm_connection_get_uuid (connection),
nm_active_connection_get_uuid (active_connection)) == 0) {
- device_mobile->updating_device = TRUE;
+ self->updating_device = TRUE;
gtk_combo_box_set_active_iter (combobox, &treeiter);
- device_mobile->updating_device = FALSE;
+ self->updating_device = FALSE;
}
}
@@ -246,46 +246,46 @@ device_add_device_connections (NetDeviceMobile *device_mobile,
}
static void
-device_mobile_refresh_equipment_id (NetDeviceMobile *device_mobile)
+device_mobile_refresh_equipment_id (NetDeviceMobile *self)
{
const gchar *equipment_id = NULL;
- if (device_mobile->mm_object != NULL) {
+ if (self->mm_object != NULL) {
MMModem *modem;
/* Modem interface should always be present */
- modem = mm_object_peek_modem (device_mobile->mm_object);
+ modem = mm_object_peek_modem (self->mm_object);
equipment_id = mm_modem_get_equipment_identifier (modem);
/* Set equipment ID */
if (equipment_id != NULL) {
g_debug ("[%s] Equipment ID set to '%s'",
- mm_object_get_path (device_mobile->mm_object),
+ mm_object_get_path (self->mm_object),
equipment_id);
}
} else {
/* Assume old MM handling */
- equipment_id = g_object_get_data (G_OBJECT (device_mobile),
+ equipment_id = g_object_get_data (G_OBJECT (self),
"ControlCenter::EquipmentIdentifier");
}
- panel_set_device_widget_details (device_mobile->imei_heading_label, device_mobile->imei_label,
equipment_id);
+ panel_set_device_widget_details (self->imei_heading_label, self->imei_label, equipment_id);
}
static gchar *
-device_mobile_find_provider (NetDeviceMobile *device_mobile,
+device_mobile_find_provider (NetDeviceMobile *self,
const gchar *mccmnc,
guint32 sid)
{
NMAMobileProvider *provider;
GString *name = NULL;
- if (device_mobile->mpd == NULL) {
+ if (self->mpd == NULL) {
g_autoptr(GError) error = NULL;
/* Use defaults */
- device_mobile->mpd = nma_mobile_providers_database_new_sync (NULL, NULL, NULL, &error);
- if (device_mobile->mpd == NULL) {
+ self->mpd = nma_mobile_providers_database_new_sync (NULL, NULL, NULL, &error);
+ if (self->mpd == NULL) {
g_debug ("Couldn't load mobile providers database: %s",
error ? error->message : "");
return NULL;
@@ -293,13 +293,13 @@ device_mobile_find_provider (NetDeviceMobile *device_mobile,
}
if (mccmnc != NULL) {
- provider = nma_mobile_providers_database_lookup_3gpp_mcc_mnc (device_mobile->mpd, mccmnc);
+ provider = nma_mobile_providers_database_lookup_3gpp_mcc_mnc (self->mpd, mccmnc);
if (provider != NULL)
name = g_string_new (nma_mobile_provider_get_name (provider));
}
if (sid != 0) {
- provider = nma_mobile_providers_database_lookup_cdma_sid (device_mobile->mpd, sid);
+ provider = nma_mobile_providers_database_lookup_cdma_sid (self->mpd, sid);
if (provider != NULL) {
if (name == NULL)
name = g_string_new (nma_mobile_provider_get_name (provider));
@@ -312,15 +312,15 @@ device_mobile_find_provider (NetDeviceMobile *device_mobile,
}
static void
-device_mobile_refresh_operator_name (NetDeviceMobile *device_mobile)
+device_mobile_refresh_operator_name (NetDeviceMobile *self)
{
- if (device_mobile->mm_object != NULL) {
+ if (self->mm_object != NULL) {
g_autofree gchar *operator_name = NULL;
MMModem3gpp *modem_3gpp;
MMModemCdma *modem_cdma;
- modem_3gpp = mm_object_peek_modem_3gpp (device_mobile->mm_object);
- modem_cdma = mm_object_peek_modem_cdma (device_mobile->mm_object);
+ modem_3gpp = mm_object_peek_modem_3gpp (self->mm_object);
+ modem_cdma = mm_object_peek_modem_cdma (self->mm_object);
if (modem_3gpp != NULL) {
const gchar *operator_name_unsafe;
@@ -340,96 +340,96 @@ device_mobile_refresh_operator_name (NetDeviceMobile *device_mobile)
mccmnc = mm_modem_3gpp_get_operator_code (modem_3gpp);
if (modem_cdma != NULL)
sid = mm_modem_cdma_get_sid (modem_cdma);
- operator_name = device_mobile_find_provider (device_mobile, mccmnc, sid);
+ operator_name = device_mobile_find_provider (self, mccmnc, sid);
}
/* Set operator name */
if (operator_name != NULL) {
g_debug ("[%s] Operator name set to '%s'",
- mm_object_get_path (device_mobile->mm_object),
+ mm_object_get_path (self->mm_object),
operator_name);
}
- panel_set_device_widget_details (device_mobile->provider_heading_label,
device_mobile->provider_label, operator_name);
+ panel_set_device_widget_details (self->provider_heading_label, self->provider_label,
operator_name);
} else {
const gchar *gsm;
const gchar *cdma;
/* Assume old MM handling */
- gsm = g_object_get_data (G_OBJECT (device_mobile),
+ gsm = g_object_get_data (G_OBJECT (self),
"ControlCenter::OperatorNameGsm");
- cdma = g_object_get_data (G_OBJECT (device_mobile),
+ cdma = g_object_get_data (G_OBJECT (self),
"ControlCenter::OperatorNameCdma");
if (gsm != NULL && cdma != NULL) {
g_autofree gchar *both = g_strdup_printf ("%s, %s", gsm, cdma);
- panel_set_device_widget_details (device_mobile->provider_heading_label,
device_mobile->provider_label, both);
+ panel_set_device_widget_details (self->provider_heading_label, self->provider_label,
both);
} else if (gsm != NULL) {
- panel_set_device_widget_details (device_mobile->provider_heading_label,
device_mobile->provider_label, gsm);
+ panel_set_device_widget_details (self->provider_heading_label, self->provider_label,
gsm);
} else if (cdma != NULL) {
- panel_set_device_widget_details (device_mobile->provider_heading_label,
device_mobile->provider_label, cdma);
+ panel_set_device_widget_details (self->provider_heading_label, self->provider_label,
cdma);
} else {
- panel_set_device_widget_details (device_mobile->provider_heading_label,
device_mobile->provider_label, NULL);
+ panel_set_device_widget_details (self->provider_heading_label, self->provider_label,
NULL);
}
}
}
static void
-nm_device_mobile_refresh_ui (NetDeviceMobile *device_mobile)
+nm_device_mobile_refresh_ui (NetDeviceMobile *self)
{
gboolean is_connected;
NMDeviceModemCapabilities caps;
NMDevice *nm_device;
g_autofree gchar *status = NULL;
- nm_device = net_device_get_nm_device (NET_DEVICE (device_mobile));
+ nm_device = net_device_get_nm_device (NET_DEVICE (self));
/* set device kind */
- g_object_bind_property (device_mobile, "title", device_mobile->device_label, "label", 0);
+ g_object_bind_property (self, "title", self->device_label, "label", 0);
/* set up the device on/off switch */
- gtk_widget_show (GTK_WIDGET (device_mobile->device_off_switch));
- mobilebb_enabled_toggled (device_mobile);
+ gtk_widget_show (GTK_WIDGET (self->device_off_switch));
+ mobilebb_enabled_toggled (self);
/* set device state, with status */
status = panel_device_status_to_localized_string (nm_device, NULL);
- gtk_label_set_label (device_mobile->status_label, status);
+ gtk_label_set_label (self->status_label, status);
/* sensitive for other connection types if the device is currently connected */
- is_connected = net_device_get_find_connection (NET_DEVICE (device_mobile)) != NULL;
- gtk_widget_set_sensitive (GTK_WIDGET (device_mobile->options_button), is_connected);
+ is_connected = net_device_get_find_connection (NET_DEVICE (self)) != NULL;
+ gtk_widget_set_sensitive (GTK_WIDGET (self->options_button), is_connected);
caps = nm_device_modem_get_current_capabilities (NM_DEVICE_MODEM (nm_device));
if ((caps & NM_DEVICE_MODEM_CAPABILITY_GSM_UMTS) ||
(caps & NM_DEVICE_MODEM_CAPABILITY_CDMA_EVDO) ||
(caps & NM_DEVICE_MODEM_CAPABILITY_LTE)) {
- device_mobile_refresh_operator_name (device_mobile);
- device_mobile_refresh_equipment_id (device_mobile);
+ device_mobile_refresh_operator_name (self);
+ device_mobile_refresh_equipment_id (self);
}
/* add possible connections to device */
- device_add_device_connections (device_mobile,
+ device_add_device_connections (self,
nm_device,
- device_mobile->mobile_connections_list_store,
- device_mobile->network_combo);
+ self->mobile_connections_list_store,
+ self->network_combo);
/* set IP entries */
- panel_set_device_widgets (device_mobile->ipv4_heading_label, device_mobile->ipv4_label,
- device_mobile->ipv6_heading_label, device_mobile->ipv6_label,
- device_mobile->dns_heading_label, device_mobile->dns_label,
- device_mobile->route_heading_label, device_mobile->route_label,
+ panel_set_device_widgets (self->ipv4_heading_label, self->ipv4_label,
+ self->ipv6_heading_label, self->ipv6_label,
+ self->dns_heading_label, self->dns_label,
+ self->route_heading_label, self->route_label,
nm_device);
}
static void
device_mobile_refresh (NetObject *object)
{
- NetDeviceMobile *device_mobile = NET_DEVICE_MOBILE (object);
- nm_device_mobile_refresh_ui (device_mobile);
+ NetDeviceMobile *self = NET_DEVICE_MOBILE (object);
+ nm_device_mobile_refresh_ui (self);
}
static void
-device_off_toggled (NetDeviceMobile *device_mobile)
+device_off_toggled (NetDeviceMobile *self)
{
const GPtrArray *acs;
gboolean active;
@@ -438,27 +438,27 @@ device_off_toggled (NetDeviceMobile *device_mobile)
NMConnection *connection;
NMClient *client;
- if (device_mobile->updating_device)
+ if (self->updating_device)
return;
- active = gtk_switch_get_active (device_mobile->device_off_switch);
+ active = gtk_switch_get_active (self->device_off_switch);
if (active) {
- client = net_object_get_client (NET_OBJECT (device_mobile));
- connection = net_device_get_find_connection (NET_DEVICE (device_mobile));
+ client = net_object_get_client (NET_OBJECT (self));
+ connection = net_device_get_find_connection (NET_DEVICE (self));
if (connection == NULL)
return;
nm_client_activate_connection_async (client,
connection,
- net_device_get_nm_device (NET_DEVICE (device_mobile)),
+ net_device_get_nm_device (NET_DEVICE (self)),
NULL, NULL, NULL, NULL);
} else {
const gchar *uuid;
- connection = net_device_get_find_connection (NET_DEVICE (device_mobile));
+ connection = net_device_get_find_connection (NET_DEVICE (self));
if (connection == NULL)
return;
uuid = nm_connection_get_uuid (connection);
- client = net_object_get_client (NET_OBJECT (device_mobile));
+ client = net_object_get_client (NET_OBJECT (self));
acs = nm_client_get_active_connections (client);
for (i = 0; acs && i < acs->len; i++) {
a = (NMActiveConnection*)acs->pdata[i];
@@ -471,9 +471,9 @@ device_off_toggled (NetDeviceMobile *device_mobile)
}
static void
-edit_connection (NetDeviceMobile *device_mobile)
+edit_connection (NetDeviceMobile *self)
{
- net_object_edit (NET_OBJECT (device_mobile));
+ net_object_edit (NET_OBJECT (self));
}
static void
@@ -484,7 +484,7 @@ device_mobile_device_got_modem_manager_cb (GObject *source_object,
g_autoptr(GError) error = NULL;
g_autoptr(GVariant) result = NULL;
g_autoptr(GDBusProxy) proxy = NULL;
- NetDeviceMobile *device_mobile = (NetDeviceMobile *)user_data;
+ NetDeviceMobile *self = (NetDeviceMobile *)user_data;
proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
if (!proxy) {
@@ -499,16 +499,16 @@ device_mobile_device_got_modem_manager_cb (GObject *source_object,
/* save */
if (result)
- g_object_set_data_full (G_OBJECT (device_mobile),
+ g_object_set_data_full (G_OBJECT (self),
"ControlCenter::EquipmentIdentifier",
g_variant_dup_string (result, NULL),
g_free);
- device_mobile_refresh_equipment_id (device_mobile);
+ device_mobile_refresh_equipment_id (self);
}
static void
-device_mobile_save_operator_name (NetDeviceMobile *device_mobile,
+device_mobile_save_operator_name (NetDeviceMobile *self,
const gchar *field,
const gchar *operator_name)
{
@@ -518,12 +518,12 @@ device_mobile_save_operator_name (NetDeviceMobile *device_mobile,
operator_name_safe = g_strescape (operator_name, NULL);
/* save */
- g_object_set_data_full (G_OBJECT (device_mobile),
+ g_object_set_data_full (G_OBJECT (self),
field,
operator_name_safe,
g_free);
/* refresh */
- device_mobile_refresh_operator_name (device_mobile);
+ device_mobile_refresh_operator_name (self);
}
static void
@@ -536,7 +536,7 @@ device_mobile_get_registration_info_cb (GObject *source_object,
guint registration_status;
g_autoptr(GVariant) result = NULL;
g_autofree gchar *operator_name = NULL;
- NetDeviceMobile *device_mobile = (NetDeviceMobile *)user_data;
+ NetDeviceMobile *self = (NetDeviceMobile *)user_data;
result = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), res, &error);
if (result == NULL) {
@@ -554,17 +554,17 @@ device_mobile_get_registration_info_cb (GObject *source_object,
/* If none give, try to guess it */
if (operator_name == NULL || operator_name[0] == '\0') {
g_free (operator_name);
- operator_name = device_mobile_find_provider (device_mobile, operator_code, 0);
+ operator_name = device_mobile_find_provider (self, operator_code, 0);
}
/* save and refresh */
- device_mobile_save_operator_name (device_mobile,
+ device_mobile_save_operator_name (self,
"ControlCenter::OperatorNameGsm",
operator_name);
}
static void
-device_mobile_gsm_signal_cb (NetDeviceMobile *device_mobile,
+device_mobile_gsm_signal_cb (NetDeviceMobile *self,
const gchar *sender_name,
const gchar *signal_name,
GVariant *parameters)
@@ -585,11 +585,11 @@ device_mobile_gsm_signal_cb (NetDeviceMobile *device_mobile,
/* If none given, try to guess it */
if (operator_name == NULL || operator_name[0] == '\0') {
g_free (operator_name);
- operator_name = device_mobile_find_provider (device_mobile, operator_code, 0);
+ operator_name = device_mobile_find_provider (self, operator_code, 0);
}
/* save and refresh */
- device_mobile_save_operator_name (device_mobile,
+ device_mobile_save_operator_name (self,
"ControlCenter::OperatorNameGsm",
operator_name);
}
@@ -600,30 +600,30 @@ device_mobile_device_got_modem_manager_gsm_cb (GObject *source_object,
gpointer user_data)
{
g_autoptr(GError) error = NULL;
- NetDeviceMobile *device_mobile = (NetDeviceMobile *)user_data;
+ NetDeviceMobile *self = (NetDeviceMobile *)user_data;
- device_mobile->gsm_proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
- if (device_mobile->gsm_proxy == NULL) {
+ self->gsm_proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
+ if (self->gsm_proxy == NULL) {
g_warning ("Error creating ModemManager GSM proxy: %s\n",
error->message);
return;
}
/* Setup value updates */
- g_signal_connect_swapped (device_mobile->gsm_proxy,
+ g_signal_connect_swapped (self->gsm_proxy,
"g-signal",
G_CALLBACK (device_mobile_gsm_signal_cb),
- device_mobile);
+ self);
/* Load initial value */
- g_dbus_proxy_call (device_mobile->gsm_proxy,
+ g_dbus_proxy_call (self->gsm_proxy,
"GetRegistrationInfo",
NULL,
G_DBUS_CALL_FLAGS_NONE,
-1,
NULL,
device_mobile_get_registration_info_cb,
- device_mobile);
+ self);
}
static void
@@ -631,7 +631,7 @@ device_mobile_get_serving_system_cb (GObject *source_object,
GAsyncResult *res,
gpointer user_data)
{
- NetDeviceMobile *device_mobile = (NetDeviceMobile *)user_data;
+ NetDeviceMobile *self = (NetDeviceMobile *)user_data;
g_autoptr(GVariant) result = NULL;
g_autoptr(GError) error = NULL;
@@ -653,10 +653,10 @@ device_mobile_get_serving_system_cb (GObject *source_object,
&band,
&sid);
- operator_name = device_mobile_find_provider (device_mobile, NULL, sid);
+ operator_name = device_mobile_find_provider (self, NULL, sid);
/* save and refresh */
- device_mobile_save_operator_name (device_mobile,
+ device_mobile_save_operator_name (self,
"ControlCenter::OperatorNameCdma",
operator_name);
}
@@ -667,39 +667,39 @@ device_mobile_device_got_modem_manager_cdma_cb (GObject *source_object,
gpointer user_data)
{
g_autoptr(GError) error = NULL;
- NetDeviceMobile *device_mobile = (NetDeviceMobile *)user_data;
+ NetDeviceMobile *self = (NetDeviceMobile *)user_data;
- device_mobile->cdma_proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
- if (device_mobile->cdma_proxy == NULL) {
+ self->cdma_proxy = g_dbus_proxy_new_for_bus_finish (res, &error);
+ if (self->cdma_proxy == NULL) {
g_warning ("Error creating ModemManager CDMA proxy: %s\n",
error->message);
return;
}
/* Load initial value */
- g_dbus_proxy_call (device_mobile->cdma_proxy,
+ g_dbus_proxy_call (self->cdma_proxy,
"GetServingSystem",
NULL,
G_DBUS_CALL_FLAGS_NONE,
-1,
NULL,
device_mobile_get_serving_system_cb,
- device_mobile);
+ self);
}
static void
net_device_mobile_constructed (GObject *object)
{
GCancellable *cancellable;
- NetDeviceMobile *device_mobile = NET_DEVICE_MOBILE (object);
+ NetDeviceMobile *self = NET_DEVICE_MOBILE (object);
NMClient *client;
NMDevice *device;
NMDeviceModemCapabilities caps;
G_OBJECT_CLASS (net_device_mobile_parent_class)->constructed (object);
- device = net_device_get_nm_device (NET_DEVICE (device_mobile));
- cancellable = net_object_get_cancellable (NET_OBJECT (device_mobile));
+ device = net_device_get_nm_device (NET_DEVICE (self));
+ cancellable = net_object_get_cancellable (NET_OBJECT (self));
caps = nm_device_modem_get_current_capabilities (NM_DEVICE_MODEM (device));
@@ -716,7 +716,7 @@ net_device_mobile_constructed (GObject *object)
"org.freedesktop.ModemManager.Modem",
cancellable,
device_mobile_device_got_modem_manager_cb,
- device_mobile);
+ self);
if ((caps & NM_DEVICE_MODEM_CAPABILITY_GSM_UMTS) ||
(caps & NM_DEVICE_MODEM_CAPABILITY_LTE)) {
@@ -728,7 +728,7 @@ net_device_mobile_constructed (GObject *object)
"org.freedesktop.ModemManager.Modem.Gsm.Network",
cancellable,
device_mobile_device_got_modem_manager_gsm_cb,
- device_mobile);
+ self);
}
if (caps & NM_DEVICE_MODEM_CAPABILITY_CDMA_EVDO) {
@@ -740,15 +740,15 @@ net_device_mobile_constructed (GObject *object)
"org.freedesktop.ModemManager.Modem.Cdma",
cancellable,
device_mobile_device_got_modem_manager_cdma_cb,
- device_mobile);
+ self);
}
}
- client = net_object_get_client (NET_OBJECT (device_mobile));
+ client = net_object_get_client (NET_OBJECT (self));
g_signal_connect_object (client, "notify::wwan-enabled",
G_CALLBACK (mobilebb_enabled_toggled),
- device_mobile, G_CONNECT_SWAPPED);
- nm_device_mobile_refresh_ui (device_mobile);
+ self, G_CONNECT_SWAPPED);
+ nm_device_mobile_refresh_ui (self);
}
static void
@@ -821,19 +821,19 @@ net_device_mobile_set_property (GObject *device_,
static void
net_device_mobile_dispose (GObject *object)
{
- NetDeviceMobile *device_mobile = NET_DEVICE_MOBILE (object);
+ NetDeviceMobile *self = NET_DEVICE_MOBILE (object);
- g_clear_object (&device_mobile->builder);
- g_clear_object (&device_mobile->gsm_proxy);
- g_clear_object (&device_mobile->cdma_proxy);
+ g_clear_object (&self->builder);
+ g_clear_object (&self->gsm_proxy);
+ g_clear_object (&self->cdma_proxy);
- if (device_mobile->operator_name_updated) {
- g_assert (device_mobile->mm_object != NULL);
- g_signal_handler_disconnect (mm_object_peek_modem_3gpp (device_mobile->mm_object),
device_mobile->operator_name_updated);
- device_mobile->operator_name_updated = 0;
+ if (self->operator_name_updated) {
+ g_assert (self->mm_object != NULL);
+ g_signal_handler_disconnect (mm_object_peek_modem_3gpp (self->mm_object),
self->operator_name_updated);
+ self->operator_name_updated = 0;
}
- g_clear_object (&device_mobile->mm_object);
- g_clear_object (&device_mobile->mpd);
+ g_clear_object (&self->mm_object);
+ g_clear_object (&self->mpd);
G_OBJECT_CLASS (net_device_mobile_parent_class)->dispose (object);
}
@@ -861,13 +861,13 @@ net_device_mobile_class_init (NetDeviceMobileClass *klass)
}
static void
-net_device_mobile_init (NetDeviceMobile *device_mobile)
+net_device_mobile_init (NetDeviceMobile *self)
{
g_autoptr(GError) error = NULL;
GtkCellRenderer *renderer;
- device_mobile->builder = gtk_builder_new ();
- gtk_builder_add_from_resource (device_mobile->builder,
+ self->builder = gtk_builder_new ();
+ gtk_builder_add_from_resource (self->builder,
"/org/gnome/control-center/network/network-mobile.ui",
&error);
if (error != NULL) {
@@ -875,42 +875,42 @@ net_device_mobile_init (NetDeviceMobile *device_mobile)
return;
}
- device_mobile->box = GTK_BOX (gtk_builder_get_object (device_mobile->builder, "box"));
- device_mobile->device_label = GTK_LABEL (gtk_builder_get_object (device_mobile->builder,
"device_label"));
- device_mobile->device_off_switch = GTK_SWITCH (gtk_builder_get_object (device_mobile->builder,
"device_off_switch"));
- device_mobile->dns_heading_label = GTK_LABEL (gtk_builder_get_object (device_mobile->builder,
"dns_heading_label"));
- device_mobile->dns_label = GTK_LABEL (gtk_builder_get_object (device_mobile->builder, "dns_label"));
- device_mobile->imei_heading_label = GTK_LABEL (gtk_builder_get_object (device_mobile->builder,
"imei_heading_label"));
- device_mobile->imei_label = GTK_LABEL (gtk_builder_get_object (device_mobile->builder,
"imei_label"));
- device_mobile->ipv4_heading_label = GTK_LABEL (gtk_builder_get_object (device_mobile->builder,
"ipv4_heading_label"));
- device_mobile->ipv4_label = GTK_LABEL (gtk_builder_get_object (device_mobile->builder,
"ipv4_label"));
- device_mobile->ipv6_heading_label = GTK_LABEL (gtk_builder_get_object (device_mobile->builder,
"ipv6_heading_label"));
- device_mobile->ipv6_label = GTK_LABEL (gtk_builder_get_object (device_mobile->builder,
"ipv6_label"));
- device_mobile->mobile_connections_list_store = GTK_LIST_STORE (gtk_builder_get_object
(device_mobile->builder, "mobile_connections_list_store"));
- device_mobile->network_combo = GTK_COMBO_BOX (gtk_builder_get_object (device_mobile->builder,
"network_combo"));
- device_mobile->network_label = GTK_LABEL (gtk_builder_get_object (device_mobile->builder,
"network_label"));
- device_mobile->options_button = GTK_BUTTON (gtk_builder_get_object (device_mobile->builder,
"options_button"));
- device_mobile->provider_heading_label = GTK_LABEL (gtk_builder_get_object (device_mobile->builder,
"provider_heading_label"));
- device_mobile->provider_label = GTK_LABEL (gtk_builder_get_object (device_mobile->builder,
"provider_label"));
- device_mobile->route_heading_label = GTK_LABEL (gtk_builder_get_object (device_mobile->builder,
"route_heading_label"));
- device_mobile->route_label = GTK_LABEL (gtk_builder_get_object (device_mobile->builder,
"route_label"));
- device_mobile->status_label = GTK_LABEL (gtk_builder_get_object (device_mobile->builder,
"status_label"));
+ self->box = GTK_BOX (gtk_builder_get_object (self->builder, "box"));
+ self->device_label = GTK_LABEL (gtk_builder_get_object (self->builder, "device_label"));
+ self->device_off_switch = GTK_SWITCH (gtk_builder_get_object (self->builder, "device_off_switch"));
+ self->dns_heading_label = GTK_LABEL (gtk_builder_get_object (self->builder, "dns_heading_label"));
+ self->dns_label = GTK_LABEL (gtk_builder_get_object (self->builder, "dns_label"));
+ self->imei_heading_label = GTK_LABEL (gtk_builder_get_object (self->builder, "imei_heading_label"));
+ self->imei_label = GTK_LABEL (gtk_builder_get_object (self->builder, "imei_label"));
+ self->ipv4_heading_label = GTK_LABEL (gtk_builder_get_object (self->builder, "ipv4_heading_label"));
+ self->ipv4_label = GTK_LABEL (gtk_builder_get_object (self->builder, "ipv4_label"));
+ self->ipv6_heading_label = GTK_LABEL (gtk_builder_get_object (self->builder, "ipv6_heading_label"));
+ self->ipv6_label = GTK_LABEL (gtk_builder_get_object (self->builder, "ipv6_label"));
+ self->mobile_connections_list_store = GTK_LIST_STORE (gtk_builder_get_object (self->builder,
"mobile_connections_list_store"));
+ self->network_combo = GTK_COMBO_BOX (gtk_builder_get_object (self->builder, "network_combo"));
+ self->network_label = GTK_LABEL (gtk_builder_get_object (self->builder, "network_label"));
+ self->options_button = GTK_BUTTON (gtk_builder_get_object (self->builder, "options_button"));
+ self->provider_heading_label = GTK_LABEL (gtk_builder_get_object (self->builder,
"provider_heading_label"));
+ self->provider_label = GTK_LABEL (gtk_builder_get_object (self->builder, "provider_label"));
+ self->route_heading_label = GTK_LABEL (gtk_builder_get_object (self->builder,
"route_heading_label"));
+ self->route_label = GTK_LABEL (gtk_builder_get_object (self->builder, "route_label"));
+ self->status_label = GTK_LABEL (gtk_builder_get_object (self->builder, "status_label"));
/* setup mobile combobox model */
- g_signal_connect_swapped (device_mobile->network_combo, "changed",
+ g_signal_connect_swapped (self->network_combo, "changed",
G_CALLBACK (mobile_connection_changed_cb),
- device_mobile);
+ self);
renderer = gtk_cell_renderer_text_new ();
- gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (device_mobile->network_combo),
+ gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (self->network_combo),
renderer,
FALSE);
- gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (device_mobile->network_combo), renderer,
+ gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (self->network_combo), renderer,
"text", COLUMN_TITLE,
NULL);
- g_signal_connect_swapped (device_mobile->device_off_switch, "notify::active",
- G_CALLBACK (device_off_toggled), device_mobile);
+ g_signal_connect_swapped (self->device_off_switch, "notify::active",
+ G_CALLBACK (device_off_toggled), self);
- g_signal_connect_swapped (device_mobile->options_button, "clicked",
- G_CALLBACK (edit_connection), device_mobile);
+ g_signal_connect_swapped (self->options_button, "clicked",
+ G_CALLBACK (edit_connection), self);
}
diff --git a/panels/network/net-device-simple.c b/panels/network/net-device-simple.c
index 5ee92aa72..5c7bd9522 100644
--- a/panels/network/net-device-simple.c
+++ b/panels/network/net-device-simple.c
@@ -47,10 +47,10 @@ typedef struct
G_DEFINE_TYPE_WITH_PRIVATE (NetDeviceSimple, net_device_simple, NET_TYPE_DEVICE)
void
-net_device_simple_set_show_separator (NetDeviceSimple *device_simple,
+net_device_simple_set_show_separator (NetDeviceSimple *self,
gboolean show_separator)
{
- NetDeviceSimplePrivate *priv = net_device_simple_get_instance_private (device_simple);
+ NetDeviceSimplePrivate *priv = net_device_simple_get_instance_private (self);
/* add widgets to size group */
gtk_widget_set_visible (GTK_WIDGET (priv->separator), show_separator);
@@ -61,8 +61,8 @@ device_simple_proxy_add_to_stack (NetObject *object,
GtkStack *stack,
GtkSizeGroup *heading_size_group)
{
- NetDeviceSimple *device_simple = NET_DEVICE_SIMPLE (object);
- NetDeviceSimplePrivate *priv = net_device_simple_get_instance_private (device_simple);
+ NetDeviceSimple *self = NET_DEVICE_SIMPLE (object);
+ NetDeviceSimplePrivate *priv = net_device_simple_get_instance_private (self);
/* add widgets to size group */
gtk_stack_add_named (stack, GTK_WIDGET (priv->box), net_object_get_id (object));
@@ -72,9 +72,9 @@ device_simple_proxy_add_to_stack (NetObject *object,
static void
update_off_switch_from_device_state (GtkSwitch *sw,
NMDeviceState state,
- NetDeviceSimple *device_simple)
+ NetDeviceSimple *self)
{
- NetDeviceSimplePrivate *priv = net_device_simple_get_instance_private (device_simple);
+ NetDeviceSimplePrivate *priv = net_device_simple_get_instance_private (self);
priv->updating_device = TRUE;
switch (state) {
@@ -93,23 +93,23 @@ update_off_switch_from_device_state (GtkSwitch *sw,
}
static void
-nm_device_simple_refresh_ui (NetDeviceSimple *device_simple)
+nm_device_simple_refresh_ui (NetDeviceSimple *self)
{
- NetDeviceSimplePrivate *priv = net_device_simple_get_instance_private (device_simple);
+ NetDeviceSimplePrivate *priv = net_device_simple_get_instance_private (self);
NMDevice *nm_device;
NMDeviceState state;
- nm_device = net_device_get_nm_device (NET_DEVICE (device_simple));
+ nm_device = net_device_get_nm_device (NET_DEVICE (self));
/* set device kind */
- g_object_bind_property (device_simple, "title", priv->device_label, "label", 0);
+ g_object_bind_property (self, "title", priv->device_label, "label", 0);
/* set up the device on/off switch */
state = nm_device_get_state (nm_device);
gtk_widget_set_visible (GTK_WIDGET (priv->device_off_switch),
state != NM_DEVICE_STATE_UNAVAILABLE
&& state != NM_DEVICE_STATE_UNMANAGED);
- update_off_switch_from_device_state (priv->device_off_switch, state, device_simple);
+ update_off_switch_from_device_state (priv->device_off_switch, state, self);
/* set up the Options button */
gtk_widget_set_visible (GTK_WIDGET (priv->options_button), state != NM_DEVICE_STATE_UNMANAGED);
@@ -118,14 +118,14 @@ nm_device_simple_refresh_ui (NetDeviceSimple *device_simple)
static void
device_simple_refresh (NetObject *object)
{
- NetDeviceSimple *device_simple = NET_DEVICE_SIMPLE (object);
- nm_device_simple_refresh_ui (device_simple);
+ NetDeviceSimple *self = NET_DEVICE_SIMPLE (object);
+ nm_device_simple_refresh_ui (self);
}
static void
-device_off_toggled (NetDeviceSimple *device_simple)
+device_off_toggled (NetDeviceSimple *self)
{
- NetDeviceSimplePrivate *priv = net_device_simple_get_instance_private (device_simple);
+ NetDeviceSimplePrivate *priv = net_device_simple_get_instance_private (self);
const GPtrArray *acs;
gboolean active;
gint i;
@@ -138,22 +138,22 @@ device_off_toggled (NetDeviceSimple *device_simple)
active = gtk_switch_get_active (priv->device_off_switch);
if (active) {
- client = net_object_get_client (NET_OBJECT (device_simple));
- connection = net_device_get_find_connection (NET_DEVICE (device_simple));
+ client = net_object_get_client (NET_OBJECT (self));
+ connection = net_device_get_find_connection (NET_DEVICE (self));
if (connection == NULL)
return;
nm_client_activate_connection_async (client,
connection,
- net_device_get_nm_device (NET_DEVICE (device_simple)),
+ net_device_get_nm_device (NET_DEVICE (self)),
NULL, NULL, NULL, NULL);
} else {
const gchar *uuid;
- connection = net_device_get_find_connection (NET_DEVICE (device_simple));
+ connection = net_device_get_find_connection (NET_DEVICE (self));
if (connection == NULL)
return;
uuid = nm_connection_get_uuid (connection);
- client = net_object_get_client (NET_OBJECT (device_simple));
+ client = net_object_get_client (NET_OBJECT (self));
acs = nm_client_get_active_connections (client);
for (i = 0; acs && i < acs->len; i++) {
a = (NMActiveConnection*)acs->pdata[i];
@@ -166,26 +166,26 @@ device_off_toggled (NetDeviceSimple *device_simple)
}
static void
-edit_connection (NetDeviceSimple *device_simple)
+edit_connection (NetDeviceSimple *self)
{
- net_object_edit (NET_OBJECT (device_simple));
+ net_object_edit (NET_OBJECT (self));
}
static void
net_device_simple_constructed (GObject *object)
{
- NetDeviceSimple *device_simple = NET_DEVICE_SIMPLE (object);
+ NetDeviceSimple *self = NET_DEVICE_SIMPLE (object);
G_OBJECT_CLASS (net_device_simple_parent_class)->constructed (object);
- net_object_refresh (NET_OBJECT (device_simple));
+ net_object_refresh (NET_OBJECT (self));
}
static void
net_device_simple_finalize (GObject *object)
{
- NetDeviceSimple *device_simple = NET_DEVICE_SIMPLE (object);
- NetDeviceSimplePrivate *priv = net_device_simple_get_instance_private (device_simple);
+ NetDeviceSimple *self = NET_DEVICE_SIMPLE (object);
+ NetDeviceSimplePrivate *priv = net_device_simple_get_instance_private (self);
g_object_unref (priv->builder);
@@ -213,9 +213,9 @@ net_device_simple_class_init (NetDeviceSimpleClass *klass)
}
static void
-net_device_simple_init (NetDeviceSimple *device_simple)
+net_device_simple_init (NetDeviceSimple *self)
{
- NetDeviceSimplePrivate *priv = net_device_simple_get_instance_private (device_simple);
+ NetDeviceSimplePrivate *priv = net_device_simple_get_instance_private (self);
g_autoptr(GError) error = NULL;
priv->builder = gtk_builder_new ();
@@ -236,26 +236,26 @@ net_device_simple_init (NetDeviceSimple *device_simple)
/* setup simple combobox model */
g_signal_connect_swapped (priv->device_off_switch, "notify::active",
- G_CALLBACK (device_off_toggled), device_simple);
+ G_CALLBACK (device_off_toggled), self);
g_signal_connect_swapped (priv->options_button, "clicked",
- G_CALLBACK (edit_connection), device_simple);
+ G_CALLBACK (edit_connection), self);
}
char *
-net_device_simple_get_speed (NetDeviceSimple *device_simple)
+net_device_simple_get_speed (NetDeviceSimple *self)
{
- NetDeviceSimpleClass *klass = NET_DEVICE_SIMPLE_GET_CLASS (device_simple);
+ NetDeviceSimpleClass *klass = NET_DEVICE_SIMPLE_GET_CLASS (self);
- return klass->get_speed (device_simple);
+ return klass->get_speed (self);
}
void
-net_device_simple_add_row (NetDeviceSimple *device_simple,
+net_device_simple_add_row (NetDeviceSimple *self,
const char *label_string,
const char *property_name)
{
- NetDeviceSimplePrivate *priv = net_device_simple_get_instance_private (device_simple);
+ NetDeviceSimplePrivate *priv = net_device_simple_get_instance_private (self);
GtkWidget *label, *value;
GtkStyleContext *context;
gint top_attach;
@@ -274,7 +274,7 @@ net_device_simple_add_row (NetDeviceSimple *device_simple,
value = gtk_label_new (NULL);
gtk_widget_set_halign (value, GTK_ALIGN_START);
- g_object_bind_property (device_simple, property_name, value, "label", 0);
+ g_object_bind_property (self, property_name, value, "label", 0);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), value);
gtk_grid_attach (priv->grid, value, 1, top_attach, 1, 1);
gtk_widget_show (value);
diff --git a/panels/network/net-device-wifi.c b/panels/network/net-device-wifi.c
index 54a8a147f..473ba180d 100644
--- a/panels/network/net-device-wifi.c
+++ b/panels/network/net-device-wifi.c
@@ -46,12 +46,12 @@
#define PERIODIC_WIFI_SCAN_TIMEOUT 15
-static void nm_device_wifi_refresh_ui (NetDeviceWifi *device_wifi);
-static void show_wifi_list (NetDeviceWifi *device_wifi);
-static void show_hotspot_ui (NetDeviceWifi *device_wifi);
-static void ap_activated (NetDeviceWifi *device_wifi, GtkListBoxRow *row);
+static void nm_device_wifi_refresh_ui (NetDeviceWifi *self);
+static void show_wifi_list (NetDeviceWifi *self);
+static void show_hotspot_ui (NetDeviceWifi *self);
+static void ap_activated (NetDeviceWifi *self, GtkListBoxRow *row);
static gint ap_sort (gconstpointer a, gconstpointer b, gpointer data);
-static void show_details_for_row (NetDeviceWifi *device_wifi, CcWifiConnectionRow *row, CcWifiConnectionList
*list );
+static void show_details_for_row (NetDeviceWifi *self, CcWifiConnectionRow *row, CcWifiConnectionList *list
);
struct _NetDeviceWifi
@@ -102,15 +102,15 @@ enum {
G_DEFINE_TYPE (NetDeviceWifi, net_device_wifi, NET_TYPE_DEVICE)
GtkWidget *
-net_device_wifi_get_header_widget (NetDeviceWifi *device_wifi)
+net_device_wifi_get_header_widget (NetDeviceWifi *self)
{
- return GTK_WIDGET (device_wifi->header_box);
+ return GTK_WIDGET (self->header_box);
}
GtkWidget *
-net_device_wifi_get_title_widget (NetDeviceWifi *device_wifi)
+net_device_wifi_get_title_widget (NetDeviceWifi *self)
{
- return GTK_WIDGET (device_wifi->center_box);
+ return GTK_WIDGET (self->center_box);
}
static GtkWidget *
@@ -119,59 +119,59 @@ device_wifi_proxy_add_to_stack (NetObject *object,
GtkSizeGroup *heading_size_group)
{
NMDevice *nmdevice;
- NetDeviceWifi *device_wifi = NET_DEVICE_WIFI (object);
+ NetDeviceWifi *self = NET_DEVICE_WIFI (object);
nmdevice = net_device_get_nm_device (NET_DEVICE (object));
- gtk_stack_add_titled (stack, GTK_WIDGET (device_wifi->notebook),
+ gtk_stack_add_titled (stack, GTK_WIDGET (self->notebook),
net_object_get_id (object),
nm_device_get_description (nmdevice));
- return GTK_WIDGET (device_wifi->notebook);
+ return GTK_WIDGET (self->notebook);
}
static void
-disable_scan_timeout (NetDeviceWifi *device_wifi)
+disable_scan_timeout (NetDeviceWifi *self)
{
g_debug ("Disabling periodic Wi-Fi scan");
- if (device_wifi->monitor_scanning_id > 0) {
- g_source_remove (device_wifi->monitor_scanning_id);
- device_wifi->monitor_scanning_id = 0;
+ if (self->monitor_scanning_id > 0) {
+ g_source_remove (self->monitor_scanning_id);
+ self->monitor_scanning_id = 0;
}
- if (device_wifi->scan_id > 0) {
- g_source_remove (device_wifi->scan_id);
- device_wifi->scan_id = 0;
+ if (self->scan_id > 0) {
+ g_source_remove (self->scan_id);
+ self->scan_id = 0;
}
}
static void
-wireless_enabled_toggled (NetDeviceWifi *device_wifi)
+wireless_enabled_toggled (NetDeviceWifi *self)
{
gboolean enabled;
NMDevice *device;
- device = net_device_get_nm_device (NET_DEVICE (device_wifi));
+ device = net_device_get_nm_device (NET_DEVICE (self));
if (nm_device_get_device_type (device) != NM_DEVICE_TYPE_WIFI)
return;
- enabled = nm_client_wireless_get_enabled (net_object_get_client (NET_OBJECT (device_wifi)));
+ enabled = nm_client_wireless_get_enabled (net_object_get_client (NET_OBJECT (self)));
- device_wifi->updating_device = TRUE;
- gtk_switch_set_active (device_wifi->device_off_switch, enabled);
+ self->updating_device = TRUE;
+ gtk_switch_set_active (self->device_off_switch, enabled);
if (!enabled)
- disable_scan_timeout (device_wifi);
- device_wifi->updating_device = FALSE;
+ disable_scan_timeout (self);
+ self->updating_device = FALSE;
}
static NMConnection *
-find_connection_for_device (NetDeviceWifi *device_wifi,
+find_connection_for_device (NetDeviceWifi *self,
NMDevice *device)
{
g_autoptr(NetDevice) tmp = NULL;
NMConnection *connection;
NMClient *client;
- client = net_object_get_client (NET_OBJECT (device_wifi));
+ client = net_object_get_client (NET_OBJECT (self));
tmp = g_object_new (NET_TYPE_DEVICE,
"client", client,
"nm-device", device,
@@ -195,16 +195,16 @@ connection_is_shared (NMConnection *c)
}
static gboolean
-device_is_hotspot (NetDeviceWifi *device_wifi)
+device_is_hotspot (NetDeviceWifi *self)
{
NMConnection *c;
NMDevice *device;
- device = net_device_get_nm_device (NET_DEVICE (device_wifi));
+ device = net_device_get_nm_device (NET_DEVICE (self));
if (nm_device_get_active_connection (device) == NULL)
return FALSE;
- c = find_connection_for_device (device_wifi, device);
+ c = find_connection_for_device (self, device);
if (c == NULL)
return FALSE;
@@ -212,13 +212,13 @@ device_is_hotspot (NetDeviceWifi *device_wifi)
}
static GBytes *
-device_get_hotspot_ssid (NetDeviceWifi *device_wifi,
+device_get_hotspot_ssid (NetDeviceWifi *self,
NMDevice *device)
{
NMConnection *c;
NMSettingWireless *sw;
- c = find_connection_for_device (device_wifi, device);
+ c = find_connection_for_device (self, device);
if (c == NULL)
return NULL;
@@ -231,7 +231,7 @@ get_secrets_cb (GObject *source_object,
GAsyncResult *res,
gpointer data)
{
- NetDeviceWifi *device_wifi = data;
+ NetDeviceWifi *self = data;
GVariant *secrets;
g_autoptr(GError) error = NULL;
@@ -246,11 +246,11 @@ get_secrets_cb (GObject *source_object,
NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
secrets, NULL);
- nm_device_wifi_refresh_ui (device_wifi);
+ nm_device_wifi_refresh_ui (self);
}
static void
-device_get_hotspot_security_details (NetDeviceWifi *device_wifi,
+device_get_hotspot_security_details (NetDeviceWifi *self,
NMDevice *device,
gchar **secret,
gchar **security)
@@ -261,7 +261,7 @@ device_get_hotspot_security_details (NetDeviceWifi *device_wifi,
const gchar *tmp_secret;
const gchar *tmp_security;
- c = find_connection_for_device (device_wifi, device);
+ c = find_connection_for_device (self, device);
if (c == NULL)
return;
@@ -294,12 +294,12 @@ device_get_hotspot_security_details (NetDeviceWifi *device_wifi,
* We'll refresh the UI when secrets arrive.
*/
if (tmp_secret == NULL) {
- GCancellable *cancellable = net_object_get_cancellable (NET_OBJECT (device_wifi));
+ GCancellable *cancellable = net_object_get_cancellable (NET_OBJECT (self));
nm_remote_connection_get_secrets_async ((NMRemoteConnection*)c,
NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
cancellable,
get_secrets_cb,
- device_wifi);
+ self);
return;
}
@@ -310,7 +310,7 @@ device_get_hotspot_security_details (NetDeviceWifi *device_wifi,
}
static void
-nm_device_wifi_refresh_hotspot (NetDeviceWifi *device_wifi)
+nm_device_wifi_refresh_hotspot (NetDeviceWifi *self)
{
GBytes *ssid;
g_autofree gchar *hotspot_secret = NULL;
@@ -319,11 +319,11 @@ nm_device_wifi_refresh_hotspot (NetDeviceWifi *device_wifi)
NMDevice *nm_device;
/* refresh hotspot ui */
- nm_device = net_device_get_nm_device (NET_DEVICE (device_wifi));
- ssid = device_get_hotspot_ssid (device_wifi, nm_device);
+ nm_device = net_device_get_nm_device (NET_DEVICE (self));
+ ssid = device_get_hotspot_ssid (self, nm_device);
if (ssid)
hotspot_ssid = nm_utils_ssid_to_utf8 (g_bytes_get_data (ssid, NULL), g_bytes_get_size
(ssid));
- device_get_hotspot_security_details (device_wifi,
+ device_get_hotspot_security_details (self,
nm_device,
&hotspot_secret,
&hotspot_security);
@@ -331,10 +331,10 @@ nm_device_wifi_refresh_hotspot (NetDeviceWifi *device_wifi)
g_debug ("Refreshing hotspot labels to name: '%s', security key: '%s', security: '%s'",
hotspot_ssid, hotspot_secret, hotspot_security);
- panel_set_device_widget_details (device_wifi->hotspot_network_name_heading_label,
device_wifi->hotspot_network_name_label, hotspot_ssid);
- panel_set_device_widget_details (device_wifi->hotspot_security_key_heading_label,
device_wifi->hotspot_security_key_label, hotspot_secret);
- panel_set_device_widget_details (device_wifi->hotspot_security_heading_label,
device_wifi->hotspot_security_label, hotspot_security);
- panel_set_device_widget_details (device_wifi->hotspot_connected_heading_label,
device_wifi->hotspot_connected_label, NULL);
+ panel_set_device_widget_details (self->hotspot_network_name_heading_label,
self->hotspot_network_name_label, hotspot_ssid);
+ panel_set_device_widget_details (self->hotspot_security_key_heading_label,
self->hotspot_security_key_label, hotspot_secret);
+ panel_set_device_widget_details (self->hotspot_security_heading_label, self->hotspot_security_label,
hotspot_security);
+ panel_set_device_widget_details (self->hotspot_connected_heading_label,
self->hotspot_connected_label, NULL);
}
static void
@@ -354,19 +354,19 @@ set_scanning (NetDeviceWifi *self,
static gboolean
update_scanning (gpointer user_data)
{
- NetDeviceWifi *device_wifi = user_data;
+ NetDeviceWifi *self = user_data;
NMDevice *nm_device;
gint64 last_scan;
- nm_device = net_device_get_nm_device (NET_DEVICE (device_wifi));
+ nm_device = net_device_get_nm_device (NET_DEVICE (self));
last_scan = nm_device_wifi_get_last_scan (NM_DEVICE_WIFI (nm_device));
/* The last_scan property is updated after the device finished scanning,
* so notify about it and stop monitoring for changes.
*/
- if (device_wifi->last_scan != last_scan) {
- set_scanning (device_wifi, FALSE, last_scan);
- device_wifi->monitor_scanning_id = 0;
+ if (self->last_scan != last_scan) {
+ set_scanning (self, FALSE, last_scan);
+ self->monitor_scanning_id = 0;
return G_SOURCE_REMOVE;
}
@@ -376,94 +376,94 @@ update_scanning (gpointer user_data)
static gboolean
request_scan (gpointer user_data)
{
- NetDeviceWifi *device_wifi = user_data;
+ NetDeviceWifi *self = user_data;
NMDevice *nm_device;
g_debug ("Periodic Wi-Fi scan requested");
- nm_device = net_device_get_nm_device (NET_DEVICE (device_wifi));
+ nm_device = net_device_get_nm_device (NET_DEVICE (self));
- set_scanning (device_wifi, TRUE,
+ set_scanning (self, TRUE,
nm_device_wifi_get_last_scan (NM_DEVICE_WIFI (nm_device)));
- if (device_wifi->monitor_scanning_id == 0) {
- device_wifi->monitor_scanning_id = g_timeout_add (1500, update_scanning,
- device_wifi);
+ if (self->monitor_scanning_id == 0) {
+ self->monitor_scanning_id = g_timeout_add (1500, update_scanning,
+ self);
}
nm_device_wifi_request_scan_async (NM_DEVICE_WIFI (nm_device),
- device_wifi->cancellable, NULL, NULL);
+ self->cancellable, NULL, NULL);
return G_SOURCE_CONTINUE;
}
static void
-nm_device_wifi_refresh_ui (NetDeviceWifi *device_wifi)
+nm_device_wifi_refresh_ui (NetDeviceWifi *self)
{
NMDevice *nm_device;
NMClient *client;
g_autofree gchar *status = NULL;
- if (device_is_hotspot (device_wifi)) {
- nm_device_wifi_refresh_hotspot (device_wifi);
- show_hotspot_ui (device_wifi);
- disable_scan_timeout (device_wifi);
+ if (device_is_hotspot (self)) {
+ nm_device_wifi_refresh_hotspot (self);
+ show_hotspot_ui (self);
+ disable_scan_timeout (self);
return;
}
- client = net_object_get_client (NET_OBJECT (device_wifi));
+ client = net_object_get_client (NET_OBJECT (self));
- if (device_wifi->scan_id == 0 &&
+ if (self->scan_id == 0 &&
nm_client_wireless_get_enabled (client)) {
- device_wifi->scan_id = g_timeout_add_seconds (PERIODIC_WIFI_SCAN_TIMEOUT,
- request_scan, device_wifi);
- request_scan (device_wifi);
+ self->scan_id = g_timeout_add_seconds (PERIODIC_WIFI_SCAN_TIMEOUT,
+ request_scan, self);
+ request_scan (self);
}
- nm_device = net_device_get_nm_device (NET_DEVICE (device_wifi));
+ nm_device = net_device_get_nm_device (NET_DEVICE (self));
/* keep this in sync with the signal handler setup in cc_network_panel_init */
- wireless_enabled_toggled (device_wifi);
+ wireless_enabled_toggled (self);
status = panel_device_status_to_localized_string (nm_device, NULL);
- gtk_label_set_label (device_wifi->status_label, status);
+ gtk_label_set_label (self->status_label, status);
/* update list of APs */
- show_wifi_list (device_wifi);
+ show_wifi_list (self);
}
static void
device_wifi_refresh (NetObject *object)
{
- NetDeviceWifi *device_wifi = NET_DEVICE_WIFI (object);
- nm_device_wifi_refresh_ui (device_wifi);
+ NetDeviceWifi *self = NET_DEVICE_WIFI (object);
+ nm_device_wifi_refresh_ui (self);
}
static void
-device_off_toggled (NetDeviceWifi *device_wifi)
+device_off_toggled (NetDeviceWifi *self)
{
NMClient *client;
gboolean active;
- if (device_wifi->updating_device)
+ if (self->updating_device)
return;
- client = net_object_get_client (NET_OBJECT (device_wifi));
- active = gtk_switch_get_active (device_wifi->device_off_switch);
+ client = net_object_get_client (NET_OBJECT (self));
+ active = gtk_switch_get_active (self->device_off_switch);
nm_client_wireless_set_enabled (client, active);
if (!active)
- disable_scan_timeout (device_wifi);
+ disable_scan_timeout (self);
}
static void
-connect_to_hidden_network (NetDeviceWifi *device_wifi)
+connect_to_hidden_network (NetDeviceWifi *self)
{
NMClient *client;
CcNetworkPanel *panel;
GtkWidget *toplevel;
- client = net_object_get_client (NET_OBJECT (device_wifi));
- panel = net_object_get_panel (NET_OBJECT (device_wifi));
+ client = net_object_get_client (NET_OBJECT (self));
+ panel = net_object_get_panel (NET_OBJECT (self));
toplevel = cc_shell_get_toplevel (cc_panel_get_shell (CC_PANEL (panel)));
cc_network_panel_connect_to_hidden_network (toplevel, client);
}
@@ -531,7 +531,7 @@ is_8021x (NMDevice *device,
}
static void
-wireless_try_to_connect (NetDeviceWifi *device_wifi,
+wireless_try_to_connect (NetDeviceWifi *self,
GBytes *ssid,
const gchar *ap_object_path)
{
@@ -540,13 +540,13 @@ wireless_try_to_connect (NetDeviceWifi *device_wifi,
NMClient *client;
GCancellable *cancellable;
- if (device_wifi->updating_device)
+ if (self->updating_device)
return;
if (ap_object_path == NULL || ap_object_path[0] == 0)
return;
- device = net_device_get_nm_device (NET_DEVICE (device_wifi));
+ device = net_device_get_nm_device (NET_DEVICE (self));
if (device == NULL)
return;
@@ -555,8 +555,8 @@ wireless_try_to_connect (NetDeviceWifi *device_wifi,
ssid_target, ap_object_path);
/* activate the connection */
- client = net_object_get_client (NET_OBJECT (device_wifi));
- cancellable = net_object_get_cancellable (NET_OBJECT (device_wifi));
+ client = net_object_get_client (NET_OBJECT (self));
+ cancellable = net_object_get_cancellable (NET_OBJECT (self));
if (!is_8021x (device, ap_object_path)) {
g_autoptr(GPermission) permission = NULL;
@@ -584,7 +584,7 @@ wireless_try_to_connect (NetDeviceWifi *device_wifi,
ap_object_path,
cancellable,
connection_add_activate_cb,
- device_wifi);
+ self);
} else {
CcNetworkPanel *panel;
g_autoptr(GVariantBuilder) builder = NULL;
@@ -597,7 +597,7 @@ wireless_try_to_connect (NetDeviceWifi *device_wifi,
g_variant_builder_add (builder, "v", g_variant_new_string (ap_object_path));
parameters = g_variant_new ("av", builder);
- panel = net_object_get_panel (NET_OBJECT (device_wifi));
+ panel = net_object_get_panel (NET_OBJECT (self));
g_object_set (G_OBJECT (panel), "parameters", parameters, NULL);
}
}
@@ -668,15 +668,15 @@ is_hotspot_connection (NMConnection *connection)
}
static void
-show_hotspot_ui (NetDeviceWifi *device_wifi)
+show_hotspot_ui (NetDeviceWifi *self)
{
/* show hotspot tab */
- gtk_notebook_set_current_page (device_wifi->notebook, 1);
+ gtk_notebook_set_current_page (self->notebook, 1);
/* force switch to on as this succeeded */
- device_wifi->updating_device = TRUE;
- gtk_switch_set_active (device_wifi->hotspot_off_switch, TRUE);
- device_wifi->updating_device = FALSE;
+ self->updating_device = TRUE;
+ gtk_switch_set_active (self->hotspot_off_switch, TRUE);
+ self->updating_device = FALSE;
}
static void
@@ -719,12 +719,12 @@ activate_new_cb (GObject *source_object,
}
static NMConnection *
-net_device_wifi_get_hotspot_connection (NetDeviceWifi *device_wifi)
+net_device_wifi_get_hotspot_connection (NetDeviceWifi *self)
{
GSList *connections, *l;
NMConnection *c = NULL;
- connections = net_device_get_valid_connections (NET_DEVICE (device_wifi));
+ connections = net_device_get_valid_connections (NET_DEVICE (self));
for (l = connections; l; l = l->next) {
NMConnection *tmp = l->data;
if (is_hotspot_connection (tmp)) {
@@ -747,7 +747,7 @@ overwrite_ssid_cb (GObject *source_object,
NMRemoteConnection *connection;
NMDevice *device;
NMConnection *c;
- NetDeviceWifi *device_wifi;
+ NetDeviceWifi *self;
GCancellable *cancellable;
connection = NM_REMOTE_CONNECTION (source_object);
@@ -759,11 +759,11 @@ overwrite_ssid_cb (GObject *source_object,
return;
}
- device_wifi = user_data;
- device = net_device_get_nm_device (NET_DEVICE (device_wifi));
- client = net_object_get_client (NET_OBJECT (device_wifi));
- cancellable = net_object_get_cancellable (NET_OBJECT (device_wifi));
- c = net_device_wifi_get_hotspot_connection (device_wifi);
+ self = user_data;
+ device = net_device_get_nm_device (NET_DEVICE (self));
+ client = net_object_get_client (NET_OBJECT (self));
+ cancellable = net_object_get_cancellable (NET_OBJECT (self));
+ c = net_device_wifi_get_hotspot_connection (self);
g_debug ("activate existing hotspot connection\n");
nm_client_activate_connection_async (client,
@@ -772,11 +772,11 @@ overwrite_ssid_cb (GObject *source_object,
NULL,
cancellable,
activate_cb,
- device_wifi);
+ self);
}
static void
-start_hotspot (NetDeviceWifi *device_wifi)
+start_hotspot (NetDeviceWifi *self)
{
NMDevice *device;
g_autofree gchar *active_ssid = NULL;
@@ -787,36 +787,36 @@ start_hotspot (NetDeviceWifi *device_wifi)
g_autofree gchar *ssid = NULL;
gint response;
- client = net_object_get_client (NET_OBJECT (device_wifi));
- device = net_device_get_nm_device (NET_DEVICE (device_wifi));
+ client = net_object_get_client (NET_OBJECT (self));
+ device = net_device_get_nm_device (NET_DEVICE (self));
- window = gtk_widget_get_toplevel (GTK_WIDGET (device_wifi->notebook));
+ window = gtk_widget_get_toplevel (GTK_WIDGET (self->notebook));
- if (!device_wifi->hotspot_dialog)
- device_wifi->hotspot_dialog = cc_wifi_hotspot_dialog_new (GTK_WINDOW (window));
- cc_wifi_hotspot_dialog_set_device (device_wifi->hotspot_dialog, NM_DEVICE_WIFI (device));
+ if (!self->hotspot_dialog)
+ self->hotspot_dialog = cc_wifi_hotspot_dialog_new (GTK_WINDOW (window));
+ cc_wifi_hotspot_dialog_set_device (self->hotspot_dialog, NM_DEVICE_WIFI (device));
hostname = get_hostname ();
ssid = pretty_hostname_to_ssid (hostname);
- cc_wifi_hotspot_dialog_set_hostname (device_wifi->hotspot_dialog, ssid);
- c = net_device_wifi_get_hotspot_connection (device_wifi);
+ cc_wifi_hotspot_dialog_set_hostname (self->hotspot_dialog, ssid);
+ c = net_device_wifi_get_hotspot_connection (self);
if (c)
- cc_wifi_hotspot_dialog_set_connection (device_wifi->hotspot_dialog, c);
+ cc_wifi_hotspot_dialog_set_connection (self->hotspot_dialog, c);
- response = gtk_dialog_run (GTK_DIALOG (device_wifi->hotspot_dialog));
+ response = gtk_dialog_run (GTK_DIALOG (self->hotspot_dialog));
if (response == GTK_RESPONSE_APPLY) {
NMConnection *connection;
GCancellable *cancellable;
- cancellable = net_object_get_cancellable (NET_OBJECT (device_wifi));
+ cancellable = net_object_get_cancellable (NET_OBJECT (self));
- connection = cc_wifi_hotspot_dialog_get_connection (device_wifi->hotspot_dialog);
+ connection = cc_wifi_hotspot_dialog_get_connection (self->hotspot_dialog);
if (NM_IS_REMOTE_CONNECTION (connection))
nm_remote_connection_commit_changes_async (NM_REMOTE_CONNECTION (connection),
TRUE,
cancellable,
overwrite_ssid_cb,
- device_wifi);
+ self);
else
nm_client_add_and_activate_connection_async (client,
connection,
@@ -824,14 +824,14 @@ start_hotspot (NetDeviceWifi *device_wifi)
NULL,
cancellable,
activate_new_cb,
- device_wifi);
+ self);
}
- gtk_widget_hide (GTK_WIDGET (device_wifi->hotspot_dialog));
+ gtk_widget_hide (GTK_WIDGET (self->hotspot_dialog));
}
static void
-stop_shared_connection (NetDeviceWifi *device_wifi)
+stop_shared_connection (NetDeviceWifi *self)
{
const GPtrArray *connections;
const GPtrArray *devices;
@@ -841,8 +841,8 @@ stop_shared_connection (NetDeviceWifi *device_wifi)
NMClient *client;
gboolean found = FALSE;
- device = net_device_get_nm_device (NET_DEVICE (device_wifi));
- client = net_object_get_client (NET_OBJECT (device_wifi));
+ device = net_device_get_nm_device (NET_DEVICE (self));
+ client = net_object_get_client (NET_OBJECT (self));
connections = nm_client_get_active_connections (client);
for (i = 0; connections && i < connections->len; i++) {
c = (NMActiveConnection *)connections->pdata[i];
@@ -857,39 +857,39 @@ stop_shared_connection (NetDeviceWifi *device_wifi)
if (!found) {
g_warning ("Could not stop hotspot connection as no connection attached to the device could
be found.");
- device_wifi->updating_device = TRUE;
- gtk_switch_set_active (device_wifi->hotspot_off_switch, TRUE);
- device_wifi->updating_device = FALSE;
+ self->updating_device = TRUE;
+ gtk_switch_set_active (self->hotspot_off_switch, TRUE);
+ self->updating_device = FALSE;
return;
}
- nm_device_wifi_refresh_ui (device_wifi);
+ nm_device_wifi_refresh_ui (self);
}
static void
-stop_hotspot_response_cb (NetDeviceWifi *device_wifi, gint response, GtkWidget *dialog)
+stop_hotspot_response_cb (NetDeviceWifi *self, gint response, GtkWidget *dialog)
{
if (response == GTK_RESPONSE_OK) {
- stop_shared_connection (device_wifi);
+ stop_shared_connection (self);
} else {
- device_wifi->updating_device = TRUE;
- gtk_switch_set_active (device_wifi->hotspot_off_switch, TRUE);
- device_wifi->updating_device = FALSE;
+ self->updating_device = TRUE;
+ gtk_switch_set_active (self->hotspot_off_switch, TRUE);
+ self->updating_device = FALSE;
}
gtk_widget_destroy (dialog);
}
static void
-switch_hotspot_changed_cb (NetDeviceWifi *device_wifi)
+switch_hotspot_changed_cb (NetDeviceWifi *self)
{
GtkWidget *dialog;
GtkWidget *window;
CcNetworkPanel *panel;
- if (device_wifi->updating_device)
+ if (self->updating_device)
return;
- panel = net_object_get_panel (NET_OBJECT (device_wifi));
+ panel = net_object_get_panel (NET_OBJECT (self));
window = gtk_widget_get_toplevel (GTK_WIDGET (panel));
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
@@ -901,20 +901,20 @@ switch_hotspot_changed_cb (NetDeviceWifi *device_wifi)
_("_Stop Hotspot"), GTK_RESPONSE_OK,
NULL);
g_signal_connect_swapped (dialog, "response",
- G_CALLBACK (stop_hotspot_response_cb), device_wifi);
+ G_CALLBACK (stop_hotspot_response_cb), self);
gtk_window_present (GTK_WINDOW (dialog));
}
static void
-show_wifi_list (NetDeviceWifi *device_wifi)
+show_wifi_list (NetDeviceWifi *self)
{
- gtk_notebook_set_current_page (device_wifi->notebook, 0);
+ gtk_notebook_set_current_page (self->notebook, 0);
}
static void
net_device_wifi_constructed (GObject *object)
{
- NetDeviceWifi *device_wifi = NET_DEVICE_WIFI (object);
+ NetDeviceWifi *self = NET_DEVICE_WIFI (object);
NMClient *client;
NMClientPermissionResult perm;
NMDevice *nm_device;
@@ -923,58 +923,58 @@ net_device_wifi_constructed (GObject *object)
G_OBJECT_CLASS (net_device_wifi_parent_class)->constructed (object);
- client = net_object_get_client (NET_OBJECT (device_wifi));
+ client = net_object_get_client (NET_OBJECT (self));
g_signal_connect_object (client, "notify::wireless-enabled",
- G_CALLBACK (wireless_enabled_toggled), device_wifi, G_CONNECT_SWAPPED);
+ G_CALLBACK (wireless_enabled_toggled), self, G_CONNECT_SWAPPED);
- nm_device = net_device_get_nm_device (NET_DEVICE (device_wifi));
+ nm_device = net_device_get_nm_device (NET_DEVICE (self));
list = GTK_WIDGET (cc_wifi_connection_list_new (client, NM_DEVICE_WIFI (nm_device), TRUE, TRUE,
FALSE));
gtk_widget_show (list);
- gtk_container_add (GTK_CONTAINER (device_wifi->listbox_box), list);
+ gtk_container_add (GTK_CONTAINER (self->listbox_box), list);
gtk_list_box_set_header_func (GTK_LIST_BOX (list), cc_list_box_update_header_func, NULL, NULL);
gtk_list_box_set_sort_func (GTK_LIST_BOX (list), (GtkListBoxSortFunc)ap_sort, NULL, NULL);
g_signal_connect_swapped (list, "row-activated",
- G_CALLBACK (ap_activated), device_wifi);
+ G_CALLBACK (ap_activated), self);
g_signal_connect_swapped (list, "configure",
G_CALLBACK (show_details_for_row),
- device_wifi);
+ self);
/* only enable the button if the user can create a hotspot */
perm = nm_client_get_permission_result (client, NM_CLIENT_PERMISSION_WIFI_SHARE_OPEN);
caps = nm_device_wifi_get_capabilities (NM_DEVICE_WIFI (nm_device));
if (perm != NM_CLIENT_PERMISSION_RESULT_YES &&
perm != NM_CLIENT_PERMISSION_RESULT_AUTH) {
- gtk_widget_set_tooltip_text (GTK_WIDGET (device_wifi->start_hotspot_button), _("System
policy prohibits use as a Hotspot"));
- gtk_widget_set_sensitive (GTK_WIDGET (device_wifi->start_hotspot_button), FALSE);
+ gtk_widget_set_tooltip_text (GTK_WIDGET (self->start_hotspot_button), _("System policy
prohibits use as a Hotspot"));
+ gtk_widget_set_sensitive (GTK_WIDGET (self->start_hotspot_button), FALSE);
} else if (!(caps & (NM_WIFI_DEVICE_CAP_AP | NM_WIFI_DEVICE_CAP_ADHOC))) {
- gtk_widget_set_tooltip_text (GTK_WIDGET (device_wifi->start_hotspot_button), _("Wireless
device does not support Hotspot mode"));
- gtk_widget_set_sensitive (GTK_WIDGET (device_wifi->start_hotspot_button), FALSE);
+ gtk_widget_set_tooltip_text (GTK_WIDGET (self->start_hotspot_button), _("Wireless device
does not support Hotspot mode"));
+ gtk_widget_set_sensitive (GTK_WIDGET (self->start_hotspot_button), FALSE);
} else
- gtk_widget_set_sensitive (GTK_WIDGET (device_wifi->start_hotspot_button), TRUE);
+ gtk_widget_set_sensitive (GTK_WIDGET (self->start_hotspot_button), TRUE);
- g_object_bind_property (device_wifi, "title", device_wifi->title_label, "label", 0);
+ g_object_bind_property (self, "title", self->title_label, "label", 0);
- nm_device_wifi_refresh_ui (device_wifi);
+ nm_device_wifi_refresh_ui (self);
}
static void
net_device_wifi_finalize (GObject *object)
{
- NetDeviceWifi *device_wifi = NET_DEVICE_WIFI (object);
+ NetDeviceWifi *self = NET_DEVICE_WIFI (object);
- if (device_wifi->cancellable) {
- g_cancellable_cancel (device_wifi->cancellable);
- g_clear_object (&device_wifi->cancellable);
+ if (self->cancellable) {
+ g_cancellable_cancel (self->cancellable);
+ g_clear_object (&self->cancellable);
}
- disable_scan_timeout (device_wifi);
+ disable_scan_timeout (self);
- g_object_unref (device_wifi->builder);
- g_free (device_wifi->selected_ssid_title);
- g_free (device_wifi->selected_connection_id);
- g_free (device_wifi->selected_ap_id);
+ g_object_unref (self->builder);
+ g_free (self->selected_ssid_title);
+ g_free (self->selected_connection_id);
+ g_free (self->selected_ap_id);
G_OBJECT_CLASS (net_device_wifi_parent_class)->finalize (object);
}
@@ -1066,7 +1066,7 @@ really_forget (GtkDialog *dialog, gint response, gpointer data)
GList *rows;
GList *r;
NMRemoteConnection *connection;
- NetDeviceWifi *device_wifi;
+ NetDeviceWifi *self;
GCancellable *cancellable;
gtk_widget_destroy (GTK_WIDGET (dialog));
@@ -1074,8 +1074,8 @@ really_forget (GtkDialog *dialog, gint response, gpointer data)
if (response != GTK_RESPONSE_OK)
return;
- device_wifi = NET_DEVICE_WIFI (g_object_get_data (G_OBJECT (forget), "net"));
- cancellable = net_object_get_cancellable (NET_OBJECT (device_wifi));
+ self = NET_DEVICE_WIFI (g_object_get_data (G_OBJECT (forget), "net"));
+ cancellable = net_object_get_cancellable (NET_OBJECT (self));
rows = g_object_steal_data (G_OBJECT (forget), "rows");
for (r = rows; r; r = r->next) {
row = r->data;
@@ -1189,7 +1189,7 @@ ap_sort (gconstpointer a, gconstpointer b, gpointer data)
}
static void
-show_details_for_row (NetDeviceWifi *device_wifi, CcWifiConnectionRow *row, CcWifiConnectionList *list)
+show_details_for_row (NetDeviceWifi *self, CcWifiConnectionRow *row, CcWifiConnectionList *list)
{
NMConnection *connection;
NMAccessPoint *ap;
@@ -1203,14 +1203,14 @@ show_details_for_row (NetDeviceWifi *device_wifi, CcWifiConnectionRow *row, CcWi
connection = cc_wifi_connection_row_get_connection (row);
ap = cc_wifi_connection_row_best_access_point (row);
- device = net_device_get_nm_device (NET_DEVICE (device_wifi));
- client = net_object_get_client (NET_OBJECT (device_wifi));
+ device = net_device_get_nm_device (NET_DEVICE (self));
+ client = net_object_get_client (NET_OBJECT (self));
editor = net_connection_editor_new (GTK_WINDOW (window), connection, device, ap, client);
net_connection_editor_run (editor);
}
static void
-on_connection_list_row_added_cb (NetDeviceWifi *device_wifi,
+on_connection_list_row_added_cb (NetDeviceWifi *self,
CcWifiConnectionRow *row,
CcWifiConnectionList *list)
{
@@ -1219,7 +1219,7 @@ on_connection_list_row_added_cb (NetDeviceWifi *device_wifi,
}
static void
-on_connection_list_row_removed_cb (NetDeviceWifi *device_wifi,
+on_connection_list_row_removed_cb (NetDeviceWifi *self,
CcWifiConnectionRow *row,
CcWifiConnectionList *list)
{
@@ -1240,7 +1240,7 @@ on_connection_list_row_removed_cb (NetDeviceWifi *device_wifi,
}
static void
-on_connection_list_row_activated_cb (NetDeviceWifi *device_wifi,
+on_connection_list_row_activated_cb (NetDeviceWifi *self,
CcWifiConnectionRow *row,
CcWifiConnectionList *list)
{
@@ -1248,7 +1248,7 @@ on_connection_list_row_activated_cb (NetDeviceWifi *device_wifi,
}
static void
-open_history (NetDeviceWifi *device_wifi)
+open_history (NetDeviceWifi *self)
{
GtkWidget *dialog;
GtkWidget *window;
@@ -1263,7 +1263,7 @@ open_history (NetDeviceWifi *device_wifi)
GList *list_rows;
dialog = g_object_new (HDY_TYPE_DIALOG, "use-header-bar", 1, NULL);
- panel = net_object_get_panel (NET_OBJECT (device_wifi));
+ panel = net_object_get_panel (NET_OBJECT (self));
window = gtk_widget_get_toplevel (GTK_WIDGET (panel));
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (window));
gtk_window_set_title (GTK_WINDOW (dialog), _("Known Wi-Fi Networks"));
@@ -1293,9 +1293,9 @@ open_history (NetDeviceWifi *device_wifi)
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (swin), GTK_SHADOW_NONE);
gtk_container_add (GTK_CONTAINER (content_area), swin);
- nm_device = net_device_get_nm_device (NET_DEVICE (device_wifi));
+ nm_device = net_device_get_nm_device (NET_DEVICE (self));
- list = GTK_WIDGET (cc_wifi_connection_list_new (net_object_get_client (NET_OBJECT (device_wifi)),
+ list = GTK_WIDGET (cc_wifi_connection_list_new (net_object_get_client (NET_OBJECT (self)),
NM_DEVICE_WIFI (nm_device),
FALSE, FALSE, TRUE));
gtk_widget_show (list);
@@ -1324,25 +1324,25 @@ open_history (NetDeviceWifi *device_wifi)
gtk_container_add (GTK_CONTAINER (content_area), forget);
g_object_set_data (G_OBJECT (list), "forget", forget);
- g_object_set_data (G_OBJECT (list), "net", device_wifi);
+ g_object_set_data (G_OBJECT (list), "net", self);
g_signal_connect_swapped (list, "add",
G_CALLBACK (on_connection_list_row_added_cb),
- device_wifi);
+ self);
g_signal_connect_swapped (list, "remove",
G_CALLBACK (on_connection_list_row_removed_cb),
- device_wifi);
+ self);
g_signal_connect_swapped (list, "row-activated",
G_CALLBACK (on_connection_list_row_activated_cb),
- device_wifi);
+ self);
g_signal_connect_swapped (list, "configure",
G_CALLBACK (show_details_for_row),
- device_wifi);
+ self);
list_rows = gtk_container_get_children (GTK_CONTAINER (list));
while (list_rows)
{
- on_connection_list_row_added_cb (device_wifi,
+ on_connection_list_row_added_cb (self,
CC_WIFI_CONNECTION_ROW (list_rows->data),
CC_WIFI_CONNECTION_LIST (list));
list_rows = g_list_delete_link (list_rows, list_rows);
@@ -1352,7 +1352,7 @@ open_history (NetDeviceWifi *device_wifi)
}
static void
-ap_activated (NetDeviceWifi *device_wifi, GtkListBoxRow *row)
+ap_activated (NetDeviceWifi *self, GtkListBoxRow *row)
{
CcWifiConnectionRow *c_row;
NMConnection *connection;
@@ -1373,31 +1373,31 @@ ap_activated (NetDeviceWifi *device_wifi, GtkListBoxRow *row)
if (ap != NULL) {
if (connection != NULL) {
- client = net_object_get_client (NET_OBJECT (device_wifi));
- nm_device = net_device_get_nm_device (NET_DEVICE (device_wifi));
- cancellable = net_object_get_cancellable (NET_OBJECT (device_wifi));
+ client = net_object_get_client (NET_OBJECT (self));
+ nm_device = net_device_get_nm_device (NET_DEVICE (self));
+ cancellable = net_object_get_cancellable (NET_OBJECT (self));
nm_client_activate_connection_async (client,
connection,
nm_device, NULL, cancellable,
- connection_activate_cb, device_wifi);
+ connection_activate_cb, self);
} else {
GBytes *ssid;
const gchar *object_path;
ssid = nm_access_point_get_ssid (ap);
object_path = nm_object_get_path (NM_OBJECT (ap));
- wireless_try_to_connect (device_wifi, ssid, object_path);
+ wireless_try_to_connect (self, ssid, object_path);
}
}
}
static void
-net_device_wifi_init (NetDeviceWifi *device_wifi)
+net_device_wifi_init (NetDeviceWifi *self)
{
g_autoptr(GError) error = NULL;
- device_wifi->builder = gtk_builder_new ();
- gtk_builder_add_from_resource (device_wifi->builder,
+ self->builder = gtk_builder_new ();
+ gtk_builder_add_from_resource (self->builder,
"/org/gnome/control-center/network/network-wifi.ui",
&error);
if (error != NULL) {
@@ -1405,45 +1405,45 @@ net_device_wifi_init (NetDeviceWifi *device_wifi)
return;
}
- device_wifi->center_box = GTK_BOX (gtk_builder_get_object (device_wifi->builder, "center_box"));
- device_wifi->connect_hidden_button = GTK_BUTTON (gtk_builder_get_object (device_wifi->builder,
"connect_hidden_button"));
- device_wifi->device_off_switch = GTK_SWITCH (gtk_builder_get_object (device_wifi->builder,
"device_off_switch"));
- device_wifi->header_box = GTK_BOX (gtk_builder_get_object (device_wifi->builder, "header_box"));
- device_wifi->history_button = GTK_BUTTON (gtk_builder_get_object (device_wifi->builder,
"history_button"));
- device_wifi->hotspot_connected_heading_label = GTK_LABEL (gtk_builder_get_object
(device_wifi->builder, "hotspot_connected_heading_label"));
- device_wifi->hotspot_connected_label = GTK_LABEL (gtk_builder_get_object (device_wifi->builder,
"hotspot_connected_label"));
- device_wifi->hotspot_network_name_heading_label = GTK_LABEL (gtk_builder_get_object
(device_wifi->builder, "hotspot_network_name_heading_label"));
- device_wifi->hotspot_network_name_label = GTK_LABEL (gtk_builder_get_object (device_wifi->builder,
"hotspot_network_name_label"));
- device_wifi->hotspot_off_switch = GTK_SWITCH (gtk_builder_get_object (device_wifi->builder,
"hotspot_off_switch"));
- device_wifi->hotspot_security_heading_label = GTK_LABEL (gtk_builder_get_object
(device_wifi->builder, "hotspot_security_heading_label"));
- device_wifi->hotspot_security_key_heading_label = GTK_LABEL (gtk_builder_get_object
(device_wifi->builder, "hotspot_security_key_heading_label"));
- device_wifi->hotspot_security_key_label = GTK_LABEL (gtk_builder_get_object (device_wifi->builder,
"hotspot_security_key_label"));
- device_wifi->hotspot_security_label = GTK_LABEL (gtk_builder_get_object (device_wifi->builder,
"hotspot_security_label"));
- device_wifi->listbox_box = GTK_BOX (gtk_builder_get_object (device_wifi->builder, "listbox_box"));
- device_wifi->notebook = GTK_NOTEBOOK (gtk_builder_get_object (device_wifi->builder, "notebook"));
- device_wifi->start_hotspot_button = GTK_BUTTON (gtk_builder_get_object (device_wifi->builder,
"start_hotspot_button"));
- device_wifi->status_label = GTK_LABEL (gtk_builder_get_object (device_wifi->builder,
"status_label"));
- device_wifi->title_label = GTK_LABEL (gtk_builder_get_object (device_wifi->builder, "title_label"));
-
- device_wifi->cancellable = g_cancellable_new ();
+ self->center_box = GTK_BOX (gtk_builder_get_object (self->builder, "center_box"));
+ self->connect_hidden_button = GTK_BUTTON (gtk_builder_get_object (self->builder,
"connect_hidden_button"));
+ self->device_off_switch = GTK_SWITCH (gtk_builder_get_object (self->builder, "device_off_switch"));
+ self->header_box = GTK_BOX (gtk_builder_get_object (self->builder, "header_box"));
+ self->history_button = GTK_BUTTON (gtk_builder_get_object (self->builder, "history_button"));
+ self->hotspot_connected_heading_label = GTK_LABEL (gtk_builder_get_object (self->builder,
"hotspot_connected_heading_label"));
+ self->hotspot_connected_label = GTK_LABEL (gtk_builder_get_object (self->builder,
"hotspot_connected_label"));
+ self->hotspot_network_name_heading_label = GTK_LABEL (gtk_builder_get_object (self->builder,
"hotspot_network_name_heading_label"));
+ self->hotspot_network_name_label = GTK_LABEL (gtk_builder_get_object (self->builder,
"hotspot_network_name_label"));
+ self->hotspot_off_switch = GTK_SWITCH (gtk_builder_get_object (self->builder, "hotspot_off_switch"));
+ self->hotspot_security_heading_label = GTK_LABEL (gtk_builder_get_object (self->builder,
"hotspot_security_heading_label"));
+ self->hotspot_security_key_heading_label = GTK_LABEL (gtk_builder_get_object (self->builder,
"hotspot_security_key_heading_label"));
+ self->hotspot_security_key_label = GTK_LABEL (gtk_builder_get_object (self->builder,
"hotspot_security_key_label"));
+ self->hotspot_security_label = GTK_LABEL (gtk_builder_get_object (self->builder,
"hotspot_security_label"));
+ self->listbox_box = GTK_BOX (gtk_builder_get_object (self->builder, "listbox_box"));
+ self->notebook = GTK_NOTEBOOK (gtk_builder_get_object (self->builder, "notebook"));
+ self->start_hotspot_button = GTK_BUTTON (gtk_builder_get_object (self->builder,
"start_hotspot_button"));
+ self->status_label = GTK_LABEL (gtk_builder_get_object (self->builder, "status_label"));
+ self->title_label = GTK_LABEL (gtk_builder_get_object (self->builder, "title_label"));
+
+ self->cancellable = g_cancellable_new ();
/* setup wifi views */
- g_signal_connect_swapped (device_wifi->device_off_switch, "notify::active",
- G_CALLBACK (device_off_toggled), device_wifi);
+ g_signal_connect_swapped (self->device_off_switch, "notify::active",
+ G_CALLBACK (device_off_toggled), self);
/* setup view */
- gtk_notebook_set_show_tabs (device_wifi->notebook, FALSE);
- gtk_notebook_set_current_page (device_wifi->notebook, 0);
+ gtk_notebook_set_show_tabs (self->notebook, FALSE);
+ gtk_notebook_set_current_page (self->notebook, 0);
- g_signal_connect_swapped (device_wifi->start_hotspot_button, "clicked",
- G_CALLBACK (start_hotspot), device_wifi);
+ g_signal_connect_swapped (self->start_hotspot_button, "clicked",
+ G_CALLBACK (start_hotspot), self);
- g_signal_connect_swapped (device_wifi->connect_hidden_button, "clicked",
- G_CALLBACK (connect_to_hidden_network), device_wifi);
+ g_signal_connect_swapped (self->connect_hidden_button, "clicked",
+ G_CALLBACK (connect_to_hidden_network), self);
- g_signal_connect_swapped (device_wifi->history_button, "clicked",
- G_CALLBACK (open_history), device_wifi);
+ g_signal_connect_swapped (self->history_button, "clicked",
+ G_CALLBACK (open_history), self);
- g_signal_connect_swapped (device_wifi->hotspot_off_switch, "notify::active",
- G_CALLBACK (switch_hotspot_changed_cb), device_wifi);
+ g_signal_connect_swapped (self->hotspot_off_switch, "notify::active",
+ G_CALLBACK (switch_hotspot_changed_cb), self);
}
diff --git a/panels/network/net-device.c b/panels/network/net-device.c
index eb3b9bb72..d7aecd9bd 100644
--- a/panels/network/net-device.c
+++ b/panels/network/net-device.c
@@ -117,9 +117,9 @@ compare_mac_device_with_mac_connection (NMDevice *device,
}
static NMConnection *
-net_device_real_get_find_connection (NetDevice *device)
+net_device_real_get_find_connection (NetDevice *self)
{
- NetDevicePrivate *priv = net_device_get_instance_private (device);
+ NetDevicePrivate *priv = net_device_get_instance_private (self);
GSList *list, *iterator;
NMConnection *connection = NULL;
NMActiveConnection *ac;
@@ -130,7 +130,7 @@ net_device_real_get_find_connection (NetDevice *device)
return (NMConnection*) nm_active_connection_get_connection (ac);
/* not found in active connections - check all available connections */
- list = net_device_get_valid_connections (device);
+ list = net_device_get_valid_connections (self);
if (list != NULL) {
/* if list has only one connection, use this connection */
if (g_slist_length (list) == 1) {
@@ -156,26 +156,26 @@ out:
}
NMConnection *
-net_device_get_find_connection (NetDevice *device)
+net_device_get_find_connection (NetDevice *self)
{
- return NET_DEVICE_GET_CLASS (device)->get_find_connection (device);
+ return NET_DEVICE_GET_CLASS (self)->get_find_connection (self);
}
static void
-state_changed_cb (NetDevice *net_device)
+state_changed_cb (NetDevice *self)
{
- net_object_emit_changed (NET_OBJECT (net_device));
- net_object_refresh (NET_OBJECT (net_device));
+ net_object_emit_changed (NET_OBJECT (self));
+ net_object_refresh (NET_OBJECT (self));
}
NMDevice *
-net_device_get_nm_device (NetDevice *device)
+net_device_get_nm_device (NetDevice *self)
{
NetDevicePrivate *priv;
- g_return_val_if_fail (NET_IS_DEVICE (device), NULL);
+ g_return_val_if_fail (NET_IS_DEVICE (self), NULL);
- priv = net_device_get_instance_private (device);
+ priv = net_device_get_instance_private (self);
return priv->nm_device;
}
@@ -185,10 +185,10 @@ net_device_edit (NetObject *object)
const gchar *uuid;
g_autofree gchar *cmdline = NULL;
g_autoptr(GError) error = NULL;
- NetDevice *device = NET_DEVICE (object);
+ NetDevice *self = NET_DEVICE (object);
NMConnection *connection;
- connection = net_device_get_find_connection (device);
+ connection = net_device_get_find_connection (self);
uuid = nm_connection_get_uuid (connection);
cmdline = g_strdup_printf ("nm-connection-editor --edit %s", uuid);
g_debug ("Launching '%s'\n", cmdline);
@@ -200,12 +200,12 @@ net_device_edit (NetObject *object)
* net_device_get_property:
**/
static void
-net_device_get_property (GObject *device_,
+net_device_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
- NetDevice *net_device = NET_DEVICE (device_);
+ NetDevice *net_device = NET_DEVICE (object);
NetDevicePrivate *priv = net_device_get_instance_private (net_device);
switch (prop_id) {
@@ -213,7 +213,7 @@ net_device_get_property (GObject *device_,
g_value_set_object (value, priv->nm_device);
break;
default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (net_device, prop_id, pspec);
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
@@ -222,12 +222,12 @@ net_device_get_property (GObject *device_,
* net_device_set_property:
**/
static void
-net_device_set_property (GObject *device_,
+net_device_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
- NetDevice *net_device = NET_DEVICE (device_);
+ NetDevice *net_device = NET_DEVICE (object);
NetDevicePrivate *priv = net_device_get_instance_private (net_device);
switch (prop_id) {
@@ -246,7 +246,7 @@ net_device_set_property (GObject *device_,
priv->changed_id = 0;
break;
default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (net_device, prop_id, pspec);
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
@@ -254,8 +254,8 @@ net_device_set_property (GObject *device_,
static void
net_device_finalize (GObject *object)
{
- NetDevice *device = NET_DEVICE (object);
- NetDevicePrivate *priv = net_device_get_instance_private (device);
+ NetDevice *self = NET_DEVICE (object);
+ NetDevicePrivate *priv = net_device_get_instance_private (self);
if (priv->changed_id != 0) {
g_signal_handler_disconnect (priv->nm_device,
@@ -286,22 +286,20 @@ net_device_class_init (NetDeviceClass *klass)
}
static void
-net_device_init (NetDevice *device)
+net_device_init (NetDevice *self)
{
}
NetDevice *
net_device_new (void)
{
- NetDevice *device;
- device = g_object_new (NET_TYPE_DEVICE,
- "removable", FALSE,
- NULL);
- return NET_DEVICE (device);
+ return g_object_new (NET_TYPE_DEVICE,
+ "removable", FALSE,
+ NULL);
}
GSList *
-net_device_get_valid_connections (NetDevice *device)
+net_device_get_valid_connections (NetDevice *self)
{
GSList *valid;
NMConnection *connection;
@@ -312,10 +310,10 @@ net_device_get_valid_connections (NetDevice *device)
GPtrArray *filtered;
guint i;
- all = nm_client_get_connections (net_object_get_client (NET_OBJECT (device)));
- filtered = nm_device_filter_connections (net_device_get_nm_device (device), all);
+ all = nm_client_get_connections (net_object_get_client (NET_OBJECT (self)));
+ filtered = nm_device_filter_connections (net_device_get_nm_device (self), all);
- active_connection = nm_device_get_active_connection (net_device_get_nm_device (device));
+ active_connection = nm_device_get_active_connection (net_device_get_nm_device (self));
active_uuid = active_connection ? nm_active_connection_get_uuid (active_connection) : NULL;
valid = NULL;
diff --git a/panels/network/net-object.c b/panels/network/net-object.c
index f643036da..6549de8d4 100644
--- a/panels/network/net-object.c
+++ b/panels/network/net-object.c
@@ -57,112 +57,112 @@ static guint signals[SIGNAL_LAST] = { 0 };
G_DEFINE_TYPE_WITH_PRIVATE (NetObject, net_object, G_TYPE_OBJECT)
void
-net_object_emit_changed (NetObject *object)
+net_object_emit_changed (NetObject *self)
{
- NetObjectPrivate *priv = net_object_get_instance_private (object);
+ NetObjectPrivate *priv = net_object_get_instance_private (self);
- g_return_if_fail (NET_IS_OBJECT (object));
+ g_return_if_fail (NET_IS_OBJECT (self));
g_debug ("NetObject: %s emit 'changed'", priv->id);
- g_signal_emit (object, signals[SIGNAL_CHANGED], 0);
+ g_signal_emit (self, signals[SIGNAL_CHANGED], 0);
}
void
-net_object_emit_removed (NetObject *object)
+net_object_emit_removed (NetObject *self)
{
- NetObjectPrivate *priv = net_object_get_instance_private (object);
+ NetObjectPrivate *priv = net_object_get_instance_private (self);
- g_return_if_fail (NET_IS_OBJECT (object));
+ g_return_if_fail (NET_IS_OBJECT (self));
g_debug ("NetObject: %s emit 'removed'", priv->id);
- g_signal_emit (object, signals[SIGNAL_REMOVED], 0);
+ g_signal_emit (self, signals[SIGNAL_REMOVED], 0);
}
const gchar *
-net_object_get_id (NetObject *object)
+net_object_get_id (NetObject *self)
{
- NetObjectPrivate *priv = net_object_get_instance_private (object);
+ NetObjectPrivate *priv = net_object_get_instance_private (self);
- g_return_val_if_fail (NET_IS_OBJECT (object), NULL);
+ g_return_val_if_fail (NET_IS_OBJECT (self), NULL);
return priv->id;
}
void
-net_object_set_id (NetObject *object, const gchar *id)
+net_object_set_id (NetObject *self, const gchar *id)
{
- NetObjectPrivate *priv = net_object_get_instance_private (object);
+ NetObjectPrivate *priv = net_object_get_instance_private (self);
- g_return_if_fail (NET_IS_OBJECT (object));
+ g_return_if_fail (NET_IS_OBJECT (self));
g_clear_pointer (&priv->id, g_free);
priv->id = g_strdup (id);
- g_object_notify (G_OBJECT (object), "id");
+ g_object_notify (G_OBJECT (self), "id");
}
gboolean
-net_object_get_removable (NetObject *object)
+net_object_get_removable (NetObject *self)
{
- NetObjectPrivate *priv = net_object_get_instance_private (object);
+ NetObjectPrivate *priv = net_object_get_instance_private (self);
- g_return_val_if_fail (NET_IS_OBJECT (object), FALSE);
+ g_return_val_if_fail (NET_IS_OBJECT (self), FALSE);
return priv->removable;
}
const gchar *
-net_object_get_title (NetObject *object)
+net_object_get_title (NetObject *self)
{
- NetObjectPrivate *priv = net_object_get_instance_private (object);
+ NetObjectPrivate *priv = net_object_get_instance_private (self);
- g_return_val_if_fail (NET_IS_OBJECT (object), NULL);
+ g_return_val_if_fail (NET_IS_OBJECT (self), NULL);
return priv->title;
}
void
-net_object_set_title (NetObject *object, const gchar *title)
+net_object_set_title (NetObject *self, const gchar *title)
{
- NetObjectPrivate *priv = net_object_get_instance_private (object);
+ NetObjectPrivate *priv = net_object_get_instance_private (self);
- g_return_if_fail (NET_IS_OBJECT (object));
+ g_return_if_fail (NET_IS_OBJECT (self));
g_clear_pointer (&priv->title, g_free);
priv->title = g_strdup (title);
- g_object_notify (G_OBJECT (object), "title");
+ g_object_notify (G_OBJECT (self), "title");
}
NMClient *
-net_object_get_client (NetObject *object)
+net_object_get_client (NetObject *self)
{
- NetObjectPrivate *priv = net_object_get_instance_private (object);
+ NetObjectPrivate *priv = net_object_get_instance_private (self);
- g_return_val_if_fail (NET_IS_OBJECT (object), NULL);
+ g_return_val_if_fail (NET_IS_OBJECT (self), NULL);
return priv->client;
}
GCancellable *
-net_object_get_cancellable (NetObject *object)
+net_object_get_cancellable (NetObject *self)
{
- NetObjectPrivate *priv = net_object_get_instance_private (object);
+ NetObjectPrivate *priv = net_object_get_instance_private (self);
- g_return_val_if_fail (NET_IS_OBJECT (object), NULL);
+ g_return_val_if_fail (NET_IS_OBJECT (self), NULL);
return priv->cancellable;
}
CcNetworkPanel *
-net_object_get_panel (NetObject *object)
+net_object_get_panel (NetObject *self)
{
- NetObjectPrivate *priv = net_object_get_instance_private (object);
+ NetObjectPrivate *priv = net_object_get_instance_private (self);
- g_return_val_if_fail (NET_IS_OBJECT (object), NULL);
+ g_return_val_if_fail (NET_IS_OBJECT (self), NULL);
return priv->panel;
}
GtkWidget *
-net_object_add_to_stack (NetObject *object,
+net_object_add_to_stack (NetObject *self,
GtkStack *stack,
GtkSizeGroup *heading_size_group)
{
GtkWidget *widget;
- NetObjectClass *klass = NET_OBJECT_GET_CLASS (object);
- NetObjectPrivate *priv = net_object_get_instance_private (object);
+ NetObjectClass *klass = NET_OBJECT_GET_CLASS (self);
+ NetObjectPrivate *priv = net_object_get_instance_private (self);
if (klass->add_to_stack != NULL) {
- widget = klass->add_to_stack (object, stack, heading_size_group);
+ widget = klass->add_to_stack (self, stack, heading_size_group);
g_object_set_data_full (G_OBJECT (widget),
"NetObject::id",
g_strdup (priv->id),
@@ -174,40 +174,40 @@ net_object_add_to_stack (NetObject *object,
}
void
-net_object_delete (NetObject *object)
+net_object_delete (NetObject *self)
{
- NetObjectClass *klass = NET_OBJECT_GET_CLASS (object);
+ NetObjectClass *klass = NET_OBJECT_GET_CLASS (self);
if (klass->delete != NULL)
- klass->delete (object);
+ klass->delete (self);
}
void
-net_object_refresh (NetObject *object)
+net_object_refresh (NetObject *self)
{
- NetObjectClass *klass = NET_OBJECT_GET_CLASS (object);
+ NetObjectClass *klass = NET_OBJECT_GET_CLASS (self);
if (klass->refresh != NULL)
- klass->refresh (object);
+ klass->refresh (self);
}
void
-net_object_edit (NetObject *object)
+net_object_edit (NetObject *self)
{
- NetObjectClass *klass = NET_OBJECT_GET_CLASS (object);
+ NetObjectClass *klass = NET_OBJECT_GET_CLASS (self);
if (klass->edit != NULL)
- klass->edit (object);
+ klass->edit (self);
}
/**
* net_object_get_property:
**/
static void
-net_object_get_property (GObject *object_,
+net_object_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
- NetObject *object = NET_OBJECT (object_);
- NetObjectPrivate *priv = net_object_get_instance_private (object);
+ NetObject *self = NET_OBJECT (object);
+ NetObjectPrivate *priv = net_object_get_instance_private (self);
switch (prop_id) {
case PROP_ID:
@@ -238,13 +238,13 @@ net_object_get_property (GObject *object_,
* net_object_set_property:
**/
static void
-net_object_set_property (GObject *object_,
+net_object_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
- NetObject *object = NET_OBJECT (object_);
- NetObjectPrivate *priv = net_object_get_instance_private (object);
+ NetObject *self = NET_OBJECT (object);
+ NetObjectPrivate *priv = net_object_get_instance_private (self);
switch (prop_id) {
case PROP_ID:
@@ -282,8 +282,8 @@ net_object_set_property (GObject *object_,
static void
net_object_finalize (GObject *object)
{
- NetObject *nm_object = NET_OBJECT (object);
- NetObjectPrivate *priv = net_object_get_instance_private (nm_object);
+ NetObject *self = NET_OBJECT (object);
+ NetObjectPrivate *priv = net_object_get_instance_private (self);
g_free (priv->id);
g_free (priv->title);
@@ -349,7 +349,7 @@ net_object_class_init (NetObjectClass *klass)
}
static void
-net_object_init (NetObject *object)
+net_object_init (NetObject *self)
{
}
diff --git a/panels/network/net-proxy.c b/panels/network/net-proxy.c
index b4938e59d..cd3523fc9 100644
--- a/panels/network/net-proxy.c
+++ b/panels/network/net-proxy.c
@@ -87,7 +87,7 @@ panel_update_status_label (NetProxy *self,
}
static void
-check_wpad_warning (NetProxy *proxy)
+check_wpad_warning (NetProxy *self)
{
g_autofree gchar *autoconfig_url = NULL;
GString *string = NULL;
@@ -97,12 +97,12 @@ check_wpad_warning (NetProxy *proxy)
string = g_string_new ("");
/* check we're using 'Automatic' */
- mode = g_settings_get_enum (proxy->settings, "mode");
+ mode = g_settings_get_enum (self->settings, "mode");
if (mode != MODE_AUTOMATIC)
goto out;
/* see if the PAC is blank */
- autoconfig_url = g_settings_get_string (proxy->settings,
+ autoconfig_url = g_settings_get_string (self->settings,
"autoconfig-url");
ret = autoconfig_url == NULL ||
autoconfig_url[0] == '\0';
@@ -123,42 +123,42 @@ check_wpad_warning (NetProxy *proxy)
g_string_append (string, _("This is not recommended for untrusted public networks."));
g_string_append (string, "</small>");
out:
- gtk_label_set_markup (proxy->proxy_warning_label, string->str);
- gtk_widget_set_visible (GTK_WIDGET (proxy->proxy_warning_label), (string->len > 0));
+ gtk_label_set_markup (self->proxy_warning_label, string->str);
+ gtk_widget_set_visible (GTK_WIDGET (self->proxy_warning_label), (string->len > 0));
g_string_free (string, TRUE);
}
static void
-settings_changed_cb (NetProxy *proxy)
+settings_changed_cb (NetProxy *self)
{
- check_wpad_warning (proxy);
+ check_wpad_warning (self);
}
static void
-panel_proxy_mode_setup_widgets (NetProxy *proxy, ProxyMode value)
+panel_proxy_mode_setup_widgets (NetProxy *self, ProxyMode value)
{
/* hide or show the PAC text box */
switch (value) {
case MODE_DISABLED:
- gtk_stack_set_visible_child_name (proxy->stack, "disabled");
+ gtk_stack_set_visible_child_name (self->stack, "disabled");
break;
case MODE_MANUAL:
- gtk_stack_set_visible_child_name (proxy->stack, "manual");
+ gtk_stack_set_visible_child_name (self->stack, "manual");
break;
case MODE_AUTOMATIC:
- gtk_stack_set_visible_child_name (proxy->stack, "automatic");
+ gtk_stack_set_visible_child_name (self->stack, "automatic");
break;
default:
g_assert_not_reached ();
}
/* perhaps show the wpad warning */
- check_wpad_warning (proxy);
+ check_wpad_warning (self);
}
static void
-panel_proxy_mode_radio_changed_cb (NetProxy *proxy, GtkRadioButton *radio)
+panel_proxy_mode_radio_changed_cb (NetProxy *self, GtkRadioButton *radio)
{
ProxyMode value;
@@ -166,23 +166,23 @@ panel_proxy_mode_radio_changed_cb (NetProxy *proxy, GtkRadioButton *radio)
return;
/* get selected radio */
- if (radio == proxy->none_radio)
+ if (radio == self->none_radio)
value = MODE_DISABLED;
- else if (radio == proxy->manual_radio)
+ else if (radio == self->manual_radio)
value = MODE_MANUAL;
- else if (radio == proxy->automatic_radio)
+ else if (radio == self->automatic_radio)
value = MODE_AUTOMATIC;
else
g_assert_not_reached ();
/* set */
- g_settings_set_enum (proxy->settings, "mode", value);
+ g_settings_set_enum (self->settings, "mode", value);
/* hide or show the correct widgets */
- panel_proxy_mode_setup_widgets (proxy, value);
+ panel_proxy_mode_setup_widgets (self, value);
/* status label */
- panel_update_status_label (proxy, value);
+ panel_update_status_label (self, value);
}
static void
@@ -197,22 +197,22 @@ net_proxy_add_to_stack (NetObject *object,
GtkStack *stack,
GtkSizeGroup *heading_size_group)
{
- NetProxy *proxy = NET_PROXY (object);
+ NetProxy *self = NET_PROXY (object);
- gtk_size_group_add_widget (heading_size_group, GTK_WIDGET (proxy->main_widget));
- gtk_stack_add_named (stack, GTK_WIDGET (proxy->main_widget), net_object_get_id (object));
- return GTK_WIDGET (proxy->main_widget);
+ gtk_size_group_add_widget (heading_size_group, GTK_WIDGET (self->main_widget));
+ gtk_stack_add_named (stack, GTK_WIDGET (self->main_widget), net_object_get_id (object));
+ return GTK_WIDGET (self->main_widget);
}
static void
net_proxy_finalize (GObject *object)
{
- NetProxy *proxy = NET_PROXY (object);
+ NetProxy *self = NET_PROXY (object);
- gtk_widget_destroy (GTK_WIDGET (proxy->dialog));
+ gtk_widget_destroy (GTK_WIDGET (self->dialog));
- g_clear_object (&proxy->settings);
- g_clear_object (&proxy->builder);
+ g_clear_object (&self->settings);
+ g_clear_object (&self->builder);
G_OBJECT_CLASS (net_proxy_parent_class)->finalize (object);
}
@@ -276,7 +276,7 @@ set_ignore_hosts (const GValue *value,
}
static void
-net_proxy_init (NetProxy *proxy)
+net_proxy_init (NetProxy *self)
{
g_autoptr(GSettings) http_settings = NULL;
g_autoptr(GSettings) https_settings = NULL;
@@ -285,8 +285,8 @@ net_proxy_init (NetProxy *proxy)
ProxyMode value;
g_autoptr(GError) error = NULL;
- proxy->builder = gtk_builder_new ();
- gtk_builder_add_from_resource (proxy->builder,
+ self->builder = gtk_builder_new ();
+ gtk_builder_add_from_resource (self->builder,
"/org/gnome/control-center/network/network-proxy.ui",
&error);
if (error != NULL) {
@@ -294,123 +294,121 @@ net_proxy_init (NetProxy *proxy)
return;
}
- proxy->automatic_radio = GTK_RADIO_BUTTON (gtk_builder_get_object (proxy->builder,
"automatic_radio"));
- proxy->dialog = GTK_DIALOG (gtk_builder_get_object (proxy->builder, "dialog"));
- proxy->dialog_button = GTK_BUTTON (gtk_builder_get_object (proxy->builder, "dialog_button"));
- proxy->main_widget = GTK_FRAME (gtk_builder_get_object (proxy->builder, "main_widget"));
- proxy->manual_radio = GTK_RADIO_BUTTON (gtk_builder_get_object (proxy->builder, "manual_radio"));
- proxy->none_radio = GTK_RADIO_BUTTON (gtk_builder_get_object (proxy->builder, "none_radio"));
- proxy->proxy_ftp_entry = GTK_ENTRY (gtk_builder_get_object (proxy->builder, "proxy_ftp_entry"));
- proxy->proxy_http_entry = GTK_ENTRY (gtk_builder_get_object (proxy->builder, "proxy_http_entry"));
- proxy->proxy_https_entry = GTK_ENTRY (gtk_builder_get_object (proxy->builder, "proxy_https_entry"));
- proxy->proxy_ignore_entry = GTK_ENTRY (gtk_builder_get_object (proxy->builder,
"proxy_ignore_entry"));
- proxy->proxy_port_ftp_adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (proxy->builder,
"proxy_port_ftp_adjustment"));
- proxy->proxy_port_http_adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (proxy->builder,
"proxy_port_http_adjustment"));
- proxy->proxy_port_https_adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (proxy->builder,
"proxy_port_https_adjustment"));
- proxy->proxy_port_socks_adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (proxy->builder,
"proxy_port_socks_adjustment"));
- proxy->proxy_socks_entry = GTK_ENTRY (gtk_builder_get_object (proxy->builder, "proxy_socks_entry"));
- proxy->proxy_url_entry = GTK_ENTRY (gtk_builder_get_object (proxy->builder, "proxy_url_entry"));
- proxy->proxy_warning_label = GTK_LABEL (gtk_builder_get_object (proxy->builder,
"proxy_warning_label"));
- proxy->stack = GTK_STACK (gtk_builder_get_object (proxy->builder, "stack"));
- proxy->status_label = GTK_LABEL (gtk_builder_get_object (proxy->builder, "status_label"));
-
- proxy->settings = g_settings_new ("org.gnome.system.proxy");
- g_signal_connect_swapped (proxy->settings,
+ self->automatic_radio = GTK_RADIO_BUTTON (gtk_builder_get_object (self->builder, "automatic_radio"));
+ self->dialog = GTK_DIALOG (gtk_builder_get_object (self->builder, "dialog"));
+ self->dialog_button = GTK_BUTTON (gtk_builder_get_object (self->builder, "dialog_button"));
+ self->main_widget = GTK_FRAME (gtk_builder_get_object (self->builder, "main_widget"));
+ self->manual_radio = GTK_RADIO_BUTTON (gtk_builder_get_object (self->builder, "manual_radio"));
+ self->none_radio = GTK_RADIO_BUTTON (gtk_builder_get_object (self->builder, "none_radio"));
+ self->proxy_ftp_entry = GTK_ENTRY (gtk_builder_get_object (self->builder, "proxy_ftp_entry"));
+ self->proxy_http_entry = GTK_ENTRY (gtk_builder_get_object (self->builder, "proxy_http_entry"));
+ self->proxy_https_entry = GTK_ENTRY (gtk_builder_get_object (self->builder, "proxy_https_entry"));
+ self->proxy_ignore_entry = GTK_ENTRY (gtk_builder_get_object (self->builder, "proxy_ignore_entry"));
+ self->proxy_port_ftp_adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (self->builder,
"proxy_port_ftp_adjustment"));
+ self->proxy_port_http_adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (self->builder,
"proxy_port_http_adjustment"));
+ self->proxy_port_https_adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (self->builder,
"proxy_port_https_adjustment"));
+ self->proxy_port_socks_adjustment = GTK_ADJUSTMENT (gtk_builder_get_object (self->builder,
"proxy_port_socks_adjustment"));
+ self->proxy_socks_entry = GTK_ENTRY (gtk_builder_get_object (self->builder, "proxy_socks_entry"));
+ self->proxy_url_entry = GTK_ENTRY (gtk_builder_get_object (self->builder, "proxy_url_entry"));
+ self->proxy_warning_label = GTK_LABEL (gtk_builder_get_object (self->builder,
"proxy_warning_label"));
+ self->stack = GTK_STACK (gtk_builder_get_object (self->builder, "stack"));
+ self->status_label = GTK_LABEL (gtk_builder_get_object (self->builder, "status_label"));
+
+ self->settings = g_settings_new ("org.gnome.system.proxy");
+ g_signal_connect_swapped (self->settings,
"changed",
G_CALLBACK (settings_changed_cb),
- proxy);
+ self);
/* actions */
- value = g_settings_get_enum (proxy->settings, "mode");
+ value = g_settings_get_enum (self->settings, "mode");
/* bind the proxy values */
- g_settings_bind (proxy->settings, "autoconfig-url",
- proxy->proxy_url_entry, "text",
+ g_settings_bind (self->settings, "autoconfig-url",
+ self->proxy_url_entry, "text",
G_SETTINGS_BIND_DEFAULT);
/* bind the HTTP proxy values */
- http_settings = g_settings_get_child (proxy->settings, "http");
+ http_settings = g_settings_get_child (self->settings, "http");
g_settings_bind (http_settings, "host",
- proxy->proxy_http_entry, "text",
+ self->proxy_http_entry, "text",
G_SETTINGS_BIND_DEFAULT);
g_settings_bind (http_settings, "port",
- proxy->proxy_port_http_adjustment, "value",
+ self->proxy_port_http_adjustment, "value",
G_SETTINGS_BIND_DEFAULT);
/* bind the HTTPS proxy values */
- https_settings = g_settings_get_child (proxy->settings, "https");
+ https_settings = g_settings_get_child (self->settings, "https");
g_settings_bind (https_settings, "host",
- proxy->proxy_https_entry, "text",
+ self->proxy_https_entry, "text",
G_SETTINGS_BIND_DEFAULT);
g_settings_bind (https_settings, "port",
- proxy->proxy_port_https_adjustment, "value",
+ self->proxy_port_https_adjustment, "value",
G_SETTINGS_BIND_DEFAULT);
/* bind the FTP proxy values */
- ftp_settings = g_settings_get_child (proxy->settings, "ftp");
+ ftp_settings = g_settings_get_child (self->settings, "ftp");
g_settings_bind (ftp_settings, "host",
- proxy->proxy_ftp_entry, "text",
+ self->proxy_ftp_entry, "text",
G_SETTINGS_BIND_DEFAULT);
g_settings_bind (ftp_settings, "port",
- proxy->proxy_port_ftp_adjustment, "value",
+ self->proxy_port_ftp_adjustment, "value",
G_SETTINGS_BIND_DEFAULT);
/* bind the SOCKS proxy values */
- socks_settings = g_settings_get_child (proxy->settings, "socks");
+ socks_settings = g_settings_get_child (self->settings, "socks");
g_settings_bind (socks_settings, "host",
- proxy->proxy_socks_entry, "text",
+ self->proxy_socks_entry, "text",
G_SETTINGS_BIND_DEFAULT);
g_settings_bind (socks_settings, "port",
- proxy->proxy_port_socks_adjustment, "value",
+ self->proxy_port_socks_adjustment, "value",
G_SETTINGS_BIND_DEFAULT);
/* bind the proxy ignore hosts */
- g_settings_bind_with_mapping (proxy->settings, "ignore-hosts",
- proxy->proxy_ignore_entry, "text",
+ g_settings_bind_with_mapping (self->settings, "ignore-hosts",
+ self->proxy_ignore_entry, "text",
G_SETTINGS_BIND_DEFAULT, get_ignore_hosts, set_ignore_hosts,
NULL, NULL);
/* setup the radio before connecting to the :toggled signal */
switch (value) {
case MODE_DISABLED:
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (proxy->none_radio), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->none_radio), TRUE);
break;
case MODE_MANUAL:
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (proxy->manual_radio), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->manual_radio), TRUE);
break;
case MODE_AUTOMATIC:
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (proxy->automatic_radio), TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->automatic_radio), TRUE);
break;
default:
g_assert_not_reached ();
}
- panel_proxy_mode_setup_widgets (proxy, value);
- panel_update_status_label (proxy, value);
+ panel_proxy_mode_setup_widgets (self, value);
+ panel_update_status_label (self, value);
- g_signal_connect_swapped (proxy->none_radio, "toggled", G_CALLBACK
(panel_proxy_mode_radio_changed_cb), proxy);
- g_signal_connect_swapped (proxy->manual_radio, "toggled", G_CALLBACK
(panel_proxy_mode_radio_changed_cb), proxy);
- g_signal_connect_swapped (proxy->automatic_radio, "toggled", G_CALLBACK
(panel_proxy_mode_radio_changed_cb), proxy);
+ g_signal_connect_swapped (self->none_radio, "toggled", G_CALLBACK
(panel_proxy_mode_radio_changed_cb), self);
+ g_signal_connect_swapped (self->manual_radio, "toggled", G_CALLBACK
(panel_proxy_mode_radio_changed_cb), self);
+ g_signal_connect_swapped (self->automatic_radio, "toggled", G_CALLBACK
(panel_proxy_mode_radio_changed_cb), self);
/* show dialog button */
- g_signal_connect_swapped (proxy->dialog_button,
+ g_signal_connect_swapped (self->dialog_button,
"clicked",
G_CALLBACK (show_dialog_cb),
- proxy);
+ self);
/* prevent the dialog from being destroyed */
- g_signal_connect (proxy->dialog,
+ g_signal_connect (self->dialog,
"delete-event",
G_CALLBACK (gtk_widget_hide_on_delete),
- proxy->dialog);
+ self->dialog);
}
NetProxy *
net_proxy_new (void)
{
- NetProxy *proxy;
- proxy = g_object_new (NET_TYPE_PROXY,
- "removable", FALSE,
- "id", "proxy",
- NULL);
- return NET_PROXY (proxy);
+ return g_object_new (NET_TYPE_PROXY,
+ "removable", FALSE,
+ "id", "proxy",
+ NULL);
}
diff --git a/panels/network/net-vpn.c b/panels/network/net-vpn.c
index d6f761857..6266a35ae 100644
--- a/panels/network/net-vpn.c
+++ b/panels/network/net-vpn.c
@@ -58,7 +58,7 @@ enum {
G_DEFINE_TYPE (NetVpn, net_vpn, NET_TYPE_OBJECT)
-static void nm_device_refresh_vpn_ui (NetVpn *vpn);
+static void nm_device_refresh_vpn_ui (NetVpn *self);
void
net_vpn_set_show_separator (NetVpn *self,
@@ -68,17 +68,17 @@ net_vpn_set_show_separator (NetVpn *self,
}
static void
-connection_changed_cb (NetVpn *vpn)
+connection_changed_cb (NetVpn *self)
{
- net_object_emit_changed (NET_OBJECT (vpn));
- nm_device_refresh_vpn_ui (vpn);
+ net_object_emit_changed (NET_OBJECT (self));
+ nm_device_refresh_vpn_ui (self);
}
static void
-connection_removed_cb (NetVpn *vpn, NMConnection *connection)
+connection_removed_cb (NetVpn *self, NMConnection *connection)
{
- if (vpn->connection == connection)
- net_object_emit_removed (NET_OBJECT (vpn));
+ if (self->connection == connection)
+ net_object_emit_removed (NET_OBJECT (self));
}
static char *
@@ -93,7 +93,7 @@ net_vpn_connection_to_type (NMConnection *connection)
}
static void
-net_vpn_set_connection (NetVpn *vpn, NMConnection *connection)
+net_vpn_set_connection (NetVpn *self, NMConnection *connection)
{
NMClient *client;
@@ -107,27 +107,27 @@ net_vpn_set_connection (NetVpn *vpn, NMConnection *connection)
* key=IPSec ID, value=rh-vpn
* key=Xauth username, value=rhughes
*/
- vpn->connection = g_object_ref (connection);
+ self->connection = g_object_ref (connection);
- client = net_object_get_client (NET_OBJECT (vpn));
+ client = net_object_get_client (NET_OBJECT (self));
g_signal_connect_object (client,
NM_CLIENT_CONNECTION_REMOVED,
G_CALLBACK (connection_removed_cb),
- vpn, G_CONNECT_SWAPPED);
+ self, G_CONNECT_SWAPPED);
g_signal_connect_object (connection,
NM_CONNECTION_CHANGED,
G_CALLBACK (connection_changed_cb),
- vpn, G_CONNECT_SWAPPED);
+ self, G_CONNECT_SWAPPED);
- vpn->service_type = net_vpn_connection_to_type (vpn->connection);
+ self->service_type = net_vpn_connection_to_type (self->connection);
}
static void
vpn_proxy_delete (NetObject *object)
{
- NetVpn *vpn = NET_VPN (object);
- nm_remote_connection_delete_async (NM_REMOTE_CONNECTION (vpn->connection),
- NULL, NULL, vpn);
+ NetVpn *self = NET_VPN (object);
+ nm_remote_connection_delete_async (NM_REMOTE_CONNECTION (self->connection),
+ NULL, NULL, self);
}
static GtkWidget *
@@ -135,15 +135,15 @@ vpn_proxy_add_to_stack (NetObject *object,
GtkStack *stack,
GtkSizeGroup *heading_size_group)
{
- NetVpn *vpn = NET_VPN (object);
+ NetVpn *self = NET_VPN (object);
/* add widgets to size group */
- gtk_stack_add_named (stack, GTK_WIDGET (vpn->box), net_object_get_id (object));
- return GTK_WIDGET (vpn->box);
+ gtk_stack_add_named (stack, GTK_WIDGET (self->box), net_object_get_id (object));
+ return GTK_WIDGET (self->box);
}
static void
-nm_device_refresh_vpn_ui (NetVpn *vpn)
+nm_device_refresh_vpn_ui (NetVpn *self)
{
const GPtrArray *acs;
NMActiveConnection *a;
@@ -157,25 +157,25 @@ nm_device_refresh_vpn_ui (NetVpn *vpn)
* window for vpn connections, it is also used to display
* vpn connections in the device list.
*/
- title = g_strdup_printf (_("%s VPN"), nm_connection_get_id (vpn->connection));
- net_object_set_title (NET_OBJECT (vpn), title);
- gtk_label_set_label (vpn->device_label, title);
+ title = g_strdup_printf (_("%s VPN"), nm_connection_get_id (self->connection));
+ net_object_set_title (NET_OBJECT (self), title);
+ gtk_label_set_label (self->device_label, title);
- if (vpn->active_connection) {
- g_signal_handlers_disconnect_by_func (vpn->active_connection,
+ if (self->active_connection) {
+ g_signal_handlers_disconnect_by_func (self->active_connection,
nm_device_refresh_vpn_ui,
- vpn);
- g_clear_object (&vpn->active_connection);
+ self);
+ g_clear_object (&self->active_connection);
}
/* Default to disconnected if there is no active connection */
state = NM_VPN_CONNECTION_STATE_DISCONNECTED;
- client = net_object_get_client (NET_OBJECT (vpn));
+ client = net_object_get_client (NET_OBJECT (self));
acs = nm_client_get_active_connections (client);
if (acs != NULL) {
const gchar *uuid;
- uuid = nm_connection_get_uuid (vpn->connection);
+ uuid = nm_connection_get_uuid (self->connection);
for (i = 0; i < acs->len; i++) {
const gchar *auuid;
@@ -184,38 +184,38 @@ nm_device_refresh_vpn_ui (NetVpn *vpn)
auuid = nm_active_connection_get_uuid (a);
if (NM_IS_VPN_CONNECTION (a) && strcmp (auuid, uuid) == 0) {
- vpn->active_connection = g_object_ref (a);
+ self->active_connection = g_object_ref (a);
g_signal_connect_swapped (a, "notify::vpn-state",
G_CALLBACK (nm_device_refresh_vpn_ui),
- vpn);
+ self);
state = nm_vpn_connection_get_vpn_state (NM_VPN_CONNECTION (a));
break;
}
}
}
- vpn->updating_device = TRUE;
- gtk_switch_set_active (vpn->device_off_switch,
+ self->updating_device = TRUE;
+ gtk_switch_set_active (self->device_off_switch,
state != NM_VPN_CONNECTION_STATE_FAILED &&
state != NM_VPN_CONNECTION_STATE_DISCONNECTED);
- vpn->updating_device = FALSE;
+ self->updating_device = FALSE;
}
static void
-nm_active_connections_changed (NetVpn *vpn)
+nm_active_connections_changed (NetVpn *self)
{
- nm_device_refresh_vpn_ui (vpn);
+ nm_device_refresh_vpn_ui (self);
}
static void
vpn_proxy_refresh (NetObject *object)
{
- NetVpn *vpn = NET_VPN (object);
- nm_device_refresh_vpn_ui (vpn);
+ NetVpn *self = NET_VPN (object);
+ nm_device_refresh_vpn_ui (self);
}
static void
-device_off_toggled (NetVpn *vpn)
+device_off_toggled (NetVpn *self)
{
const GPtrArray *acs;
gboolean active;
@@ -223,20 +223,20 @@ device_off_toggled (NetVpn *vpn)
NMActiveConnection *a;
NMClient *client;
- if (vpn->updating_device)
+ if (self->updating_device)
return;
- active = gtk_switch_get_active (vpn->device_off_switch);
+ active = gtk_switch_get_active (self->device_off_switch);
if (active) {
- client = net_object_get_client (NET_OBJECT (vpn));
+ client = net_object_get_client (NET_OBJECT (self));
nm_client_activate_connection_async (client,
- vpn->connection, NULL, NULL,
+ self->connection, NULL, NULL,
NULL, NULL, NULL);
} else {
const gchar *uuid;
- uuid = nm_connection_get_uuid (vpn->connection);
- client = net_object_get_client (NET_OBJECT (vpn));
+ uuid = nm_connection_get_uuid (self->connection);
+ client = net_object_get_client (NET_OBJECT (self));
acs = nm_client_get_active_connections (client);
for (i = 0; acs && i < acs->len; i++) {
a = (NMActiveConnection*)acs->pdata[i];
@@ -249,38 +249,38 @@ device_off_toggled (NetVpn *vpn)
}
static void
-edit_connection (NetVpn *vpn)
+edit_connection (NetVpn *self)
{
- net_object_edit (NET_OBJECT (vpn));
+ net_object_edit (NET_OBJECT (self));
}
static void
-editor_done (NetVpn *vpn)
+editor_done (NetVpn *self)
{
- net_object_refresh (NET_OBJECT (vpn));
- g_object_unref (vpn);
+ net_object_refresh (NET_OBJECT (self));
+ g_object_unref (self);
}
static void
vpn_proxy_edit (NetObject *object)
{
- NetVpn *vpn = NET_VPN (object);
+ NetVpn *self = NET_VPN (object);
GtkWidget *window;
NetConnectionEditor *editor;
NMClient *client;
g_autofree gchar *title = NULL;
- window = gtk_widget_get_toplevel (GTK_WIDGET (vpn->options_button));
+ window = gtk_widget_get_toplevel (GTK_WIDGET (self->options_button));
client = net_object_get_client (object);
editor = net_connection_editor_new (GTK_WINDOW (window),
- vpn->connection,
+ self->connection,
NULL, NULL, client);
- title = g_strdup_printf (_("%s VPN"), nm_connection_get_id (vpn->connection));
+ title = g_strdup_printf (_("%s VPN"), nm_connection_get_id (self->connection));
net_connection_editor_set_title (editor, title);
- g_signal_connect_swapped (editor, "done", G_CALLBACK (editor_done), g_object_ref (vpn));
+ g_signal_connect_swapped (editor, "done", G_CALLBACK (editor_done), g_object_ref (self));
net_connection_editor_run (editor);
}
@@ -293,14 +293,14 @@ net_vpn_get_property (GObject *object,
GValue *value,
GParamSpec *pspec)
{
- NetVpn *vpn = NET_VPN (object);
+ NetVpn *self = NET_VPN (object);
switch (prop_id) {
case PROP_CONNECTION:
- g_value_set_object (value, vpn->connection);
+ g_value_set_object (value, self->connection);
break;
default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (vpn, prop_id, pspec);
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (self, prop_id, pspec);
break;
}
}
@@ -314,14 +314,14 @@ net_vpn_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
- NetVpn *vpn = NET_VPN (object);
+ NetVpn *self = NET_VPN (object);
switch (prop_id) {
case PROP_CONNECTION:
- net_vpn_set_connection (vpn, g_value_get_object (value));
+ net_vpn_set_connection (self, g_value_get_object (value));
break;
default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (vpn, prop_id, pspec);
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (self, prop_id, pspec);
break;
}
}
@@ -329,43 +329,43 @@ net_vpn_set_property (GObject *object,
static void
net_vpn_constructed (GObject *object)
{
- NetVpn *vpn = NET_VPN (object);
+ NetVpn *self = NET_VPN (object);
NMClient *client = net_object_get_client (NET_OBJECT (object));
G_OBJECT_CLASS (net_vpn_parent_class)->constructed (object);
- nm_device_refresh_vpn_ui (vpn);
+ nm_device_refresh_vpn_ui (self);
g_signal_connect_swapped (client,
"notify::active-connections",
G_CALLBACK (nm_active_connections_changed),
- vpn);
+ self);
}
static void
net_vpn_finalize (GObject *object)
{
- NetVpn *vpn = NET_VPN (object);
+ NetVpn *self = NET_VPN (object);
NMClient *client = net_object_get_client (NET_OBJECT (object));
if (client) {
g_signal_handlers_disconnect_by_func (client,
nm_active_connections_changed,
- vpn);
+ self);
}
- if (vpn->active_connection) {
- g_signal_handlers_disconnect_by_func (vpn->active_connection,
+ if (self->active_connection) {
+ g_signal_handlers_disconnect_by_func (self->active_connection,
nm_device_refresh_vpn_ui,
- vpn);
- g_object_unref (vpn->active_connection);
+ self);
+ g_object_unref (self->active_connection);
}
- g_object_unref (vpn->connection);
- g_free (vpn->service_type);
+ g_object_unref (self->connection);
+ g_free (self->service_type);
- g_clear_object (&vpn->builder);
+ g_clear_object (&self->builder);
G_OBJECT_CLASS (net_vpn_parent_class)->finalize (object);
}
@@ -393,12 +393,12 @@ net_vpn_class_init (NetVpnClass *klass)
}
static void
-net_vpn_init (NetVpn *vpn)
+net_vpn_init (NetVpn *self)
{
g_autoptr(GError) error = NULL;
- vpn->builder = gtk_builder_new ();
- gtk_builder_add_from_resource (vpn->builder,
+ self->builder = gtk_builder_new ();
+ gtk_builder_add_from_resource (self->builder,
"/org/gnome/control-center/network/network-vpn.ui",
&error);
if (error != NULL) {
@@ -406,15 +406,15 @@ net_vpn_init (NetVpn *vpn)
return;
}
- vpn->box = GTK_BOX (gtk_builder_get_object (vpn->builder, "box"));
- vpn->device_label = GTK_LABEL (gtk_builder_get_object (vpn->builder, "device_label"));
- vpn->device_off_switch = GTK_SWITCH (gtk_builder_get_object (vpn->builder, "device_off_switch"));
- vpn->options_button = GTK_BUTTON (gtk_builder_get_object (vpn->builder, "options_button"));
- vpn->separator = GTK_SEPARATOR (gtk_builder_get_object (vpn->builder, "separator"));
+ self->box = GTK_BOX (gtk_builder_get_object (self->builder, "box"));
+ self->device_label = GTK_LABEL (gtk_builder_get_object (self->builder, "device_label"));
+ self->device_off_switch = GTK_SWITCH (gtk_builder_get_object (self->builder, "device_off_switch"));
+ self->options_button = GTK_BUTTON (gtk_builder_get_object (self->builder, "options_button"));
+ self->separator = GTK_SEPARATOR (gtk_builder_get_object (self->builder, "separator"));
- g_signal_connect_swapped (vpn->device_off_switch, "notify::active",
- G_CALLBACK (device_off_toggled), vpn);
+ g_signal_connect_swapped (self->device_off_switch, "notify::active",
+ G_CALLBACK (device_off_toggled), self);
- g_signal_connect_swapped (vpn->options_button, "clicked",
- G_CALLBACK (edit_connection), vpn);
+ g_signal_connect_swapped (self->options_button, "clicked",
+ G_CALLBACK (edit_connection), self);
}
diff --git a/panels/network/wireless-security/eap-method-fast.c
b/panels/network/wireless-security/eap-method-fast.c
index 3d789d6a5..6cbbc1485 100644
--- a/panels/network/wireless-security/eap-method-fast.c
+++ b/panels/network/wireless-security/eap-method-fast.c
@@ -54,10 +54,10 @@ struct _EAPMethodFAST {
static void
destroy (EAPMethod *parent)
{
- EAPMethodFAST *method = (EAPMethodFAST *) parent;
+ EAPMethodFAST *self = (EAPMethodFAST *) parent;
- if (method->size_group)
- g_object_unref (method->size_group);
+ if (self->size_group)
+ g_object_unref (self->size_group);
}
static gboolean
@@ -91,22 +91,22 @@ validate (EAPMethod *parent, GError **error)
static void
add_to_size_group (EAPMethod *parent, GtkSizeGroup *group)
{
- EAPMethodFAST *method = (EAPMethodFAST *) parent;
+ EAPMethodFAST *self = (EAPMethodFAST *) parent;
GtkTreeModel *model;
GtkTreeIter iter;
g_autoptr(EAPMethod) eap = NULL;
- if (method->size_group)
- g_object_unref (method->size_group);
- method->size_group = g_object_ref (group);
+ if (self->size_group)
+ g_object_unref (self->size_group);
+ self->size_group = g_object_ref (group);
- gtk_size_group_add_widget (group, GTK_WIDGET (method->anon_identity_label));
- gtk_size_group_add_widget (group, GTK_WIDGET (method->pac_file_label));
- gtk_size_group_add_widget (group, GTK_WIDGET (method->pac_provision_check));
- gtk_size_group_add_widget (group, GTK_WIDGET (method->inner_auth_label));
+ gtk_size_group_add_widget (group, GTK_WIDGET (self->anon_identity_label));
+ gtk_size_group_add_widget (group, GTK_WIDGET (self->pac_file_label));
+ gtk_size_group_add_widget (group, GTK_WIDGET (self->pac_provision_check));
+ gtk_size_group_add_widget (group, GTK_WIDGET (self->inner_auth_label));
- model = gtk_combo_box_get_model (method->inner_auth_combo);
- gtk_combo_box_get_active_iter (method->inner_auth_combo, &iter);
+ model = gtk_combo_box_get_model (self->inner_auth_combo);
+ gtk_combo_box_get_active_iter (self->inner_auth_combo, &iter);
gtk_tree_model_get (model, &iter, I_METHOD_COLUMN, &eap, -1);
g_assert (eap);
eap_method_add_to_size_group (eap, group);
@@ -200,7 +200,7 @@ inner_auth_combo_changed_cb (EAPMethodFAST *self)
}
static void
-inner_auth_combo_init (EAPMethodFAST *method,
+inner_auth_combo_init (EAPMethodFAST *self,
NMConnection *connection,
NMSetting8021x *s_8021x,
gboolean secrets_only)
@@ -223,12 +223,12 @@ inner_auth_combo_init (EAPMethodFAST *method,
}
simple_flags = EAP_METHOD_SIMPLE_FLAG_PHASE2;
- if (method->is_editor)
+ if (self->is_editor)
simple_flags |= EAP_METHOD_SIMPLE_FLAG_IS_EDITOR;
if (secrets_only)
simple_flags |= EAP_METHOD_SIMPLE_FLAG_SECRETS_ONLY;
- em_gtc = eap_method_simple_new (method->sec_parent,
+ em_gtc = eap_method_simple_new (self->sec_parent,
connection,
EAP_METHOD_SIMPLE_TYPE_GTC,
simple_flags);
@@ -242,7 +242,7 @@ inner_auth_combo_init (EAPMethodFAST *method,
if (phase2_auth && !strcasecmp (phase2_auth, "gtc"))
active = 0;
- em_mschap_v2 = eap_method_simple_new (method->sec_parent,
+ em_mschap_v2 = eap_method_simple_new (self->sec_parent,
connection,
EAP_METHOD_SIMPLE_TYPE_MSCHAP_V2,
simple_flags);
@@ -256,10 +256,10 @@ inner_auth_combo_init (EAPMethodFAST *method,
if (phase2_auth && !strcasecmp (phase2_auth, "mschapv2"))
active = 1;
- gtk_combo_box_set_model (method->inner_auth_combo, GTK_TREE_MODEL (auth_model));
- gtk_combo_box_set_active (method->inner_auth_combo, active);
+ gtk_combo_box_set_model (self->inner_auth_combo, GTK_TREE_MODEL (auth_model));
+ gtk_combo_box_set_active (self->inner_auth_combo, active);
- g_signal_connect_swapped (method->inner_auth_combo, "changed", G_CALLBACK
(inner_auth_combo_changed_cb), method);
+ g_signal_connect_swapped (self->inner_auth_combo, "changed", G_CALLBACK
(inner_auth_combo_changed_cb), self);
}
static void
@@ -296,7 +296,7 @@ eap_method_fast_new (WirelessSecurity *ws_parent,
gboolean secrets_only)
{
EAPMethod *parent;
- EAPMethodFAST *method;
+ EAPMethodFAST *self;
GtkFileFilter *filter;
NMSetting8021x *s_8021x = NULL;
const char *filename;
@@ -316,24 +316,24 @@ eap_method_fast_new (WirelessSecurity *ws_parent,
return NULL;
parent->password_flags_name = NM_SETTING_802_1X_PASSWORD;
- method = (EAPMethodFAST *) parent;
- method->sec_parent = ws_parent;
- method->is_editor = is_editor;
-
- method->anon_identity_entry = GTK_ENTRY (gtk_builder_get_object (parent->builder,
"anon_identity_entry"));
- method->anon_identity_label = GTK_LABEL (gtk_builder_get_object (parent->builder,
"anon_identity_label"));
- method->inner_auth_combo = GTK_COMBO_BOX (gtk_builder_get_object (parent->builder,
"inner_auth_combo"));
- method->inner_auth_label = GTK_LABEL (gtk_builder_get_object (parent->builder, "inner_auth_label"));
- method->inner_auth_box = GTK_BOX (gtk_builder_get_object (parent->builder, "inner_auth_box"));
- method->pac_file_button = GTK_FILE_CHOOSER_BUTTON (gtk_builder_get_object (parent->builder,
"pac_file_button"));
- method->pac_file_label = GTK_LABEL (gtk_builder_get_object (parent->builder, "pac_file_label"));
- method->pac_provision_check = GTK_CHECK_BUTTON (gtk_builder_get_object (parent->builder,
"pac_provision_check"));
- method->pac_provision_combo = GTK_COMBO_BOX (gtk_builder_get_object (parent->builder,
"pac_provision_combo"));
+ self = (EAPMethodFAST *) parent;
+ self->sec_parent = ws_parent;
+ self->is_editor = is_editor;
+
+ self->anon_identity_entry = GTK_ENTRY (gtk_builder_get_object (parent->builder,
"anon_identity_entry"));
+ self->anon_identity_label = GTK_LABEL (gtk_builder_get_object (parent->builder,
"anon_identity_label"));
+ self->inner_auth_combo = GTK_COMBO_BOX (gtk_builder_get_object (parent->builder, "inner_auth_combo"));
+ self->inner_auth_label = GTK_LABEL (gtk_builder_get_object (parent->builder, "inner_auth_label"));
+ self->inner_auth_box = GTK_BOX (gtk_builder_get_object (parent->builder, "inner_auth_box"));
+ self->pac_file_button = GTK_FILE_CHOOSER_BUTTON (gtk_builder_get_object (parent->builder,
"pac_file_button"));
+ self->pac_file_label = GTK_LABEL (gtk_builder_get_object (parent->builder, "pac_file_label"));
+ self->pac_provision_check = GTK_CHECK_BUTTON (gtk_builder_get_object (parent->builder,
"pac_provision_check"));
+ self->pac_provision_combo = GTK_COMBO_BOX (gtk_builder_get_object (parent->builder,
"pac_provision_combo"));
if (connection)
s_8021x = nm_connection_get_setting_802_1x (connection);
- gtk_combo_box_set_active (method->pac_provision_combo, 0);
+ gtk_combo_box_set_active (self->pac_provision_combo, 0);
if (s_8021x) {
const char *fast_prov;
@@ -342,57 +342,57 @@ eap_method_fast_new (WirelessSecurity *ws_parent,
if (!strcmp (fast_prov, "0"))
provisioning_enabled = FALSE;
else if (!strcmp (fast_prov, "1"))
- gtk_combo_box_set_active (method->pac_provision_combo, 0);
+ gtk_combo_box_set_active (self->pac_provision_combo, 0);
else if (!strcmp (fast_prov, "2"))
- gtk_combo_box_set_active (method->pac_provision_combo, 1);
+ gtk_combo_box_set_active (self->pac_provision_combo, 1);
else if (!strcmp (fast_prov, "3"))
- gtk_combo_box_set_active (method->pac_provision_combo, 2);
+ gtk_combo_box_set_active (self->pac_provision_combo, 2);
}
}
- gtk_widget_set_sensitive (GTK_WIDGET (method->pac_provision_combo), provisioning_enabled);
- g_signal_connect_swapped (method->pac_provision_combo, "changed", G_CALLBACK (changed_cb), method);
+ gtk_widget_set_sensitive (GTK_WIDGET (self->pac_provision_combo), provisioning_enabled);
+ g_signal_connect_swapped (self->pac_provision_combo, "changed", G_CALLBACK (changed_cb), self);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (method->pac_provision_check), provisioning_enabled);
- g_signal_connect_swapped (method->pac_provision_check, "toggled", G_CALLBACK (pac_toggled_cb),
method);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->pac_provision_check), provisioning_enabled);
+ g_signal_connect_swapped (self->pac_provision_check, "toggled", G_CALLBACK (pac_toggled_cb), self);
if (s_8021x && nm_setting_802_1x_get_anonymous_identity (s_8021x))
- gtk_entry_set_text (method->anon_identity_entry, nm_setting_802_1x_get_anonymous_identity
(s_8021x));
- g_signal_connect_swapped (method->anon_identity_entry, "changed", G_CALLBACK (changed_cb), method);
+ gtk_entry_set_text (self->anon_identity_entry, nm_setting_802_1x_get_anonymous_identity
(s_8021x));
+ g_signal_connect_swapped (self->anon_identity_entry, "changed", G_CALLBACK (changed_cb), self);
- gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (method->pac_file_button), TRUE);
- gtk_file_chooser_button_set_title (method->pac_file_button,
+ gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (self->pac_file_button), TRUE);
+ gtk_file_chooser_button_set_title (self->pac_file_button,
_("Choose a PAC file"));
- g_signal_connect_swapped (method->pac_file_button, "selection-changed", G_CALLBACK (changed_cb),
method);
+ g_signal_connect_swapped (self->pac_file_button, "selection-changed", G_CALLBACK (changed_cb), self);
filter = gtk_file_filter_new ();
gtk_file_filter_add_pattern (filter, "*.pac");
gtk_file_filter_set_name (filter, _("PAC files (*.pac)"));
- gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (method->pac_file_button), filter);
+ gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (self->pac_file_button), filter);
filter = gtk_file_filter_new ();
gtk_file_filter_add_pattern (filter, "*");
gtk_file_filter_set_name (filter, _("All files"));
- gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (method->pac_file_button), filter);
+ gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (self->pac_file_button), filter);
if (connection && s_8021x) {
filename = nm_setting_802_1x_get_pac_file (s_8021x);
if (filename)
- gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (method->pac_file_button), filename);
+ gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (self->pac_file_button), filename);
}
- inner_auth_combo_init (method, connection, s_8021x, secrets_only);
- inner_auth_combo_changed_cb (method);
+ inner_auth_combo_init (self, connection, s_8021x, secrets_only);
+ inner_auth_combo_changed_cb (self);
if (secrets_only) {
- gtk_widget_hide (GTK_WIDGET (method->anon_identity_label));
- gtk_widget_hide (GTK_WIDGET (method->anon_identity_entry));
- gtk_widget_hide (GTK_WIDGET (method->pac_provision_check));
- gtk_widget_hide (GTK_WIDGET (method->pac_provision_combo));
- gtk_widget_hide (GTK_WIDGET (method->pac_file_label));
- gtk_widget_hide (GTK_WIDGET (method->pac_file_button));
- gtk_widget_hide (GTK_WIDGET (method->inner_auth_label));
- gtk_widget_hide (GTK_WIDGET (method->inner_auth_combo));
+ gtk_widget_hide (GTK_WIDGET (self->anon_identity_label));
+ gtk_widget_hide (GTK_WIDGET (self->anon_identity_entry));
+ gtk_widget_hide (GTK_WIDGET (self->pac_provision_check));
+ gtk_widget_hide (GTK_WIDGET (self->pac_provision_combo));
+ gtk_widget_hide (GTK_WIDGET (self->pac_file_label));
+ gtk_widget_hide (GTK_WIDGET (self->pac_file_button));
+ gtk_widget_hide (GTK_WIDGET (self->inner_auth_label));
+ gtk_widget_hide (GTK_WIDGET (self->inner_auth_combo));
}
- return method;
+ return self;
}
diff --git a/panels/network/wireless-security/eap-method-leap.c
b/panels/network/wireless-security/eap-method-leap.c
index 2466625a7..48cede21b 100644
--- a/panels/network/wireless-security/eap-method-leap.c
+++ b/panels/network/wireless-security/eap-method-leap.c
@@ -47,37 +47,37 @@ struct _EAPMethodLEAP {
};
static void
-show_toggled_cb (EAPMethodLEAP *method)
+show_toggled_cb (EAPMethodLEAP *self)
{
gboolean visible;
- visible = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (method->show_password_check));
- gtk_entry_set_visibility (method->password_entry, visible);
+ visible = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (self->show_password_check));
+ gtk_entry_set_visibility (self->password_entry, visible);
}
static gboolean
validate (EAPMethod *parent, GError **error)
{
- EAPMethodLEAP *method = (EAPMethodLEAP *)parent;
+ EAPMethodLEAP *self = (EAPMethodLEAP *)parent;
const char *text;
gboolean ret = TRUE;
- text = gtk_entry_get_text (method->username_entry);
+ text = gtk_entry_get_text (self->username_entry);
if (!text || !strlen (text)) {
- widget_set_error (GTK_WIDGET (method->username_entry));
+ widget_set_error (GTK_WIDGET (self->username_entry));
g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("missing EAP-LEAP username"));
ret = FALSE;
} else
- widget_unset_error (GTK_WIDGET (method->username_entry));
+ widget_unset_error (GTK_WIDGET (self->username_entry));
- text = gtk_entry_get_text (method->password_entry);
+ text = gtk_entry_get_text (self->password_entry);
if (!text || !strlen (text)) {
- widget_set_error (GTK_WIDGET (method->password_entry));
+ widget_set_error (GTK_WIDGET (self->password_entry));
if (ret) {
g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("missing EAP-LEAP
password"));
ret = FALSE;
}
} else
- widget_unset_error (GTK_WIDGET (method->password_entry));
+ widget_unset_error (GTK_WIDGET (self->password_entry));
return ret;
}
@@ -93,7 +93,7 @@ add_to_size_group (EAPMethod *parent, GtkSizeGroup *group)
static void
fill_connection (EAPMethod *parent, NMConnection *connection, NMSettingSecretFlags flags)
{
- EAPMethodLEAP *method = (EAPMethodLEAP *) parent;
+ EAPMethodLEAP *self = (EAPMethodLEAP *) parent;
NMSetting8021x *s_8021x;
NMSettingSecretFlags secret_flags;
@@ -102,17 +102,17 @@ fill_connection (EAPMethod *parent, NMConnection *connection, NMSettingSecretFla
nm_setting_802_1x_add_eap_method (s_8021x, "leap");
- g_object_set (s_8021x, NM_SETTING_802_1X_IDENTITY, gtk_entry_get_text (method->username_entry), NULL);
- g_object_set (s_8021x, NM_SETTING_802_1X_PASSWORD, gtk_entry_get_text (method->password_entry), NULL);
+ g_object_set (s_8021x, NM_SETTING_802_1X_IDENTITY, gtk_entry_get_text (self->username_entry), NULL);
+ g_object_set (s_8021x, NM_SETTING_802_1X_PASSWORD, gtk_entry_get_text (self->password_entry), NULL);
/* Save 802.1X password flags to the connection */
- secret_flags = nma_utils_menu_to_secret_flags (GTK_WIDGET (method->password_entry));
+ secret_flags = nma_utils_menu_to_secret_flags (GTK_WIDGET (self->password_entry));
nm_setting_set_secret_flags (NM_SETTING (s_8021x), parent->password_flags_name,
secret_flags, NULL);
/* Update secret flags and popup when editing the connection */
- if (method->editing_connection)
- nma_utils_update_password_storage (GTK_WIDGET (method->password_entry), secret_flags,
+ if (self->editing_connection)
+ nma_utils_update_password_storage (GTK_WIDGET (self->password_entry), secret_flags,
NM_SETTING (s_8021x), parent->password_flags_name);
}
@@ -127,48 +127,48 @@ update_secrets (EAPMethod *parent, NMConnection *connection)
}
/* Set the UI fields for user, password and show_password to the
- * values as provided by method->ws_parent. */
+ * values as provided by self->ws_parent. */
static void
-set_userpass_ui (EAPMethodLEAP *method)
+set_userpass_ui (EAPMethodLEAP *self)
{
- if (wireless_security_get_username (method->ws_parent))
- gtk_entry_set_text (method->username_entry, wireless_security_get_username
(method->ws_parent));
+ if (wireless_security_get_username (self->ws_parent))
+ gtk_entry_set_text (self->username_entry, wireless_security_get_username (self->ws_parent));
else
- gtk_entry_set_text (method->username_entry, "");
+ gtk_entry_set_text (self->username_entry, "");
- if (wireless_security_get_password (method->ws_parent) && !wireless_security_get_always_ask
(method->ws_parent))
- gtk_entry_set_text (method->password_entry, wireless_security_get_password
(method->ws_parent));
+ if (wireless_security_get_password (self->ws_parent) && !wireless_security_get_always_ask
(self->ws_parent))
+ gtk_entry_set_text (self->password_entry, wireless_security_get_password (self->ws_parent));
else
- gtk_entry_set_text (method->password_entry, "");
+ gtk_entry_set_text (self->password_entry, "");
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (method->show_password_check),
wireless_security_get_show_password (method->ws_parent));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->show_password_check),
wireless_security_get_show_password (self->ws_parent));
}
static void
-widgets_realized (EAPMethodLEAP *method)
+widgets_realized (EAPMethodLEAP *self)
{
- set_userpass_ui (method);
+ set_userpass_ui (self);
}
static void
-widgets_unrealized (EAPMethodLEAP *method)
+widgets_unrealized (EAPMethodLEAP *self)
{
- wireless_security_set_userpass (method->ws_parent,
- gtk_entry_get_text (method->username_entry),
- gtk_entry_get_text (method->password_entry),
+ wireless_security_set_userpass (self->ws_parent,
+ gtk_entry_get_text (self->username_entry),
+ gtk_entry_get_text (self->password_entry),
(gboolean) -1,
- gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
(method->show_password_check)));
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
(self->show_password_check)));
}
static void
destroy (EAPMethod *parent)
{
- EAPMethodLEAP *method = (EAPMethodLEAP *) parent;
+ EAPMethodLEAP *self = (EAPMethodLEAP *) parent;
- g_signal_handlers_disconnect_by_data (method->grid, method);
- g_signal_handlers_disconnect_by_data (method->username_entry, method->ws_parent);
- g_signal_handlers_disconnect_by_data (method->password_entry, method->ws_parent);
- g_signal_handlers_disconnect_by_data (method->show_password_check, method);
+ g_signal_handlers_disconnect_by_data (self->grid, self);
+ g_signal_handlers_disconnect_by_data (self->username_entry, self->ws_parent);
+ g_signal_handlers_disconnect_by_data (self->password_entry, self->ws_parent);
+ g_signal_handlers_disconnect_by_data (self->show_password_check, self);
}
static void
@@ -182,7 +182,7 @@ eap_method_leap_new (WirelessSecurity *ws_parent,
NMConnection *connection,
gboolean secrets_only)
{
- EAPMethodLEAP *method;
+ EAPMethodLEAP *self;
EAPMethod *parent;
NMSetting8021x *s_8021x = NULL;
@@ -200,43 +200,43 @@ eap_method_leap_new (WirelessSecurity *ws_parent,
return NULL;
parent->password_flags_name = NM_SETTING_802_1X_PASSWORD;
- method = (EAPMethodLEAP *) parent;
- method->editing_connection = secrets_only ? FALSE : TRUE;
- method->ws_parent = ws_parent;
+ self = (EAPMethodLEAP *) parent;
+ self->editing_connection = secrets_only ? FALSE : TRUE;
+ self->ws_parent = ws_parent;
- method->grid = GTK_GRID (gtk_builder_get_object (parent->builder, "grid"));
- method->password_entry = GTK_ENTRY (gtk_builder_get_object (parent->builder, "password_entry"));
- method->password_label = GTK_LABEL (gtk_builder_get_object (parent->builder, "password_label"));
- method->show_password_check = GTK_CHECK_BUTTON (gtk_builder_get_object (parent->builder,
"show_password_check"));
- method->username_entry = GTK_ENTRY (gtk_builder_get_object (parent->builder, "username_entry"));
- method->username_label = GTK_LABEL (gtk_builder_get_object (parent->builder, "username_label"));
+ self->grid = GTK_GRID (gtk_builder_get_object (parent->builder, "grid"));
+ self->password_entry = GTK_ENTRY (gtk_builder_get_object (parent->builder, "password_entry"));
+ self->password_label = GTK_LABEL (gtk_builder_get_object (parent->builder, "password_label"));
+ self->show_password_check = GTK_CHECK_BUTTON (gtk_builder_get_object (parent->builder,
"show_password_check"));
+ self->username_entry = GTK_ENTRY (gtk_builder_get_object (parent->builder, "username_entry"));
+ self->username_label = GTK_LABEL (gtk_builder_get_object (parent->builder, "username_label"));
- g_signal_connect_swapped (method->grid, "realize", G_CALLBACK (widgets_realized), method);
- g_signal_connect_swapped (method->grid, "unrealize", G_CALLBACK (widgets_unrealized), method);
+ g_signal_connect_swapped (self->grid, "realize", G_CALLBACK (widgets_realized), self);
+ g_signal_connect_swapped (self->grid, "unrealize", G_CALLBACK (widgets_unrealized), self);
- g_signal_connect_swapped (method->username_entry, "changed", G_CALLBACK (changed_cb), method);
+ g_signal_connect_swapped (self->username_entry, "changed", G_CALLBACK (changed_cb), self);
if (secrets_only)
- gtk_widget_set_sensitive (GTK_WIDGET (method->username_entry), FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (self->username_entry), FALSE);
- g_signal_connect_swapped (method->password_entry, "changed", G_CALLBACK (changed_cb), method);
+ 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 */
if (connection)
s_8021x = nm_connection_get_setting_802_1x (connection);
- nma_utils_setup_password_storage (GTK_WIDGET (method->password_entry), 0, (NMSetting *) s_8021x,
parent->password_flags_name,
+ nma_utils_setup_password_storage (GTK_WIDGET (self->password_entry), 0, (NMSetting *) s_8021x,
parent->password_flags_name,
FALSE, secrets_only);
- g_signal_connect_swapped (method->show_password_check, "toggled", G_CALLBACK (show_toggled_cb),
method);
+ g_signal_connect_swapped (self->show_password_check, "toggled", G_CALLBACK (show_toggled_cb), self);
- /* Initialize the UI fields with the security settings from method->ws_parent.
+ /* Initialize the UI fields with the security settings from self->ws_parent.
* This will be done again when the widget gets realized. It must be done here as well,
* because the outer dialog will ask to 'validate' the connection before the security tab
* is shown/realized (to enable the 'Apply' button).
* As 'validate' accesses the contents of the UI fields, they must be initialized now, even
* if the widgets are not yet visible. */
- set_userpass_ui (method);
+ set_userpass_ui (self);
- return method;
+ return self;
}
diff --git a/panels/network/wireless-security/eap-method-peap.c
b/panels/network/wireless-security/eap-method-peap.c
index a202ad3b8..125075a41 100644
--- a/panels/network/wireless-security/eap-method-peap.c
+++ b/panels/network/wireless-security/eap-method-peap.c
@@ -54,10 +54,10 @@ struct _EAPMethodPEAP {
static void
destroy (EAPMethod *parent)
{
- EAPMethodPEAP *method = (EAPMethodPEAP *) parent;
+ EAPMethodPEAP *self = (EAPMethodPEAP *) parent;
- if (method->size_group)
- g_object_unref (method->size_group);
+ if (self->size_group)
+ g_object_unref (self->size_group);
}
static gboolean
@@ -100,23 +100,23 @@ ca_cert_not_required_toggled (EAPMethodPEAP *self)
static void
add_to_size_group (EAPMethod *parent, GtkSizeGroup *group)
{
- EAPMethodPEAP *method = (EAPMethodPEAP *) parent;
+ EAPMethodPEAP *self = (EAPMethodPEAP *) parent;
GtkTreeModel *model;
GtkTreeIter iter;
g_autoptr(EAPMethod) eap = NULL;
- if (method->size_group)
- g_object_unref (method->size_group);
- method->size_group = g_object_ref (group);
+ if (self->size_group)
+ g_object_unref (self->size_group);
+ self->size_group = g_object_ref (group);
- gtk_size_group_add_widget (group, GTK_WIDGET (method->ca_cert_not_required_check));
- gtk_size_group_add_widget (group, GTK_WIDGET (method->anon_identity_label));
- gtk_size_group_add_widget (group, GTK_WIDGET (method->ca_cert_label));
- gtk_size_group_add_widget (group, GTK_WIDGET (method->version_label));
- gtk_size_group_add_widget (group, GTK_WIDGET (method->inner_auth_label));
+ gtk_size_group_add_widget (group, GTK_WIDGET (self->ca_cert_not_required_check));
+ gtk_size_group_add_widget (group, GTK_WIDGET (self->anon_identity_label));
+ gtk_size_group_add_widget (group, GTK_WIDGET (self->ca_cert_label));
+ gtk_size_group_add_widget (group, GTK_WIDGET (self->version_label));
+ gtk_size_group_add_widget (group, GTK_WIDGET (self->inner_auth_label));
- model = gtk_combo_box_get_model (method->inner_auth_combo);
- gtk_combo_box_get_active_iter (method->inner_auth_combo, &iter);
+ model = gtk_combo_box_get_model (self->inner_auth_combo);
+ gtk_combo_box_get_active_iter (self->inner_auth_combo, &iter);
gtk_tree_model_get (model, &iter, I_METHOD_COLUMN, &eap, -1);
g_assert (eap);
eap_method_add_to_size_group (eap, group);
@@ -205,7 +205,7 @@ inner_auth_combo_changed_cb (EAPMethodPEAP *self)
}
static void
-inner_auth_combo_init (EAPMethodPEAP *method,
+inner_auth_combo_init (EAPMethodPEAP *self,
NMConnection *connection,
NMSetting8021x *s_8021x,
gboolean secrets_only)
@@ -229,12 +229,12 @@ inner_auth_combo_init (EAPMethodPEAP *method,
}
simple_flags = EAP_METHOD_SIMPLE_FLAG_PHASE2;
- if (method->is_editor)
+ if (self->is_editor)
simple_flags |= EAP_METHOD_SIMPLE_FLAG_IS_EDITOR;
if (secrets_only)
simple_flags |= EAP_METHOD_SIMPLE_FLAG_SECRETS_ONLY;
- em_mschap_v2 = eap_method_simple_new (method->sec_parent,
+ em_mschap_v2 = eap_method_simple_new (self->sec_parent,
connection,
EAP_METHOD_SIMPLE_TYPE_MSCHAP_V2,
simple_flags);
@@ -248,7 +248,7 @@ inner_auth_combo_init (EAPMethodPEAP *method,
if (phase2_auth && !strcasecmp (phase2_auth, "mschapv2"))
active = 0;
- em_md5 = eap_method_simple_new (method->sec_parent,
+ em_md5 = eap_method_simple_new (self->sec_parent,
connection,
EAP_METHOD_SIMPLE_TYPE_MD5,
simple_flags);
@@ -262,7 +262,7 @@ inner_auth_combo_init (EAPMethodPEAP *method,
if (phase2_auth && !strcasecmp (phase2_auth, "md5"))
active = 1;
- em_gtc = eap_method_simple_new (method->sec_parent,
+ em_gtc = eap_method_simple_new (self->sec_parent,
connection,
EAP_METHOD_SIMPLE_TYPE_GTC,
simple_flags);
@@ -276,10 +276,10 @@ inner_auth_combo_init (EAPMethodPEAP *method,
if (phase2_auth && !strcasecmp (phase2_auth, "gtc"))
active = 2;
- gtk_combo_box_set_model (method->inner_auth_combo, GTK_TREE_MODEL (auth_model));
- gtk_combo_box_set_active (method->inner_auth_combo, active);
+ gtk_combo_box_set_model (self->inner_auth_combo, GTK_TREE_MODEL (auth_model));
+ gtk_combo_box_set_active (self->inner_auth_combo, active);
- g_signal_connect_swapped (method->inner_auth_combo, "changed", G_CALLBACK
(inner_auth_combo_changed_cb), method);
+ g_signal_connect_swapped (self->inner_auth_combo, "changed", G_CALLBACK
(inner_auth_combo_changed_cb), self);
}
static void
@@ -305,7 +305,7 @@ eap_method_peap_new (WirelessSecurity *ws_parent,
gboolean secrets_only)
{
EAPMethod *parent;
- EAPMethodPEAP *method;
+ EAPMethodPEAP *self;
GtkFileFilter *filter;
NMSetting8021x *s_8021x = NULL;
const char *filename;
@@ -324,47 +324,47 @@ eap_method_peap_new (WirelessSecurity *ws_parent,
return NULL;
parent->password_flags_name = NM_SETTING_802_1X_PASSWORD;
- method = (EAPMethodPEAP *) parent;
- method->sec_parent = ws_parent;
- method->is_editor = is_editor;
-
- method->anon_identity_entry = GTK_ENTRY (gtk_builder_get_object (parent->builder,
"anon_identity_entry"));
- method->anon_identity_label = GTK_LABEL (gtk_builder_get_object (parent->builder,
"anon_identity_label"));
- method->ca_cert_button = GTK_FILE_CHOOSER_BUTTON (gtk_builder_get_object (parent->builder,
"ca_cert_button"));
- method->ca_cert_label = GTK_LABEL (gtk_builder_get_object (parent->builder, "ca_cert_label"));
- method->ca_cert_not_required_check = GTK_CHECK_BUTTON (gtk_builder_get_object (parent->builder,
"ca_cert_not_required_check"));
- method->inner_auth_combo = GTK_COMBO_BOX (gtk_builder_get_object (parent->builder,
"inner_auth_combo"));
- method->inner_auth_label = GTK_LABEL (gtk_builder_get_object (parent->builder, "inner_auth_label"));
- method->inner_auth_box = GTK_BOX (gtk_builder_get_object (parent->builder, "inner_auth_box"));
- method->version_combo = GTK_COMBO_BOX (gtk_builder_get_object (parent->builder, "version_combo"));
- method->version_label = GTK_LABEL (gtk_builder_get_object (parent->builder, "version_label"));
+ self = (EAPMethodPEAP *) parent;
+ self->sec_parent = ws_parent;
+ self->is_editor = is_editor;
+
+ self->anon_identity_entry = GTK_ENTRY (gtk_builder_get_object (parent->builder,
"anon_identity_entry"));
+ self->anon_identity_label = GTK_LABEL (gtk_builder_get_object (parent->builder,
"anon_identity_label"));
+ self->ca_cert_button = GTK_FILE_CHOOSER_BUTTON (gtk_builder_get_object (parent->builder,
"ca_cert_button"));
+ self->ca_cert_label = GTK_LABEL (gtk_builder_get_object (parent->builder, "ca_cert_label"));
+ self->ca_cert_not_required_check = GTK_CHECK_BUTTON (gtk_builder_get_object (parent->builder,
"ca_cert_not_required_check"));
+ self->inner_auth_combo = GTK_COMBO_BOX (gtk_builder_get_object (parent->builder, "inner_auth_combo"));
+ self->inner_auth_label = GTK_LABEL (gtk_builder_get_object (parent->builder, "inner_auth_label"));
+ self->inner_auth_box = GTK_BOX (gtk_builder_get_object (parent->builder, "inner_auth_box"));
+ self->version_combo = GTK_COMBO_BOX (gtk_builder_get_object (parent->builder, "version_combo"));
+ self->version_label = GTK_LABEL (gtk_builder_get_object (parent->builder, "version_label"));
if (connection)
s_8021x = nm_connection_get_setting_802_1x (connection);
- g_signal_connect_swapped (method->ca_cert_not_required_check, "toggled", G_CALLBACK
(ca_cert_not_required_toggled), method);
+ g_signal_connect_swapped (self->ca_cert_not_required_check, "toggled", G_CALLBACK
(ca_cert_not_required_toggled), self);
- gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (method->ca_cert_button), TRUE);
- gtk_file_chooser_button_set_title (method->ca_cert_button,
+ gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (self->ca_cert_button), TRUE);
+ gtk_file_chooser_button_set_title (self->ca_cert_button,
_("Choose a Certificate Authority certificate"));
- g_signal_connect_swapped (method->ca_cert_button, "selection-changed", G_CALLBACK (changed_cb),
method);
+ g_signal_connect_swapped (self->ca_cert_button, "selection-changed", G_CALLBACK (changed_cb), self);
filter = eap_method_default_file_chooser_filter_new (FALSE);
- gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (method->ca_cert_button), filter);
+ gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (self->ca_cert_button), filter);
if (connection && s_8021x) {
filename = NULL;
if (nm_setting_802_1x_get_ca_cert_scheme (s_8021x) == NM_SETTING_802_1X_CK_SCHEME_PATH) {
filename = nm_setting_802_1x_get_ca_cert_path (s_8021x);
if (filename)
- gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (method->ca_cert_button),
filename);
+ gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (self->ca_cert_button),
filename);
}
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (method->ca_cert_not_required_check),
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->ca_cert_not_required_check),
!filename && eap_method_ca_cert_ignore_get (parent,
connection));
}
- inner_auth_combo_init (method, connection, s_8021x, secrets_only);
- inner_auth_combo_changed_cb (method);
+ inner_auth_combo_init (self, connection, s_8021x, secrets_only);
+ inner_auth_combo_changed_cb (self);
- gtk_combo_box_set_active (method->version_combo, 0);
+ gtk_combo_box_set_active (self->version_combo, 0);
if (s_8021x) {
const char *peapver;
@@ -372,29 +372,29 @@ eap_method_peap_new (WirelessSecurity *ws_parent,
if (peapver) {
/* Index 0 is "Automatic" */
if (!strcmp (peapver, "0"))
- gtk_combo_box_set_active (method->version_combo, 1);
+ gtk_combo_box_set_active (self->version_combo, 1);
else if (!strcmp (peapver, "1"))
- gtk_combo_box_set_active (method->version_combo, 2);
+ gtk_combo_box_set_active (self->version_combo, 2);
}
}
- g_signal_connect_swapped (method->version_combo, "changed", G_CALLBACK (changed_cb), method);
+ g_signal_connect_swapped (self->version_combo, "changed", G_CALLBACK (changed_cb), self);
if (s_8021x && nm_setting_802_1x_get_anonymous_identity (s_8021x))
- gtk_entry_set_text (method->anon_identity_entry, nm_setting_802_1x_get_anonymous_identity
(s_8021x));
- g_signal_connect_swapped (method->anon_identity_entry, "changed", G_CALLBACK (changed_cb), method);
+ gtk_entry_set_text (self->anon_identity_entry, nm_setting_802_1x_get_anonymous_identity
(s_8021x));
+ g_signal_connect_swapped (self->anon_identity_entry, "changed", G_CALLBACK (changed_cb), self);
if (secrets_only) {
- gtk_widget_hide (GTK_WIDGET (method->anon_identity_label));
- gtk_widget_hide (GTK_WIDGET (method->anon_identity_entry));
- gtk_widget_hide (GTK_WIDGET (method->ca_cert_label));
- gtk_widget_hide (GTK_WIDGET (method->ca_cert_button));
- gtk_widget_hide (GTK_WIDGET (method->ca_cert_not_required_check));
- gtk_widget_hide (GTK_WIDGET (method->inner_auth_label));
- gtk_widget_hide (GTK_WIDGET (method->inner_auth_combo));
- gtk_widget_hide (GTK_WIDGET (method->version_label));
- gtk_widget_hide (GTK_WIDGET (method->version_combo));
+ gtk_widget_hide (GTK_WIDGET (self->anon_identity_label));
+ gtk_widget_hide (GTK_WIDGET (self->anon_identity_entry));
+ gtk_widget_hide (GTK_WIDGET (self->ca_cert_label));
+ gtk_widget_hide (GTK_WIDGET (self->ca_cert_button));
+ gtk_widget_hide (GTK_WIDGET (self->ca_cert_not_required_check));
+ gtk_widget_hide (GTK_WIDGET (self->inner_auth_label));
+ gtk_widget_hide (GTK_WIDGET (self->inner_auth_combo));
+ gtk_widget_hide (GTK_WIDGET (self->version_label));
+ gtk_widget_hide (GTK_WIDGET (self->version_combo));
}
- return method;
+ return self;
}
diff --git a/panels/network/wireless-security/eap-method-simple.c
b/panels/network/wireless-security/eap-method-simple.c
index 8c4ca4edc..59b49a40d 100644
--- a/panels/network/wireless-security/eap-method-simple.c
+++ b/panels/network/wireless-security/eap-method-simple.c
@@ -68,31 +68,31 @@ always_ask_selected (GtkEntry *passwd_entry)
static gboolean
validate (EAPMethod *parent, GError **error)
{
- EAPMethodSimple *method = (EAPMethodSimple *)parent;
+ EAPMethodSimple *self = (EAPMethodSimple *)parent;
const char *text;
gboolean ret = TRUE;
- text = gtk_entry_get_text (method->username_entry);
+ text = gtk_entry_get_text (self->username_entry);
if (!text || !strlen (text)) {
- widget_set_error (GTK_WIDGET (method->username_entry));
+ widget_set_error (GTK_WIDGET (self->username_entry));
g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("missing EAP username"));
ret = FALSE;
} else
- widget_unset_error (GTK_WIDGET (method->username_entry));
+ widget_unset_error (GTK_WIDGET (self->username_entry));
/* Check if the password should always be requested */
- if (always_ask_selected (method->password_entry))
- widget_unset_error (GTK_WIDGET (method->password_entry));
+ if (always_ask_selected (self->password_entry))
+ widget_unset_error (GTK_WIDGET (self->password_entry));
else {
- text = gtk_entry_get_text (method->password_entry);
+ text = gtk_entry_get_text (self->password_entry);
if (!text || !strlen (text)) {
- widget_set_error (GTK_WIDGET (method->password_entry));
+ widget_set_error (GTK_WIDGET (self->password_entry));
if (ret) {
g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("missing EAP
password"));
ret = FALSE;
}
} else
- widget_unset_error (GTK_WIDGET (method->password_entry));
+ widget_unset_error (GTK_WIDGET (self->password_entry));
}
return ret;
@@ -126,7 +126,7 @@ static const EapType eap_table[EAP_METHOD_SIMPLE_TYPE_LAST] = {
static void
fill_connection (EAPMethod *parent, NMConnection *connection, NMSettingSecretFlags prev_flags)
{
- EAPMethodSimple *method = (EAPMethodSimple *) parent;
+ EAPMethodSimple *self = (EAPMethodSimple *) parent;
NMSetting8021x *s_8021x;
gboolean not_saved = FALSE;
NMSettingSecretFlags flags;
@@ -141,14 +141,14 @@ fill_connection (EAPMethod *parent, NMConnection *connection, NMSettingSecretFla
if (parent->phase2 == FALSE)
nm_setting_802_1x_clear_eap_methods (s_8021x);
- eap_type = &eap_table[method->type];
+ eap_type = &eap_table[self->type];
if (parent->phase2) {
/* If the outer EAP method (TLS, TTLS, PEAP, etc) allows inner/phase2
* EAP methods (which only TTLS allows) *and* the inner/phase2 method
* supports being an inner EAP method, then set PHASE2_AUTHEAP.
* Otherwise the inner/phase2 method goes into PHASE2_AUTH.
*/
- if ((method->flags & EAP_METHOD_SIMPLE_FLAG_AUTHEAP_ALLOWED) && eap_type->autheap_allowed) {
+ if ((self->flags & EAP_METHOD_SIMPLE_FLAG_AUTHEAP_ALLOWED) && eap_type->autheap_allowed) {
g_object_set (s_8021x, NM_SETTING_802_1X_PHASE2_AUTHEAP, eap_type->name, NULL);
g_object_set (s_8021x, NM_SETTING_802_1X_PHASE2_AUTH, NULL, NULL);
} else {
@@ -158,11 +158,11 @@ fill_connection (EAPMethod *parent, NMConnection *connection, NMSettingSecretFla
} else
nm_setting_802_1x_add_eap_method (s_8021x, eap_type->name);
- g_object_set (s_8021x, NM_SETTING_802_1X_IDENTITY, gtk_entry_get_text (method->username_entry), NULL);
+ g_object_set (s_8021x, NM_SETTING_802_1X_IDENTITY, gtk_entry_get_text (self->username_entry), NULL);
/* Save the password always ask setting */
- not_saved = always_ask_selected (method->password_entry);
- flags = nma_utils_menu_to_secret_flags (GTK_WIDGET (method->password_entry));
+ not_saved = always_ask_selected (self->password_entry);
+ flags = nma_utils_menu_to_secret_flags (GTK_WIDGET (self->password_entry));
nm_setting_set_secret_flags (NM_SETTING (s_8021x), NM_SETTING_802_1X_PASSWORD, flags, NULL);
/* Fill the connection's password if we're in the applet so that it'll get
@@ -170,12 +170,12 @@ fill_connection (EAPMethod *parent, NMConnection *connection, NMSettingSecretFla
* back to NM in response to a GetSecrets() call, we don't save it if the
* user checked "Always Ask".
*/
- if (!(method->flags & EAP_METHOD_SIMPLE_FLAG_IS_EDITOR) || not_saved == FALSE)
- g_object_set (s_8021x, NM_SETTING_802_1X_PASSWORD, gtk_entry_get_text
(method->password_entry), NULL);
+ if (!(self->flags & EAP_METHOD_SIMPLE_FLAG_IS_EDITOR) || not_saved == FALSE)
+ g_object_set (s_8021x, NM_SETTING_802_1X_PASSWORD, gtk_entry_get_text (self->password_entry),
NULL);
/* Update secret flags and popup when editing the connection */
- if (!(method->flags & EAP_METHOD_SIMPLE_FLAG_SECRETS_ONLY)) {
- nma_utils_update_password_storage (GTK_WIDGET (method->password_entry), flags,
+ if (!(self->flags & EAP_METHOD_SIMPLE_FLAG_SECRETS_ONLY)) {
+ nma_utils_update_password_storage (GTK_WIDGET (self->password_entry), flags,
NM_SETTING (s_8021x), parent->password_flags_name);
}
}
@@ -191,80 +191,80 @@ update_secrets (EAPMethod *parent, NMConnection *connection)
}
static gboolean
-stuff_changed (EAPMethodSimple *method)
+stuff_changed (EAPMethodSimple *self)
{
- wireless_security_notify_changed (method->ws_parent);
- method->idle_func_id = 0;
+ wireless_security_notify_changed (self->ws_parent);
+ self->idle_func_id = 0;
return FALSE;
}
static void
-password_storage_changed (EAPMethodSimple *method)
+password_storage_changed (EAPMethodSimple *self)
{
gboolean always_ask;
- gboolean secrets_only = method->flags & EAP_METHOD_SIMPLE_FLAG_SECRETS_ONLY;
+ gboolean secrets_only = self->flags & EAP_METHOD_SIMPLE_FLAG_SECRETS_ONLY;
- always_ask = always_ask_selected (method->password_entry);
+ always_ask = always_ask_selected (self->password_entry);
if (always_ask && !secrets_only) {
/* we always clear this button and do not restore it
* (because we want to hide the password). */
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (method->show_password_check), FALSE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->show_password_check), FALSE);
}
- gtk_widget_set_sensitive (GTK_WIDGET (method->show_password_check),
+ gtk_widget_set_sensitive (GTK_WIDGET (self->show_password_check),
!always_ask || secrets_only);
- if (!method->idle_func_id)
- method->idle_func_id = g_idle_add ((GSourceFunc) stuff_changed, method);
+ if (!self->idle_func_id)
+ self->idle_func_id = g_idle_add ((GSourceFunc) stuff_changed, self);
}
/* Set the UI fields for user, password, always_ask and show_password to the
- * values as provided by method->ws_parent. */
+ * values as provided by self->ws_parent. */
static void
-set_userpass_ui (EAPMethodSimple *method)
+set_userpass_ui (EAPMethodSimple *self)
{
- if (wireless_security_get_username (method->ws_parent))
- gtk_entry_set_text (method->username_entry, wireless_security_get_username
(method->ws_parent));
+ if (wireless_security_get_username (self->ws_parent))
+ gtk_entry_set_text (self->username_entry, wireless_security_get_username (self->ws_parent));
else
- gtk_entry_set_text (method->username_entry, "");
+ gtk_entry_set_text (self->username_entry, "");
- if (wireless_security_get_password (method->ws_parent) && !wireless_security_get_always_ask
(method->ws_parent))
- gtk_entry_set_text (method->password_entry, wireless_security_get_password
(method->ws_parent));
+ if (wireless_security_get_password (self->ws_parent) && !wireless_security_get_always_ask
(self->ws_parent))
+ gtk_entry_set_text (self->password_entry, wireless_security_get_password (self->ws_parent));
else
- gtk_entry_set_text (method->password_entry, "");
+ gtk_entry_set_text (self->password_entry, "");
- gtk_toggle_button_set_active (method->show_password_check, wireless_security_get_show_password
(method->ws_parent));
+ gtk_toggle_button_set_active (self->show_password_check, wireless_security_get_show_password
(self->ws_parent));
}
static void
-widgets_realized (EAPMethodSimple *method)
+widgets_realized (EAPMethodSimple *self)
{
- set_userpass_ui (method);
+ set_userpass_ui (self);
}
static void
-widgets_unrealized (EAPMethodSimple *method)
+widgets_unrealized (EAPMethodSimple *self)
{
- wireless_security_set_userpass (method->ws_parent,
- gtk_entry_get_text (method->username_entry),
- gtk_entry_get_text (method->password_entry),
- always_ask_selected (method->password_entry),
- gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
(method->show_password_check)));
+ wireless_security_set_userpass (self->ws_parent,
+ gtk_entry_get_text (self->username_entry),
+ gtk_entry_get_text (self->password_entry),
+ always_ask_selected (self->password_entry),
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
(self->show_password_check)));
}
static void
destroy (EAPMethod *parent)
{
- EAPMethodSimple *method = (EAPMethodSimple *) parent;
+ EAPMethodSimple *self = (EAPMethodSimple *) parent;
- g_signal_handlers_disconnect_by_data (method->grid, method);
- g_signal_handlers_disconnect_by_data (method->username_entry, method->ws_parent);
- g_signal_handlers_disconnect_by_data (method->password_entry, method->ws_parent);
- g_signal_handlers_disconnect_by_data (method->password_entry, method);
- g_signal_handlers_disconnect_by_data (method->show_password_check, method);
+ g_signal_handlers_disconnect_by_data (self->grid, self);
+ g_signal_handlers_disconnect_by_data (self->username_entry, self->ws_parent);
+ g_signal_handlers_disconnect_by_data (self->password_entry, self->ws_parent);
+ g_signal_handlers_disconnect_by_data (self->password_entry, self);
+ g_signal_handlers_disconnect_by_data (self->show_password_check, self);
- nm_clear_g_source (&method->idle_func_id);
+ nm_clear_g_source (&self->idle_func_id);
}
static void
@@ -280,7 +280,7 @@ eap_method_simple_new (WirelessSecurity *ws_parent,
EAPMethodSimpleFlags flags)
{
EAPMethod *parent;
- EAPMethodSimple *method;
+ EAPMethodSimple *self;
NMSetting8021x *s_8021x = NULL;
parent = eap_method_init (sizeof (EAPMethodSimple),
@@ -297,47 +297,47 @@ eap_method_simple_new (WirelessSecurity *ws_parent,
return NULL;
parent->password_flags_name = NM_SETTING_802_1X_PASSWORD;
- method = (EAPMethodSimple *) parent;
- method->ws_parent = ws_parent;
- method->flags = flags;
- method->type = type;
+ self = (EAPMethodSimple *) parent;
+ self->ws_parent = ws_parent;
+ self->flags = flags;
+ self->type = type;
g_assert (type < EAP_METHOD_SIMPLE_TYPE_LAST);
- method->grid = GTK_GRID (gtk_builder_get_object (parent->builder, "grid"));
- method->password_label = GTK_LABEL (gtk_builder_get_object (parent->builder, "password_label"));
- method->username_label = GTK_LABEL (gtk_builder_get_object (parent->builder, "username_label"));
- method->password_entry = GTK_ENTRY (gtk_builder_get_object (parent->builder, "password_entry"));
- method->show_password_check = GTK_TOGGLE_BUTTON (gtk_builder_get_object (parent->builder,
"show_password_check"));
- method->username_entry = GTK_ENTRY (gtk_builder_get_object (parent->builder, "username_entry"));
+ self->grid = GTK_GRID (gtk_builder_get_object (parent->builder, "grid"));
+ self->password_label = GTK_LABEL (gtk_builder_get_object (parent->builder, "password_label"));
+ self->username_label = GTK_LABEL (gtk_builder_get_object (parent->builder, "username_label"));
+ self->password_entry = GTK_ENTRY (gtk_builder_get_object (parent->builder, "password_entry"));
+ self->show_password_check = GTK_TOGGLE_BUTTON (gtk_builder_get_object (parent->builder,
"show_password_check"));
+ self->username_entry = GTK_ENTRY (gtk_builder_get_object (parent->builder, "username_entry"));
- g_signal_connect_swapped (method->grid, "realize", G_CALLBACK (widgets_realized), method);
- g_signal_connect_swapped (method->grid, "unrealize", G_CALLBACK (widgets_unrealized), method);
+ g_signal_connect_swapped (self->grid, "realize", G_CALLBACK (widgets_realized), self);
+ g_signal_connect_swapped (self->grid, "unrealize", G_CALLBACK (widgets_unrealized), self);
- g_signal_connect_swapped (method->username_entry, "changed", G_CALLBACK (changed_cb), method);
+ g_signal_connect_swapped (self->username_entry, "changed", G_CALLBACK (changed_cb), self);
- if (method->flags & EAP_METHOD_SIMPLE_FLAG_SECRETS_ONLY)
- gtk_widget_set_sensitive (GTK_WIDGET (method->username_entry), FALSE);
+ if (self->flags & EAP_METHOD_SIMPLE_FLAG_SECRETS_ONLY)
+ gtk_widget_set_sensitive (GTK_WIDGET (self->username_entry), FALSE);
- g_signal_connect_swapped (method->password_entry, "changed", G_CALLBACK (changed_cb), method);
+ 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 */
if (connection)
s_8021x = nm_connection_get_setting_802_1x (connection);
- nma_utils_setup_password_storage (GTK_WIDGET (method->password_entry), 0, (NMSetting *) s_8021x,
parent->password_flags_name,
+ nma_utils_setup_password_storage (GTK_WIDGET (self->password_entry), 0, (NMSetting *) s_8021x,
parent->password_flags_name,
FALSE, flags & EAP_METHOD_SIMPLE_FLAG_SECRETS_ONLY);
- g_signal_connect_swapped (method->password_entry, "notify::secondary-icon-name", G_CALLBACK
(password_storage_changed), method);
+ g_signal_connect_swapped (self->password_entry, "notify::secondary-icon-name", G_CALLBACK
(password_storage_changed), self);
- g_signal_connect_swapped (method->show_password_check, "toggled", G_CALLBACK (show_toggled_cb),
method);
+ g_signal_connect_swapped (self->show_password_check, "toggled", G_CALLBACK (show_toggled_cb), self);
- /* Initialize the UI fields with the security settings from method->ws_parent.
+ /* Initialize the UI fields with the security settings from self->ws_parent.
* This will be done again when the widget gets realized. It must be done here as well,
* because the outer dialog will ask to 'validate' the connection before the security tab
* is shown/realized (to enable the 'Apply' button).
* As 'validate' accesses the contents of the UI fields, they must be initialized now, even
* if the widgets are not yet visible. */
- set_userpass_ui (method);
+ set_userpass_ui (self);
- return method;
+ return self;
}
diff --git a/panels/network/wireless-security/eap-method-tls.c
b/panels/network/wireless-security/eap-method-tls.c
index 3e722b844..ffc6632b3 100644
--- a/panels/network/wireless-security/eap-method-tls.c
+++ b/panels/network/wireless-security/eap-method-tls.c
@@ -149,7 +149,7 @@ add_to_size_group (EAPMethod *parent, GtkSizeGroup *group)
static void
fill_connection (EAPMethod *parent, NMConnection *connection, NMSettingSecretFlags flags)
{
- EAPMethodTLS *method = (EAPMethodTLS *) parent;
+ EAPMethodTLS *self = (EAPMethodTLS *) parent;
NMSetting8021xCKFormat format = NM_SETTING_802_1X_CK_FORMAT_UNKNOWN;
NMSetting8021x *s_8021x;
NMSettingSecretFlags secret_flags;
@@ -166,12 +166,12 @@ fill_connection (EAPMethod *parent, NMConnection *connection, NMSettingSecretFla
else
nm_setting_802_1x_add_eap_method (s_8021x, "tls");
- g_object_set (s_8021x, NM_SETTING_802_1X_IDENTITY, gtk_entry_get_text (method->identity_entry), NULL);
+ g_object_set (s_8021x, NM_SETTING_802_1X_IDENTITY, gtk_entry_get_text (self->identity_entry), NULL);
/* TLS private key */
- password = gtk_entry_get_text (method->private_key_password_entry);
+ password = gtk_entry_get_text (self->private_key_password_entry);
- pk_filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (method->private_key_button));
+ pk_filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (self->private_key_button));
g_assert (pk_filename);
if (parent->phase2) {
@@ -185,13 +185,13 @@ fill_connection (EAPMethod *parent, NMConnection *connection, NMSettingSecretFla
}
/* Save 802.1X password flags to the connection */
- secret_flags = nma_utils_menu_to_secret_flags (GTK_WIDGET (method->private_key_password_entry));
+ secret_flags = nma_utils_menu_to_secret_flags (GTK_WIDGET (self->private_key_password_entry));
nm_setting_set_secret_flags (NM_SETTING (s_8021x), parent->password_flags_name,
secret_flags, NULL);
/* Update secret flags and popup when editing the connection */
- if (method->editing_connection) {
- nma_utils_update_password_storage (GTK_WIDGET (method->private_key_password_entry),
secret_flags,
+ if (self->editing_connection) {
+ nma_utils_update_password_storage (GTK_WIDGET (self->private_key_password_entry),
secret_flags,
NM_SETTING (s_8021x), parent->password_flags_name);
}
@@ -202,7 +202,7 @@ fill_connection (EAPMethod *parent, NMConnection *connection, NMSettingSecretFla
/* If the key is pkcs#12 nm_setting_802_1x_set_private_key() already
* set the client certificate for us.
*/
- cc_filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (method->user_cert_button));
+ cc_filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (self->user_cert_button));
g_assert (cc_filename);
format = NM_SETTING_802_1X_CK_FORMAT_UNKNOWN;
@@ -218,7 +218,7 @@ fill_connection (EAPMethod *parent, NMConnection *connection, NMSettingSecretFla
}
/* TLS CA certificate */
- ca_filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (method->ca_cert_button));
+ ca_filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (self->ca_cert_button));
format = NM_SETTING_802_1X_CK_FORMAT_UNKNOWN;
if (parent->phase2) {
@@ -400,7 +400,7 @@ eap_method_tls_new (WirelessSecurity *ws_parent,
gboolean phase2,
gboolean secrets_only)
{
- EAPMethodTLS *method;
+ EAPMethodTLS *self;
EAPMethod *parent;
NMSetting8021x *s_8021x = NULL;
gboolean ca_not_required = FALSE;
@@ -421,45 +421,45 @@ eap_method_tls_new (WirelessSecurity *ws_parent,
parent->password_flags_name = phase2 ?
NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD :
NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD;
- method = (EAPMethodTLS *) parent;
- method->sec_parent = ws_parent;
- method->editing_connection = secrets_only ? FALSE : TRUE;
-
- method->ca_cert_button = GTK_FILE_CHOOSER_BUTTON (gtk_builder_get_object (parent->builder,
"ca_cert_button"));
- method->ca_cert_label = GTK_LABEL (gtk_builder_get_object (parent->builder, "ca_cert_label"));
- method->ca_cert_not_required_check = GTK_CHECK_BUTTON (gtk_builder_get_object (parent->builder,
"ca_cert_not_required_check"));
- method->identity_entry = GTK_ENTRY (gtk_builder_get_object (parent->builder, "identity_entry"));
- method->identity_label = GTK_LABEL (gtk_builder_get_object (parent->builder, "identity_label"));
- method->private_key_button = GTK_FILE_CHOOSER_BUTTON (gtk_builder_get_object (parent->builder,
"private_key_button"));
- method->private_key_label = GTK_LABEL (gtk_builder_get_object (parent->builder, "private_key_label"));
- method->private_key_password_entry = GTK_ENTRY (gtk_builder_get_object (parent->builder,
"private_key_password_entry"));
- method->private_key_password_label = GTK_LABEL (gtk_builder_get_object (parent->builder,
"private_key_password_label"));
- method->show_password_check = GTK_CHECK_BUTTON (gtk_builder_get_object (parent->builder,
"show_password_check"));
- method->user_cert_button = GTK_FILE_CHOOSER_BUTTON (gtk_builder_get_object (parent->builder,
"user_cert_button"));
- method->user_cert_label = GTK_LABEL (gtk_builder_get_object (parent->builder, "user_cert_label"));
+ self = (EAPMethodTLS *) parent;
+ self->sec_parent = ws_parent;
+ self->editing_connection = secrets_only ? FALSE : TRUE;
+
+ self->ca_cert_button = GTK_FILE_CHOOSER_BUTTON (gtk_builder_get_object (parent->builder,
"ca_cert_button"));
+ self->ca_cert_label = GTK_LABEL (gtk_builder_get_object (parent->builder, "ca_cert_label"));
+ self->ca_cert_not_required_check = GTK_CHECK_BUTTON (gtk_builder_get_object (parent->builder,
"ca_cert_not_required_check"));
+ self->identity_entry = GTK_ENTRY (gtk_builder_get_object (parent->builder, "identity_entry"));
+ self->identity_label = GTK_LABEL (gtk_builder_get_object (parent->builder, "identity_label"));
+ self->private_key_button = GTK_FILE_CHOOSER_BUTTON (gtk_builder_get_object (parent->builder,
"private_key_button"));
+ self->private_key_label = GTK_LABEL (gtk_builder_get_object (parent->builder, "private_key_label"));
+ self->private_key_password_entry = GTK_ENTRY (gtk_builder_get_object (parent->builder,
"private_key_password_entry"));
+ self->private_key_password_label = GTK_LABEL (gtk_builder_get_object (parent->builder,
"private_key_password_label"));
+ self->show_password_check = GTK_CHECK_BUTTON (gtk_builder_get_object (parent->builder,
"show_password_check"));
+ self->user_cert_button = GTK_FILE_CHOOSER_BUTTON (gtk_builder_get_object (parent->builder,
"user_cert_button"));
+ self->user_cert_label = GTK_LABEL (gtk_builder_get_object (parent->builder, "user_cert_label"));
if (connection)
s_8021x = nm_connection_get_setting_802_1x (connection);
- g_signal_connect_swapped (method->ca_cert_not_required_check, "toggled", G_CALLBACK
(ca_cert_not_required_toggled), method);
+ g_signal_connect_swapped (self->ca_cert_not_required_check, "toggled", G_CALLBACK
(ca_cert_not_required_toggled), self);
- g_signal_connect_swapped (method->identity_entry, "changed", G_CALLBACK (changed_cb), method);
+ g_signal_connect_swapped (self->identity_entry, "changed", G_CALLBACK (changed_cb), self);
if (s_8021x && nm_setting_802_1x_get_identity (s_8021x))
- gtk_entry_set_text (method->identity_entry, nm_setting_802_1x_get_identity (s_8021x));
+ gtk_entry_set_text (self->identity_entry, nm_setting_802_1x_get_identity (s_8021x));
- setup_filepicker (method->user_cert_button,
+ setup_filepicker (self->user_cert_button,
_("Choose your personal certificate"),
ws_parent, parent, s_8021x,
phase2 ? nm_setting_802_1x_get_phase2_client_cert_scheme :
nm_setting_802_1x_get_client_cert_scheme,
phase2 ? nm_setting_802_1x_get_phase2_client_cert_path :
nm_setting_802_1x_get_client_cert_path,
FALSE, TRUE);
- setup_filepicker (method->ca_cert_button,
+ setup_filepicker (self->ca_cert_button,
_("Choose a Certificate Authority certificate"),
ws_parent, parent, s_8021x,
phase2 ? nm_setting_802_1x_get_phase2_ca_cert_scheme :
nm_setting_802_1x_get_ca_cert_scheme,
phase2 ? nm_setting_802_1x_get_phase2_ca_cert_path :
nm_setting_802_1x_get_ca_cert_path,
FALSE, FALSE);
- setup_filepicker (method->private_key_button,
+ setup_filepicker (self->private_key_button,
_("Choose your private key"),
ws_parent, parent, s_8021x,
phase2 ? nm_setting_802_1x_get_phase2_private_key_scheme :
nm_setting_802_1x_get_private_key_scheme,
@@ -467,32 +467,32 @@ eap_method_tls_new (WirelessSecurity *ws_parent,
TRUE, FALSE);
if (connection && eap_method_ca_cert_ignore_get (parent, connection))
- ca_not_required = !gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (method->ca_cert_button));
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (method->ca_cert_not_required_check),
ca_not_required);
+ ca_not_required = !gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (self->ca_cert_button));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->ca_cert_not_required_check), ca_not_required);
/* Fill secrets, if any */
if (connection)
update_secrets (parent, connection);
- g_signal_connect_swapped (method->private_key_password_entry, "changed", G_CALLBACK (changed_cb),
method);
+ g_signal_connect_swapped (self->private_key_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 (method->private_key_password_entry), 0, (NMSetting *)
s_8021x, parent->password_flags_name,
+ nma_utils_setup_password_storage (GTK_WIDGET (self->private_key_password_entry), 0, (NMSetting *)
s_8021x, parent->password_flags_name,
FALSE, secrets_only);
- g_signal_connect_swapped (method->show_password_check, "toggled", G_CALLBACK (show_toggled_cb),
method);
+ g_signal_connect_swapped (self->show_password_check, "toggled", G_CALLBACK (show_toggled_cb), self);
if (secrets_only) {
- gtk_widget_set_sensitive (GTK_WIDGET (method->identity_entry), FALSE);
- gtk_widget_hide (GTK_WIDGET (method->user_cert_label));
- gtk_widget_hide (GTK_WIDGET (method->user_cert_button));
- gtk_widget_hide (GTK_WIDGET (method->private_key_label));
- gtk_widget_hide (GTK_WIDGET (method->private_key_button));
- gtk_widget_hide (GTK_WIDGET (method->ca_cert_label));
- gtk_widget_hide (GTK_WIDGET (method->ca_cert_button));
- gtk_widget_hide (GTK_WIDGET (method->ca_cert_not_required_check));
+ gtk_widget_set_sensitive (GTK_WIDGET (self->identity_entry), FALSE);
+ gtk_widget_hide (GTK_WIDGET (self->user_cert_label));
+ gtk_widget_hide (GTK_WIDGET (self->user_cert_button));
+ gtk_widget_hide (GTK_WIDGET (self->private_key_label));
+ gtk_widget_hide (GTK_WIDGET (self->private_key_button));
+ gtk_widget_hide (GTK_WIDGET (self->ca_cert_label));
+ gtk_widget_hide (GTK_WIDGET (self->ca_cert_button));
+ gtk_widget_hide (GTK_WIDGET (self->ca_cert_not_required_check));
}
- return method;
+ return self;
}
diff --git a/panels/network/wireless-security/eap-method-ttls.c
b/panels/network/wireless-security/eap-method-ttls.c
index c5ce84378..e013dd96c 100644
--- a/panels/network/wireless-security/eap-method-ttls.c
+++ b/panels/network/wireless-security/eap-method-ttls.c
@@ -54,10 +54,10 @@ struct _EAPMethodTTLS {
static void
destroy (EAPMethod *parent)
{
- EAPMethodTTLS *method = (EAPMethodTTLS *) parent;
+ EAPMethodTTLS *self = (EAPMethodTTLS *) parent;
- if (method->size_group)
- g_object_unref (method->size_group);
+ if (self->size_group)
+ g_object_unref (self->size_group);
}
static gboolean
@@ -100,23 +100,23 @@ ca_cert_not_required_toggled (EAPMethodTTLS *self)
static void
add_to_size_group (EAPMethod *parent, GtkSizeGroup *group)
{
- EAPMethodTTLS *method = (EAPMethodTTLS *) parent;
+ EAPMethodTTLS *self = (EAPMethodTTLS *) parent;
GtkTreeModel *model;
GtkTreeIter iter;
g_autoptr(EAPMethod) eap = NULL;
- if (method->size_group)
- g_object_unref (method->size_group);
- method->size_group = g_object_ref (group);
+ if (self->size_group)
+ g_object_unref (self->size_group);
+ self->size_group = g_object_ref (group);
- gtk_size_group_add_widget (group, GTK_WIDGET (method->ca_cert_not_required_check));
- gtk_size_group_add_widget (group, GTK_WIDGET (method->anon_identity_label));
- gtk_size_group_add_widget (group, GTK_WIDGET (method->domain_match_label));
- gtk_size_group_add_widget (group, GTK_WIDGET (method->ca_cert_label));
- gtk_size_group_add_widget (group, GTK_WIDGET (method->inner_auth_label));
+ gtk_size_group_add_widget (group, GTK_WIDGET (self->ca_cert_not_required_check));
+ gtk_size_group_add_widget (group, GTK_WIDGET (self->anon_identity_label));
+ gtk_size_group_add_widget (group, GTK_WIDGET (self->domain_match_label));
+ gtk_size_group_add_widget (group, GTK_WIDGET (self->ca_cert_label));
+ gtk_size_group_add_widget (group, GTK_WIDGET (self->inner_auth_label));
- model = gtk_combo_box_get_model (method->inner_auth_combo);
- gtk_combo_box_get_active_iter (method->inner_auth_combo, &iter);
+ model = gtk_combo_box_get_model (self->inner_auth_combo);
+ gtk_combo_box_get_active_iter (self->inner_auth_combo, &iter);
gtk_tree_model_get (model, &iter, I_METHOD_COLUMN, &eap, -1);
g_assert (eap);
eap_method_add_to_size_group (eap, group);
@@ -196,7 +196,7 @@ inner_auth_combo_changed_cb (EAPMethodTTLS *self)
}
static void
-inner_auth_combo_init (EAPMethodTTLS *method,
+inner_auth_combo_init (EAPMethodTTLS *self,
NMConnection *connection,
NMSetting8021x *s_8021x,
gboolean secrets_only)
@@ -224,12 +224,12 @@ inner_auth_combo_init (EAPMethodTTLS *method,
}
simple_flags = EAP_METHOD_SIMPLE_FLAG_PHASE2 | EAP_METHOD_SIMPLE_FLAG_AUTHEAP_ALLOWED;
- if (method->is_editor)
+ if (self->is_editor)
simple_flags |= EAP_METHOD_SIMPLE_FLAG_IS_EDITOR;
if (secrets_only)
simple_flags |= EAP_METHOD_SIMPLE_FLAG_SECRETS_ONLY;
- em_pap = eap_method_simple_new (method->sec_parent,
+ em_pap = eap_method_simple_new (self->sec_parent,
connection,
EAP_METHOD_SIMPLE_TYPE_PAP,
simple_flags);
@@ -243,7 +243,7 @@ inner_auth_combo_init (EAPMethodTTLS *method,
if (phase2_auth && !strcasecmp (phase2_auth, "pap"))
active = 0;
- em_mschap = eap_method_simple_new (method->sec_parent,
+ em_mschap = eap_method_simple_new (self->sec_parent,
connection,
EAP_METHOD_SIMPLE_TYPE_MSCHAP,
simple_flags);
@@ -257,7 +257,7 @@ inner_auth_combo_init (EAPMethodTTLS *method,
if (phase2_auth && !strcasecmp (phase2_auth, "mschap"))
active = 1;
- em_mschap_v2 = eap_method_simple_new (method->sec_parent,
+ em_mschap_v2 = eap_method_simple_new (self->sec_parent,
connection,
EAP_METHOD_SIMPLE_TYPE_MSCHAP_V2,
simple_flags);
@@ -272,7 +272,7 @@ inner_auth_combo_init (EAPMethodTTLS *method,
nm_setting_802_1x_get_phase2_autheap (s_8021x) != NULL)
active = 2;
- em_plain_mschap_v2 = eap_method_simple_new (method->sec_parent,
+ em_plain_mschap_v2 = eap_method_simple_new (self->sec_parent,
connection,
EAP_METHOD_SIMPLE_TYPE_PLAIN_MSCHAP_V2,
simple_flags);
@@ -287,7 +287,7 @@ inner_auth_combo_init (EAPMethodTTLS *method,
nm_setting_802_1x_get_phase2_auth (s_8021x) != NULL)
active = 3;
- em_chap = eap_method_simple_new (method->sec_parent,
+ em_chap = eap_method_simple_new (self->sec_parent,
connection,
EAP_METHOD_SIMPLE_TYPE_CHAP,
simple_flags);
@@ -301,7 +301,7 @@ inner_auth_combo_init (EAPMethodTTLS *method,
if (phase2_auth && !strcasecmp (phase2_auth, "chap"))
active = 4;
- em_md5 = eap_method_simple_new (method->sec_parent,
+ em_md5 = eap_method_simple_new (self->sec_parent,
connection,
EAP_METHOD_SIMPLE_TYPE_MD5,
simple_flags);
@@ -315,7 +315,7 @@ inner_auth_combo_init (EAPMethodTTLS *method,
if (phase2_auth && !strcasecmp (phase2_auth, "md5"))
active = 5;
- em_gtc = eap_method_simple_new (method->sec_parent,
+ em_gtc = eap_method_simple_new (self->sec_parent,
connection,
EAP_METHOD_SIMPLE_TYPE_GTC,
simple_flags);
@@ -329,10 +329,10 @@ inner_auth_combo_init (EAPMethodTTLS *method,
if (phase2_auth && !strcasecmp (phase2_auth, "gtc"))
active = 6;
- gtk_combo_box_set_model (method->inner_auth_combo, GTK_TREE_MODEL (auth_model));
- gtk_combo_box_set_active (method->inner_auth_combo, active);
+ gtk_combo_box_set_model (self->inner_auth_combo, GTK_TREE_MODEL (auth_model));
+ gtk_combo_box_set_active (self->inner_auth_combo, active);
- g_signal_connect_swapped (method->inner_auth_combo, "changed", G_CALLBACK
(inner_auth_combo_changed_cb), method);
+ g_signal_connect_swapped (self->inner_auth_combo, "changed", G_CALLBACK
(inner_auth_combo_changed_cb), self);
}
static void
@@ -358,7 +358,7 @@ eap_method_ttls_new (WirelessSecurity *ws_parent,
gboolean secrets_only)
{
EAPMethod *parent;
- EAPMethodTTLS *method;
+ EAPMethodTTLS *self;
GtkFileFilter *filter;
NMSetting8021x *s_8021x = NULL;
const char *filename;
@@ -377,65 +377,65 @@ eap_method_ttls_new (WirelessSecurity *ws_parent,
return NULL;
parent->password_flags_name = NM_SETTING_802_1X_PASSWORD;
- method = (EAPMethodTTLS *) parent;
- method->sec_parent = ws_parent;
- method->is_editor = is_editor;
-
- method->anon_identity_entry = GTK_ENTRY (gtk_builder_get_object (parent->builder,
"anon_identity_entry"));
- method->anon_identity_label = GTK_LABEL (gtk_builder_get_object (parent->builder,
"anon_identity_label"));
- method->ca_cert_button = GTK_FILE_CHOOSER_BUTTON (gtk_builder_get_object (parent->builder,
"ca_cert_button"));
- method->ca_cert_label = GTK_LABEL (gtk_builder_get_object (parent->builder, "ca_cert_label"));
- method->ca_cert_not_required_check = GTK_CHECK_BUTTON (gtk_builder_get_object (parent->builder,
"ca_cert_not_required_check"));
- method->domain_match_entry = GTK_ENTRY (gtk_builder_get_object (parent->builder,
"domain_match_entry"));
- method->domain_match_label = GTK_LABEL (gtk_builder_get_object (parent->builder,
"domain_match_label"));
- method->inner_auth_combo = GTK_COMBO_BOX (gtk_builder_get_object (parent->builder,
"inner_auth_combo"));
- method->inner_auth_label = GTK_LABEL (gtk_builder_get_object (parent->builder, "inner_auth_label"));
- method->inner_auth_box = GTK_BOX (gtk_builder_get_object (parent->builder, "inner_auth_box"));
+ self = (EAPMethodTTLS *) parent;
+ self->sec_parent = ws_parent;
+ self->is_editor = is_editor;
+
+ self->anon_identity_entry = GTK_ENTRY (gtk_builder_get_object (parent->builder,
"anon_identity_entry"));
+ self->anon_identity_label = GTK_LABEL (gtk_builder_get_object (parent->builder,
"anon_identity_label"));
+ self->ca_cert_button = GTK_FILE_CHOOSER_BUTTON (gtk_builder_get_object (parent->builder,
"ca_cert_button"));
+ self->ca_cert_label = GTK_LABEL (gtk_builder_get_object (parent->builder, "ca_cert_label"));
+ self->ca_cert_not_required_check = GTK_CHECK_BUTTON (gtk_builder_get_object (parent->builder,
"ca_cert_not_required_check"));
+ self->domain_match_entry = GTK_ENTRY (gtk_builder_get_object (parent->builder, "domain_match_entry"));
+ self->domain_match_label = GTK_LABEL (gtk_builder_get_object (parent->builder, "domain_match_label"));
+ self->inner_auth_combo = GTK_COMBO_BOX (gtk_builder_get_object (parent->builder, "inner_auth_combo"));
+ self->inner_auth_label = GTK_LABEL (gtk_builder_get_object (parent->builder, "inner_auth_label"));
+ self->inner_auth_box = GTK_BOX (gtk_builder_get_object (parent->builder, "inner_auth_box"));
if (connection)
s_8021x = nm_connection_get_setting_802_1x (connection);
- g_signal_connect_swapped (method->ca_cert_not_required_check, "toggled", G_CALLBACK
(ca_cert_not_required_toggled), method);
+ g_signal_connect_swapped (self->ca_cert_not_required_check, "toggled", G_CALLBACK
(ca_cert_not_required_toggled), self);
- gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (method->ca_cert_button), TRUE);
- gtk_file_chooser_button_set_title (method->ca_cert_button,
+ gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER (self->ca_cert_button), TRUE);
+ gtk_file_chooser_button_set_title (self->ca_cert_button,
_("Choose a Certificate Authority certificate"));
- g_signal_connect_swapped (method->ca_cert_button, "selection-changed", G_CALLBACK (changed_cb),
method);
+ g_signal_connect_swapped (self->ca_cert_button, "selection-changed", G_CALLBACK (changed_cb), self);
filter = eap_method_default_file_chooser_filter_new (FALSE);
- gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (method->ca_cert_button), filter);
+ gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (self->ca_cert_button), filter);
if (connection && s_8021x) {
filename = NULL;
if (nm_setting_802_1x_get_ca_cert_scheme (s_8021x) == NM_SETTING_802_1X_CK_SCHEME_PATH) {
filename = nm_setting_802_1x_get_ca_cert_path (s_8021x);
if (filename)
- gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (method->ca_cert_button),
filename);
+ gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (self->ca_cert_button),
filename);
}
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (method->ca_cert_not_required_check),
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (self->ca_cert_not_required_check),
!filename && eap_method_ca_cert_ignore_get (parent,
connection));
}
if (s_8021x && nm_setting_802_1x_get_anonymous_identity (s_8021x))
- gtk_entry_set_text (method->anon_identity_entry, nm_setting_802_1x_get_anonymous_identity
(s_8021x));
- g_signal_connect_swapped (method->anon_identity_entry, "changed", G_CALLBACK (changed_cb), method);
+ gtk_entry_set_text (self->anon_identity_entry, nm_setting_802_1x_get_anonymous_identity
(s_8021x));
+ g_signal_connect_swapped (self->anon_identity_entry, "changed", G_CALLBACK (changed_cb), self);
if (s_8021x && nm_setting_802_1x_get_domain_suffix_match (s_8021x))
- gtk_entry_set_text (method->domain_match_entry, nm_setting_802_1x_get_domain_suffix_match
(s_8021x));
- g_signal_connect_swapped (method->domain_match_entry, "changed", G_CALLBACK (changed_cb), method);
+ gtk_entry_set_text (self->domain_match_entry, nm_setting_802_1x_get_domain_suffix_match
(s_8021x));
+ g_signal_connect_swapped (self->domain_match_entry, "changed", G_CALLBACK (changed_cb), self);
- inner_auth_combo_init (method, connection, s_8021x, secrets_only);
- inner_auth_combo_changed_cb (method);
+ inner_auth_combo_init (self, connection, s_8021x, secrets_only);
+ inner_auth_combo_changed_cb (self);
if (secrets_only) {
- gtk_widget_hide (GTK_WIDGET (method->anon_identity_label));
- gtk_widget_hide (GTK_WIDGET (method->anon_identity_entry));
- gtk_widget_hide (GTK_WIDGET (method->domain_match_label));
- gtk_widget_hide (GTK_WIDGET (method->domain_match_entry));
- gtk_widget_hide (GTK_WIDGET (method->ca_cert_label));
- gtk_widget_hide (GTK_WIDGET (method->ca_cert_button));
- gtk_widget_hide (GTK_WIDGET (method->ca_cert_not_required_check));
- gtk_widget_hide (GTK_WIDGET (method->inner_auth_label));
- gtk_widget_hide (GTK_WIDGET (method->inner_auth_combo));
+ gtk_widget_hide (GTK_WIDGET (self->anon_identity_label));
+ gtk_widget_hide (GTK_WIDGET (self->anon_identity_entry));
+ gtk_widget_hide (GTK_WIDGET (self->domain_match_label));
+ gtk_widget_hide (GTK_WIDGET (self->domain_match_entry));
+ gtk_widget_hide (GTK_WIDGET (self->ca_cert_label));
+ gtk_widget_hide (GTK_WIDGET (self->ca_cert_button));
+ gtk_widget_hide (GTK_WIDGET (self->ca_cert_not_required_check));
+ gtk_widget_hide (GTK_WIDGET (self->inner_auth_label));
+ gtk_widget_hide (GTK_WIDGET (self->inner_auth_combo));
}
- return method;
+ return self;
}
diff --git a/panels/network/wireless-security/eap-method.c b/panels/network/wireless-security/eap-method.c
index 485bb25a9..76c853b3d 100644
--- a/panels/network/wireless-security/eap-method.c
+++ b/panels/network/wireless-security/eap-method.c
@@ -48,61 +48,61 @@ eap_method_get_type (void)
}
GtkWidget *
-eap_method_get_widget (EAPMethod *method)
+eap_method_get_widget (EAPMethod *self)
{
- g_return_val_if_fail (method != NULL, NULL);
+ g_return_val_if_fail (self != NULL, NULL);
- return method->ui_widget;
+ return self->ui_widget;
}
gboolean
-eap_method_validate (EAPMethod *method, GError **error)
+eap_method_validate (EAPMethod *self, GError **error)
{
gboolean result;
- g_return_val_if_fail (method != NULL, FALSE);
+ g_return_val_if_fail (self != NULL, FALSE);
- g_assert (method->validate);
- result = (*(method->validate)) (method, error);
+ g_assert (self->validate);
+ result = (*(self->validate)) (self, error);
if (!result && error && !*error)
g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("undefined error in 802.1X
security (wpa-eap)"));
return result;
}
void
-eap_method_add_to_size_group (EAPMethod *method, GtkSizeGroup *group)
+eap_method_add_to_size_group (EAPMethod *self, GtkSizeGroup *group)
{
- g_return_if_fail (method != NULL);
+ g_return_if_fail (self != NULL);
g_return_if_fail (group != NULL);
- g_assert (method->add_to_size_group);
- return (*(method->add_to_size_group)) (method, group);
+ g_assert (self->add_to_size_group);
+ return (*(self->add_to_size_group)) (self, group);
}
void
-eap_method_fill_connection (EAPMethod *method,
+eap_method_fill_connection (EAPMethod *self,
NMConnection *connection,
NMSettingSecretFlags flags)
{
- g_return_if_fail (method != NULL);
+ g_return_if_fail (self != NULL);
g_return_if_fail (connection != NULL);
- g_assert (method->fill_connection);
- return (*(method->fill_connection)) (method, connection, flags);
+ g_assert (self->fill_connection);
+ return (*(self->fill_connection)) (self, connection, flags);
}
void
-eap_method_update_secrets (EAPMethod *method, NMConnection *connection)
+eap_method_update_secrets (EAPMethod *self, NMConnection *connection)
{
- g_return_if_fail (method != NULL);
+ g_return_if_fail (self != NULL);
g_return_if_fail (connection != NULL);
- if (method->update_secrets)
- method->update_secrets (method, connection);
+ if (self->update_secrets)
+ self->update_secrets (self, connection);
}
void
-eap_method_phase2_update_secrets_helper (EAPMethod *method,
+eap_method_phase2_update_secrets_helper (EAPMethod *self,
NMConnection *connection,
GtkComboBox *combo,
guint32 column)
@@ -110,7 +110,7 @@ eap_method_phase2_update_secrets_helper (EAPMethod *method,
GtkTreeIter iter;
GtkTreeModel *model;
- g_return_if_fail (method != NULL);
+ g_return_if_fail (self != NULL);
g_return_if_fail (connection != NULL);
g_return_if_fail (combo != NULL);
@@ -139,73 +139,73 @@ eap_method_init (gsize obj_size,
const char *default_field,
gboolean phase2)
{
- g_autoptr(EAPMethod) method = NULL;
+ g_autoptr(EAPMethod) self = NULL;
g_autoptr(GError) error = NULL;
g_return_val_if_fail (obj_size > 0, NULL);
g_return_val_if_fail (ui_resource != NULL, NULL);
g_return_val_if_fail (ui_widget_name != NULL, NULL);
- method = g_slice_alloc0 (obj_size);
- g_assert (method);
+ self = g_slice_alloc0 (obj_size);
+ g_assert (self);
- method->refcount = 1;
- method->obj_size = obj_size;
- method->validate = validate;
- method->add_to_size_group = add_to_size_group;
- method->fill_connection = fill_connection;
- method->update_secrets = update_secrets;
- method->default_field = default_field;
- method->phase2 = phase2;
+ self->refcount = 1;
+ self->obj_size = obj_size;
+ self->validate = validate;
+ self->add_to_size_group = add_to_size_group;
+ self->fill_connection = fill_connection;
+ self->update_secrets = update_secrets;
+ self->default_field = default_field;
+ self->phase2 = phase2;
- method->builder = gtk_builder_new ();
- if (!gtk_builder_add_from_resource (method->builder, ui_resource, &error)) {
+ self->builder = gtk_builder_new ();
+ if (!gtk_builder_add_from_resource (self->builder, ui_resource, &error)) {
g_warning ("Couldn't load UI builder resource %s: %s",
ui_resource, error->message);
return NULL;
}
- method->ui_widget = GTK_WIDGET (gtk_builder_get_object (method->builder, ui_widget_name));
- if (!method->ui_widget) {
+ self->ui_widget = GTK_WIDGET (gtk_builder_get_object (self->builder, ui_widget_name));
+ if (!self->ui_widget) {
g_warning ("Couldn't load UI widget '%s' from UI file %s",
ui_widget_name, ui_resource);
return NULL;
}
- g_object_ref_sink (method->ui_widget);
+ g_object_ref_sink (self->ui_widget);
- method->destroy = destroy;
+ self->destroy = destroy;
- return g_steal_pointer (&method);
+ return g_steal_pointer (&self);
}
EAPMethod *
-eap_method_ref (EAPMethod *method)
+eap_method_ref (EAPMethod *self)
{
- g_return_val_if_fail (method != NULL, NULL);
- g_return_val_if_fail (method->refcount > 0, NULL);
+ g_return_val_if_fail (self != NULL, NULL);
+ g_return_val_if_fail (self->refcount > 0, NULL);
- method->refcount++;
- return method;
+ self->refcount++;
+ return self;
}
void
-eap_method_unref (EAPMethod *method)
+eap_method_unref (EAPMethod *self)
{
- g_return_if_fail (method != NULL);
- g_return_if_fail (method->refcount > 0);
+ g_return_if_fail (self != NULL);
+ g_return_if_fail (self->refcount > 0);
- method->refcount--;
- if (method->refcount == 0) {
- if (method->destroy)
- method->destroy (method);
+ self->refcount--;
+ if (self->refcount == 0) {
+ if (self->destroy)
+ self->destroy (self);
- if (method->builder)
- g_object_unref (method->builder);
- if (method->ui_widget)
- g_object_unref (method->ui_widget);
+ if (self->builder)
+ g_object_unref (self->builder);
+ if (self->ui_widget)
+ g_object_unref (self->ui_widget);
- g_slice_free1 (method->obj_size, method);
+ g_slice_free1 (self->obj_size, self);
}
}
@@ -529,7 +529,7 @@ eap_method_ca_cert_not_required_toggled (GtkToggleButton *id_ca_cert_not_require
* ignore the CA cert)..
*/
void
-eap_method_ca_cert_ignore_set (EAPMethod *method,
+eap_method_ca_cert_ignore_set (EAPMethod *self,
NMConnection *connection,
const char *filename,
gboolean ca_cert_error)
@@ -541,7 +541,7 @@ eap_method_ca_cert_ignore_set (EAPMethod *method,
if (s_8021x) {
ignore = !ca_cert_error && filename == NULL;
g_object_set_data (G_OBJECT (s_8021x),
- method->phase2 ? IGNORE_PHASE2_CA_CERT_TAG : IGNORE_CA_CERT_TAG,
+ self->phase2 ? IGNORE_PHASE2_CA_CERT_TAG : IGNORE_CA_CERT_TAG,
GUINT_TO_POINTER (ignore));
}
}
@@ -555,14 +555,14 @@ eap_method_ca_cert_ignore_set (EAPMethod *method,
* certificate should be required for the connection to be valid.
*/
gboolean
-eap_method_ca_cert_ignore_get (EAPMethod *method, NMConnection *connection)
+eap_method_ca_cert_ignore_get (EAPMethod *self, NMConnection *connection)
{
NMSetting8021x *s_8021x;
s_8021x = nm_connection_get_setting_802_1x (connection);
if (s_8021x) {
return !!g_object_get_data (G_OBJECT (s_8021x),
- method->phase2 ? IGNORE_PHASE2_CA_CERT_TAG : IGNORE_CA_CERT_TAG);
+ self->phase2 ? IGNORE_PHASE2_CA_CERT_TAG : IGNORE_CA_CERT_TAG);
}
return FALSE;
}
diff --git a/panels/network/wireless-security/wireless-security.c
b/panels/network/wireless-security/wireless-security.c
index a235352c3..b07142b93 100644
--- a/panels/network/wireless-security/wireless-security.c
+++ b/panels/network/wireless-security/wireless-security.c
@@ -64,101 +64,101 @@ wireless_security_get_type (void)
}
GtkWidget *
-wireless_security_get_widget (WirelessSecurity *sec)
+wireless_security_get_widget (WirelessSecurity *self)
{
- WirelessSecurityPrivate *priv = sec->priv;
- g_return_val_if_fail (sec != NULL, NULL);
+ WirelessSecurityPrivate *priv = self->priv;
+ g_return_val_if_fail (self != NULL, NULL);
g_assert (priv->get_widget);
- return (*(priv->get_widget)) (sec);
+ return (*(priv->get_widget)) (self);
}
void
-wireless_security_set_changed_notify (WirelessSecurity *sec,
+wireless_security_set_changed_notify (WirelessSecurity *self,
WSChangedFunc func,
gpointer user_data)
{
- WirelessSecurityPrivate *priv = sec->priv;
- g_return_if_fail (sec != NULL);
+ WirelessSecurityPrivate *priv = self->priv;
+ g_return_if_fail (self != NULL);
priv->changed_notify = func;
priv->changed_notify_data = user_data;
}
void
-wireless_security_notify_changed (WirelessSecurity *sec)
+wireless_security_notify_changed (WirelessSecurity *self)
{
- WirelessSecurityPrivate *priv = sec->priv;
+ WirelessSecurityPrivate *priv = self->priv;
if (priv->changed_notify)
- (*(priv->changed_notify)) (sec, priv->changed_notify_data);
+ (*(priv->changed_notify)) (self, priv->changed_notify_data);
}
gboolean
-wireless_security_validate (WirelessSecurity *sec, GError **error)
+wireless_security_validate (WirelessSecurity *self, GError **error)
{
- WirelessSecurityPrivate *priv = sec->priv;
+ WirelessSecurityPrivate *priv = self->priv;
gboolean result;
- g_return_val_if_fail (sec != NULL, FALSE);
+ g_return_val_if_fail (self != NULL, FALSE);
g_return_val_if_fail (!error || !*error, FALSE);
g_assert (priv->validate);
- result = (*(priv->validate)) (sec, error);
+ result = (*(priv->validate)) (self, error);
if (!result && error && !*error)
g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("Unknown error validating 802.1X
security"));
return result;
}
void
-wireless_security_add_to_size_group (WirelessSecurity *sec, GtkSizeGroup *group)
+wireless_security_add_to_size_group (WirelessSecurity *self, GtkSizeGroup *group)
{
- WirelessSecurityPrivate *priv = sec->priv;
+ WirelessSecurityPrivate *priv = self->priv;
- g_return_if_fail (sec != NULL);
+ g_return_if_fail (self != NULL);
g_return_if_fail (group != NULL);
g_assert (priv->add_to_size_group);
- return (*(priv->add_to_size_group)) (sec, group);
+ return (*(priv->add_to_size_group)) (self, group);
}
void
-wireless_security_fill_connection (WirelessSecurity *sec,
+wireless_security_fill_connection (WirelessSecurity *self,
NMConnection *connection)
{
- WirelessSecurityPrivate *priv = sec->priv;
+ WirelessSecurityPrivate *priv = self->priv;
- g_return_if_fail (sec != NULL);
+ g_return_if_fail (self != NULL);
g_return_if_fail (connection != NULL);
g_assert (priv->fill_connection);
- return (*(priv->fill_connection)) (sec, connection);
+ return (*(priv->fill_connection)) (self, connection);
}
WirelessSecurity *
-wireless_security_ref (WirelessSecurity *sec)
+wireless_security_ref (WirelessSecurity *self)
{
- WirelessSecurityPrivate *priv = sec->priv;
+ WirelessSecurityPrivate *priv = self->priv;
- g_return_val_if_fail (sec != NULL, NULL);
+ g_return_val_if_fail (self != NULL, NULL);
g_return_val_if_fail (priv->refcount > 0, NULL);
priv->refcount++;
- return sec;
+ return self;
}
void
-wireless_security_unref (WirelessSecurity *sec)
+wireless_security_unref (WirelessSecurity *self)
{
- WirelessSecurityPrivate *priv = sec->priv;
+ WirelessSecurityPrivate *priv = self->priv;
- g_return_if_fail (sec != NULL);
+ g_return_if_fail (self != NULL);
g_return_if_fail (priv->refcount > 0);
priv->refcount--;
if (priv->refcount == 0) {
if (priv->destroy)
- priv->destroy (sec);
+ priv->destroy (self);
g_free (priv->username);
if (priv->password) {
@@ -166,9 +166,9 @@ wireless_security_unref (WirelessSecurity *sec)
g_free (priv->password);
}
- if (sec->builder)
- g_object_unref (sec->builder);
- g_slice_free1 (priv->obj_size, sec);
+ if (self->builder)
+ g_object_unref (self->builder);
+ g_slice_free1 (priv->obj_size, self);
g_free (priv);
}
}
@@ -182,7 +182,7 @@ wireless_security_init (gsize obj_size,
WSDestroyFunc destroy,
const char *ui_resource)
{
- g_autoptr(WirelessSecurity) sec = NULL;
+ g_autoptr(WirelessSecurity) self = NULL;
WirelessSecurityPrivate *priv;
g_autoptr(GError) error = NULL;
@@ -191,9 +191,9 @@ wireless_security_init (gsize obj_size,
g_type_ensure (WIRELESS_TYPE_SECURITY);
- sec = g_slice_alloc0 (obj_size);
- g_assert (sec);
- sec->priv = priv = g_new0 (WirelessSecurityPrivate, 1);
+ self = g_slice_alloc0 (obj_size);
+ g_assert (self);
+ self->priv = priv = g_new0 (WirelessSecurityPrivate, 1);
priv->refcount = 1;
priv->obj_size = obj_size;
@@ -203,8 +203,8 @@ wireless_security_init (gsize obj_size,
priv->add_to_size_group = add_to_size_group;
priv->fill_connection = fill_connection;
- sec->builder = gtk_builder_new ();
- if (!gtk_builder_add_from_resource (sec->builder, ui_resource, &error)) {
+ self->builder = gtk_builder_new ();
+ if (!gtk_builder_add_from_resource (self->builder, ui_resource, &error)) {
g_warning ("Couldn't load UI builder resource %s: %s",
ui_resource, error->message);
return NULL;
@@ -214,97 +214,97 @@ wireless_security_init (gsize obj_size,
priv->adhoc_compatible = TRUE;
priv->hotspot_compatible = TRUE;
- return g_steal_pointer (&sec);
+ return g_steal_pointer (&self);
}
void
-wireless_security_set_adhoc_compatible (WirelessSecurity *sec, gboolean adhoc_compatible)
+wireless_security_set_adhoc_compatible (WirelessSecurity *self, gboolean adhoc_compatible)
{
- WirelessSecurityPrivate *priv = sec->priv;
+ WirelessSecurityPrivate *priv = self->priv;
- g_return_if_fail (sec != NULL);
+ g_return_if_fail (self != NULL);
priv->adhoc_compatible = adhoc_compatible;
}
gboolean
-wireless_security_adhoc_compatible (WirelessSecurity *sec)
+wireless_security_adhoc_compatible (WirelessSecurity *self)
{
- WirelessSecurityPrivate *priv = sec->priv;
+ WirelessSecurityPrivate *priv = self->priv;
- g_return_val_if_fail (sec != NULL, FALSE);
+ g_return_val_if_fail (self != NULL, FALSE);
return priv->adhoc_compatible;
}
void
-wireless_security_set_hotspot_compatible (WirelessSecurity *sec, gboolean hotspot_compatible)
+wireless_security_set_hotspot_compatible (WirelessSecurity *self, gboolean hotspot_compatible)
{
- WirelessSecurityPrivate *priv = sec->priv;
+ WirelessSecurityPrivate *priv = self->priv;
- g_return_if_fail (sec != NULL);
+ g_return_if_fail (self != NULL);
priv->hotspot_compatible = hotspot_compatible;
}
gboolean
-wireless_security_hotspot_compatible (WirelessSecurity *sec)
+wireless_security_hotspot_compatible (WirelessSecurity *self)
{
- WirelessSecurityPrivate *priv = sec->priv;
+ WirelessSecurityPrivate *priv = self->priv;
- g_return_val_if_fail (sec != NULL, FALSE);
+ g_return_val_if_fail (self != NULL, FALSE);
return priv->hotspot_compatible;
}
const gchar *
-wireless_security_get_username (WirelessSecurity *sec)
+wireless_security_get_username (WirelessSecurity *self)
{
- WirelessSecurityPrivate *priv = sec->priv;
+ WirelessSecurityPrivate *priv = self->priv;
- g_return_val_if_fail (sec != NULL, NULL);
+ g_return_val_if_fail (self != NULL, NULL);
return priv->username;
}
const gchar *
-wireless_security_get_password (WirelessSecurity *sec)
+wireless_security_get_password (WirelessSecurity *self)
{
- WirelessSecurityPrivate *priv = sec->priv;
+ WirelessSecurityPrivate *priv = self->priv;
- g_return_val_if_fail (sec != NULL, NULL);
+ g_return_val_if_fail (self != NULL, NULL);
return priv->password;
}
gboolean
-wireless_security_get_always_ask (WirelessSecurity *sec)
+wireless_security_get_always_ask (WirelessSecurity *self)
{
- WirelessSecurityPrivate *priv = sec->priv;
+ WirelessSecurityPrivate *priv = self->priv;
- g_return_val_if_fail (sec != NULL, FALSE);
+ g_return_val_if_fail (self != NULL, FALSE);
return priv->always_ask;
}
gboolean
-wireless_security_get_show_password (WirelessSecurity *sec)
+wireless_security_get_show_password (WirelessSecurity *self)
{
- WirelessSecurityPrivate *priv = sec->priv;
+ WirelessSecurityPrivate *priv = self->priv;
- g_return_val_if_fail (sec != NULL, FALSE);
+ g_return_val_if_fail (self != NULL, FALSE);
return priv->show_password;
}
void
-wireless_security_set_userpass (WirelessSecurity *sec,
+wireless_security_set_userpass (WirelessSecurity *self,
const char *user,
const char *password,
gboolean always_ask,
gboolean show_password)
{
- WirelessSecurityPrivate *priv = sec->priv;
+ WirelessSecurityPrivate *priv = self->priv;
g_free (priv->username);
priv->username = g_strdup (user);
@@ -321,7 +321,7 @@ wireless_security_set_userpass (WirelessSecurity *sec,
}
void
-wireless_security_set_userpass_802_1x (WirelessSecurity *sec,
+wireless_security_set_userpass_802_1x (WirelessSecurity *self,
NMConnection *connection)
{
const char *user = NULL, *password = NULL;
@@ -343,7 +343,7 @@ wireless_security_set_userpass_802_1x (WirelessSecurity *sec,
always_ask = !!(flags & NM_SETTING_SECRET_FLAG_NOT_SAVED);
set:
- wireless_security_set_userpass (sec, user, password, always_ask, show_password);
+ wireless_security_set_userpass (self, user, password, always_ask, show_password);
}
void
@@ -397,7 +397,7 @@ ws_802_1x_validate (GtkComboBox *combo, GError **error)
void
ws_802_1x_auth_combo_changed (GtkWidget *combo,
- WirelessSecurity *sec,
+ WirelessSecurity *self,
GtkBox *vbox,
GtkSizeGroup *size_group)
{
@@ -433,11 +433,11 @@ ws_802_1x_auth_combo_changed (GtkWidget *combo,
gtk_widget_grab_focus (eap_default_widget);
}
- wireless_security_notify_changed (WIRELESS_SECURITY (sec));
+ wireless_security_notify_changed (WIRELESS_SECURITY (self));
}
void
-ws_802_1x_auth_combo_init (WirelessSecurity *sec,
+ws_802_1x_auth_combo_init (WirelessSecurity *self,
GtkComboBox *combo,
GtkLabel *label,
GCallback auth_combo_changed_cb,
@@ -475,7 +475,7 @@ ws_802_1x_auth_combo_init (WirelessSecurity *sec,
}
/* initialize WirelessSecurity userpass from connection (clear if no connection) */
- wireless_security_set_userpass_802_1x (sec, connection);
+ wireless_security_set_userpass_802_1x (self, connection);
auth_model = gtk_list_store_new (2, G_TYPE_STRING, eap_method_get_type ());
@@ -487,7 +487,7 @@ ws_802_1x_auth_combo_init (WirelessSecurity *sec,
if (wired) {
g_autoptr(EAPMethodSimple) em_md5 = NULL;
- em_md5 = eap_method_simple_new (sec, connection, EAP_METHOD_SIMPLE_TYPE_MD5, simple_flags);
+ em_md5 = eap_method_simple_new (self, connection, EAP_METHOD_SIMPLE_TYPE_MD5, simple_flags);
gtk_list_store_append (auth_model, &iter);
gtk_list_store_set (auth_model, &iter,
AUTH_NAME_COLUMN, _("MD5"),
@@ -498,7 +498,7 @@ ws_802_1x_auth_combo_init (WirelessSecurity *sec,
item++;
}
- em_tls = eap_method_tls_new (sec, connection, FALSE, secrets_only);
+ em_tls = eap_method_tls_new (self, connection, FALSE, secrets_only);
gtk_list_store_append (auth_model, &iter);
gtk_list_store_set (auth_model, &iter,
AUTH_NAME_COLUMN, _("TLS"),
@@ -511,7 +511,7 @@ ws_802_1x_auth_combo_init (WirelessSecurity *sec,
if (!wired) {
g_autoptr(EAPMethodLEAP) em_leap = NULL;
- em_leap = eap_method_leap_new (sec, connection, secrets_only);
+ em_leap = eap_method_leap_new (self, connection, secrets_only);
gtk_list_store_append (auth_model, &iter);
gtk_list_store_set (auth_model, &iter,
AUTH_NAME_COLUMN, _("LEAP"),
@@ -522,7 +522,7 @@ ws_802_1x_auth_combo_init (WirelessSecurity *sec,
item++;
}
- em_pwd = eap_method_simple_new (sec, connection, EAP_METHOD_SIMPLE_TYPE_PWD, simple_flags);
+ em_pwd = eap_method_simple_new (self, connection, EAP_METHOD_SIMPLE_TYPE_PWD, simple_flags);
gtk_list_store_append (auth_model, &iter);
gtk_list_store_set (auth_model, &iter,
AUTH_NAME_COLUMN, _("PWD"),
@@ -532,7 +532,7 @@ ws_802_1x_auth_combo_init (WirelessSecurity *sec,
active = item;
item++;
- em_fast = eap_method_fast_new (sec, connection, is_editor, secrets_only);
+ em_fast = eap_method_fast_new (self, connection, is_editor, secrets_only);
gtk_list_store_append (auth_model, &iter);
gtk_list_store_set (auth_model, &iter,
AUTH_NAME_COLUMN, _("FAST"),
@@ -542,7 +542,7 @@ ws_802_1x_auth_combo_init (WirelessSecurity *sec,
active = item;
item++;
- em_ttls = eap_method_ttls_new (sec, connection, is_editor, secrets_only);
+ em_ttls = eap_method_ttls_new (self, connection, is_editor, secrets_only);
gtk_list_store_append (auth_model, &iter);
gtk_list_store_set (auth_model, &iter,
AUTH_NAME_COLUMN, _("Tunneled TLS"),
@@ -552,7 +552,7 @@ ws_802_1x_auth_combo_init (WirelessSecurity *sec,
active = item;
item++;
- em_peap = eap_method_peap_new (sec, connection, is_editor, secrets_only);
+ em_peap = eap_method_peap_new (self, connection, is_editor, secrets_only);
gtk_list_store_append (auth_model, &iter);
gtk_list_store_set (auth_model, &iter,
AUTH_NAME_COLUMN, _("Protected EAP (PEAP)"),
@@ -565,7 +565,7 @@ ws_802_1x_auth_combo_init (WirelessSecurity *sec,
gtk_combo_box_set_model (combo, GTK_TREE_MODEL (auth_model));
gtk_combo_box_set_active (combo, active < 0 ? 0 : (guint32) active);
- g_signal_connect (G_OBJECT (combo), "changed", auth_combo_changed_cb, sec);
+ g_signal_connect (G_OBJECT (combo), "changed", auth_combo_changed_cb, self);
if (secrets_only) {
gtk_widget_hide (GTK_WIDGET (combo));
diff --git a/panels/network/wireless-security/ws-dynamic-wep.c
b/panels/network/wireless-security/ws-dynamic-wep.c
index f4a1fad58..9252e09e6 100644
--- a/panels/network/wireless-security/ws-dynamic-wep.c
+++ b/panels/network/wireless-security/ws-dynamic-wep.c
@@ -43,10 +43,10 @@ struct _WirelessSecurityDynamicWEP {
static void
destroy (WirelessSecurity *parent)
{
- WirelessSecurityDynamicWEP *sec = (WirelessSecurityDynamicWEP *) parent;
+ WirelessSecurityDynamicWEP *self = (WirelessSecurityDynamicWEP *) parent;
- if (sec->size_group)
- g_object_unref (sec->size_group);
+ if (self->size_group)
+ g_object_unref (self->size_group);
}
static GtkWidget *
@@ -66,13 +66,13 @@ validate (WirelessSecurity *parent, GError **error)
static void
add_to_size_group (WirelessSecurity *parent, GtkSizeGroup *group)
{
- WirelessSecurityDynamicWEP *sec = (WirelessSecurityDynamicWEP *) parent;
+ WirelessSecurityDynamicWEP *self = (WirelessSecurityDynamicWEP *) parent;
- if (sec->size_group)
- g_object_unref (sec->size_group);
- sec->size_group = g_object_ref (group);
+ if (self->size_group)
+ g_object_unref (self->size_group);
+ self->size_group = g_object_ref (group);
- ws_802_1x_add_to_size_group (sec->size_group, sec->auth_label, sec->auth_combo);
+ ws_802_1x_add_to_size_group (self->size_group, self->auth_label, self->auth_combo);
}
static void
@@ -93,12 +93,12 @@ static void
auth_combo_changed_cb (GtkWidget *combo, gpointer user_data)
{
WirelessSecurity *parent = WIRELESS_SECURITY (user_data);
- WirelessSecurityDynamicWEP *sec = (WirelessSecurityDynamicWEP *) parent;
+ WirelessSecurityDynamicWEP *self = (WirelessSecurityDynamicWEP *) parent;
ws_802_1x_auth_combo_changed (combo,
parent,
- sec->method_box,
- sec->size_group);
+ self->method_box,
+ self->size_group);
}
WirelessSecurityDynamicWEP *
@@ -137,6 +137,6 @@ ws_dynamic_wep_new (NMConnection *connection,
secrets_only);
auth_combo_changed_cb (GTK_WIDGET (self->auth_combo), (gpointer) parent);
- return (WirelessSecurityDynamicWEP *) parent;
+ return self;
}
diff --git a/panels/network/wireless-security/ws-leap.c b/panels/network/wireless-security/ws-leap.c
index 0abbbcbba..0e5ef7c72 100644
--- a/panels/network/wireless-security/ws-leap.c
+++ b/panels/network/wireless-security/ws-leap.c
@@ -91,15 +91,15 @@ validate (WirelessSecurity *parent, GError **error)
static void
add_to_size_group (WirelessSecurity *parent, GtkSizeGroup *group)
{
- WirelessSecurityLEAP *sec = (WirelessSecurityLEAP *) parent;
- gtk_size_group_add_widget (group, GTK_WIDGET (sec->username_label));
- gtk_size_group_add_widget (group, GTK_WIDGET (sec->password_label));
+ WirelessSecurityLEAP *self = (WirelessSecurityLEAP *) parent;
+ gtk_size_group_add_widget (group, GTK_WIDGET (self->username_label));
+ gtk_size_group_add_widget (group, GTK_WIDGET (self->password_label));
}
static void
fill_connection (WirelessSecurity *parent, NMConnection *connection)
{
- WirelessSecurityLEAP *sec = (WirelessSecurityLEAP *) parent;
+ WirelessSecurityLEAP *self = (WirelessSecurityLEAP *) parent;
NMSettingWirelessSecurity *s_wireless_sec;
NMSettingSecretFlags secret_flags;
const char *leap_password = NULL, *leap_username = NULL;
@@ -108,8 +108,8 @@ fill_connection (WirelessSecurity *parent, NMConnection *connection)
s_wireless_sec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new ();
nm_connection_add_setting (connection, (NMSetting *) s_wireless_sec);
- leap_username = gtk_entry_get_text (sec->username_entry);
- leap_password = gtk_entry_get_text (sec->password_entry);
+ leap_username = gtk_entry_get_text (self->username_entry);
+ leap_password = gtk_entry_get_text (self->password_entry);
g_object_set (s_wireless_sec,
NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "ieee8021x",
@@ -119,14 +119,14 @@ fill_connection (WirelessSecurity *parent, NMConnection *connection)
NULL);
/* Save LEAP_PASSWORD_FLAGS to the connection */
- secret_flags = nma_utils_menu_to_secret_flags (GTK_WIDGET (sec->password_entry));
- nm_setting_set_secret_flags (NM_SETTING (s_wireless_sec), sec->password_flags_name,
+ secret_flags = nma_utils_menu_to_secret_flags (GTK_WIDGET (self->password_entry));
+ nm_setting_set_secret_flags (NM_SETTING (s_wireless_sec), self->password_flags_name,
secret_flags, NULL);
/* Update secret flags and popup when editing the connection */
- if (sec->editing_connection)
- nma_utils_update_password_storage (GTK_WIDGET (sec->password_entry), secret_flags,
- NM_SETTING (s_wireless_sec), sec->password_flags_name);
+ 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);
}
static void
@@ -149,7 +149,7 @@ WirelessSecurityLEAP *
ws_leap_new (NMConnection *connection, gboolean secrets_only)
{
WirelessSecurity *parent;
- WirelessSecurityLEAP *sec;
+ WirelessSecurityLEAP *self;
NMSettingWirelessSecurity *wsec = NULL;
parent = wireless_security_init (sizeof (WirelessSecurityLEAP),
@@ -176,35 +176,35 @@ ws_leap_new (NMConnection *connection, gboolean secrets_only)
wireless_security_set_adhoc_compatible (parent, FALSE);
wireless_security_set_hotspot_compatible (parent, FALSE);
- sec = (WirelessSecurityLEAP *) parent;
- sec->editing_connection = secrets_only ? FALSE : TRUE;
- sec->password_flags_name = NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD;
+ self = (WirelessSecurityLEAP *) parent;
+ self->editing_connection = secrets_only ? FALSE : TRUE;
+ self->password_flags_name = NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD;
- sec->grid = GTK_GRID (gtk_builder_get_object (parent->builder, "grid"));
- sec->password_entry = GTK_ENTRY (gtk_builder_get_object (parent->builder, "password_entry"));
- sec->password_label = GTK_LABEL (gtk_builder_get_object (parent->builder, "password_label"));
- sec->show_password_check = GTK_CHECK_BUTTON (gtk_builder_get_object (parent->builder,
"show_password_check"));
- sec->username_entry = GTK_ENTRY (gtk_builder_get_object (parent->builder, "username_entry"));
- sec->username_label = GTK_LABEL (gtk_builder_get_object (parent->builder, "username_label"));
+ self->grid = GTK_GRID (gtk_builder_get_object (parent->builder, "grid"));
+ self->password_entry = GTK_ENTRY (gtk_builder_get_object (parent->builder, "password_entry"));
+ self->password_label = GTK_LABEL (gtk_builder_get_object (parent->builder, "password_label"));
+ self->show_password_check = GTK_CHECK_BUTTON (gtk_builder_get_object (parent->builder,
"show_password_check"));
+ self->username_entry = GTK_ENTRY (gtk_builder_get_object (parent->builder, "username_entry"));
+ self->username_label = GTK_LABEL (gtk_builder_get_object (parent->builder, "username_label"));
- g_signal_connect_swapped (sec->password_entry, "changed", G_CALLBACK (changed_cb), sec);
+ 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 (sec->password_entry), 0, (NMSetting *) wsec,
sec->password_flags_name,
+ nma_utils_setup_password_storage (GTK_WIDGET (self->password_entry), 0, (NMSetting *) wsec,
self->password_flags_name,
FALSE, secrets_only);
if (wsec)
- update_secrets (WIRELESS_SECURITY (sec), connection);
+ update_secrets (WIRELESS_SECURITY (self), connection);
- g_signal_connect_swapped (sec->username_entry, "changed", G_CALLBACK (changed_cb), sec);
+ g_signal_connect_swapped (self->username_entry, "changed", G_CALLBACK (changed_cb), self);
if (wsec)
- gtk_entry_set_text (sec->username_entry, nm_setting_wireless_security_get_leap_username
(wsec));
+ gtk_entry_set_text (self->username_entry, nm_setting_wireless_security_get_leap_username
(wsec));
if (secrets_only)
- gtk_widget_hide (GTK_WIDGET (sec->username_entry));
+ gtk_widget_hide (GTK_WIDGET (self->username_entry));
- g_signal_connect_swapped (sec->show_password_check, "toggled", G_CALLBACK (show_toggled_cb), sec);
+ g_signal_connect_swapped (self->show_password_check, "toggled", G_CALLBACK (show_toggled_cb), self);
- return sec;
+ return self;
}
diff --git a/panels/network/wireless-security/ws-wep-key.c b/panels/network/wireless-security/ws-wep-key.c
index 4d84d5eb6..90fad5d29 100644
--- a/panels/network/wireless-security/ws-wep-key.c
+++ b/panels/network/wireless-security/ws-wep-key.c
@@ -86,11 +86,11 @@ key_index_combo_changed_cb (WirelessSecurityWEPKey *self)
static void
destroy (WirelessSecurity *parent)
{
- WirelessSecurityWEPKey *sec = (WirelessSecurityWEPKey *) parent;
+ WirelessSecurityWEPKey *self = (WirelessSecurityWEPKey *) parent;
int i;
for (i = 0; i < 4; i++)
- memset (sec->keys[i], 0, sizeof (sec->keys[i]));
+ memset (self->keys[i], 0, sizeof (self->keys[i]));
}
static GtkWidget *
@@ -103,22 +103,22 @@ get_widget (WirelessSecurity *parent)
static gboolean
validate (WirelessSecurity *parent, GError **error)
{
- WirelessSecurityWEPKey *sec = (WirelessSecurityWEPKey *) parent;
+ WirelessSecurityWEPKey *self = (WirelessSecurityWEPKey *) parent;
const char *key;
int i;
- key = gtk_entry_get_text (sec->key_entry);
+ key = gtk_entry_get_text (self->key_entry);
if (!key) {
- widget_set_error (GTK_WIDGET (sec->key_entry));
+ widget_set_error (GTK_WIDGET (self->key_entry));
g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("missing wep-key"));
return FALSE;
}
- if (sec->type == NM_WEP_KEY_TYPE_KEY) {
+ if (self->type == NM_WEP_KEY_TYPE_KEY) {
if ((strlen (key) == 10) || (strlen (key) == 26)) {
for (i = 0; i < strlen (key); i++) {
if (!g_ascii_isxdigit (key[i])) {
- widget_set_error (GTK_WIDGET (sec->key_entry));
+ widget_set_error (GTK_WIDGET (self->key_entry));
g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, _("invalid wep-key:
key with a length of %zu must contain only hex-digits"), strlen (key));
return FALSE;
}
@@ -126,19 +126,19 @@ validate (WirelessSecurity *parent, GError **error)
} else if ((strlen (key) == 5) || (strlen (key) == 13)) {
for (i = 0; i < strlen (key); i++) {
if (!g_ascii_isprint (key[i])) {
- widget_set_error (GTK_WIDGET (sec->key_entry));
+ widget_set_error (GTK_WIDGET (self->key_entry));
g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, _("invalid wep-key:
key with a length of %zu must contain only ascii characters"), strlen (key));
return FALSE;
}
}
} else {
- widget_set_error (GTK_WIDGET (sec->key_entry));
+ widget_set_error (GTK_WIDGET (self->key_entry));
g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, _("invalid wep-key: wrong key
length %zu. A key must be either of length 5/13 (ascii) or 10/26 (hex)"), strlen (key));
return FALSE;
}
- } else if (sec->type == NM_WEP_KEY_TYPE_PASSPHRASE) {
+ } else if (self->type == NM_WEP_KEY_TYPE_PASSPHRASE) {
if (!*key || (strlen (key) > 64)) {
- widget_set_error (GTK_WIDGET (sec->key_entry));
+ widget_set_error (GTK_WIDGET (self->key_entry));
if (!*key)
g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC, _("invalid wep-key:
passphrase must be non-empty"));
else
@@ -146,7 +146,7 @@ validate (WirelessSecurity *parent, GError **error)
return FALSE;
}
}
- widget_unset_error (GTK_WIDGET (sec->key_entry));
+ widget_unset_error (GTK_WIDGET (self->key_entry));
return TRUE;
}
@@ -163,17 +163,17 @@ add_to_size_group (WirelessSecurity *parent, GtkSizeGroup *group)
static void
fill_connection (WirelessSecurity *parent, NMConnection *connection)
{
- WirelessSecurityWEPKey *sec = (WirelessSecurityWEPKey *) parent;
+ WirelessSecurityWEPKey *self = (WirelessSecurityWEPKey *) parent;
NMSettingWirelessSecurity *s_wsec;
NMSettingSecretFlags secret_flags;
gint auth_alg;
const char *key;
int i;
- auth_alg = gtk_combo_box_get_active (sec->auth_method_combo);
+ auth_alg = gtk_combo_box_get_active (self->auth_method_combo);
- key = gtk_entry_get_text (sec->key_entry);
- g_strlcpy (sec->keys[sec->cur_index], key, sizeof (sec->keys[sec->cur_index]));
+ key = gtk_entry_get_text (self->key_entry);
+ g_strlcpy (self->keys[self->cur_index], key, sizeof (self->keys[self->cur_index]));
/* Blow away the old security setting by adding a clear one */
s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new ();
@@ -181,24 +181,24 @@ fill_connection (WirelessSecurity *parent, NMConnection *connection)
g_object_set (s_wsec,
NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "none",
- NM_SETTING_WIRELESS_SECURITY_WEP_TX_KEYIDX, sec->cur_index,
+ NM_SETTING_WIRELESS_SECURITY_WEP_TX_KEYIDX, self->cur_index,
NM_SETTING_WIRELESS_SECURITY_AUTH_ALG, (auth_alg == 1) ? "shared" : "open",
- NM_SETTING_WIRELESS_SECURITY_WEP_KEY_TYPE, sec->type,
+ NM_SETTING_WIRELESS_SECURITY_WEP_KEY_TYPE, self->type,
NULL);
for (i = 0; i < 4; i++) {
- if (strlen (sec->keys[i]))
- nm_setting_wireless_security_set_wep_key (s_wsec, i, sec->keys[i]);
+ if (strlen (self->keys[i]))
+ nm_setting_wireless_security_set_wep_key (s_wsec, i, self->keys[i]);
}
/* Save WEP_KEY_FLAGS to the connection */
- secret_flags = nma_utils_menu_to_secret_flags (GTK_WIDGET (sec->key_entry));
+ secret_flags = nma_utils_menu_to_secret_flags (GTK_WIDGET (self->key_entry));
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 (sec->editing_connection)
- nma_utils_update_password_storage (GTK_WIDGET (sec->key_entry), secret_flags,
- NM_SETTING (s_wsec), sec->password_flags_name);
+ if (self->editing_connection)
+ nma_utils_update_password_storage (GTK_WIDGET (self->key_entry), secret_flags,
+ NM_SETTING (s_wsec), self->password_flags_name);
}
static void
@@ -229,7 +229,7 @@ wep_entry_filter_cb (WirelessSecurityWEPKey *self,
static void
update_secrets (WirelessSecurity *parent, NMConnection *connection)
{
- WirelessSecurityWEPKey *sec = (WirelessSecurityWEPKey *) parent;
+ WirelessSecurityWEPKey *self = (WirelessSecurityWEPKey *) parent;
NMSettingWirelessSecurity *s_wsec;
const char *tmp;
int i;
@@ -238,11 +238,11 @@ update_secrets (WirelessSecurity *parent, NMConnection *connection)
for (i = 0; s_wsec && i < 4; i++) {
tmp = nm_setting_wireless_security_get_wep_key (s_wsec, i);
if (tmp)
- g_strlcpy (sec->keys[i], tmp, sizeof (sec->keys[i]));
+ g_strlcpy (self->keys[i], tmp, sizeof (self->keys[i]));
}
- if (strlen (sec->keys[sec->cur_index]))
- gtk_entry_set_text (sec->key_entry, sec->keys[sec->cur_index]);
+ if (strlen (self->keys[self->cur_index]))
+ gtk_entry_set_text (self->key_entry, self->keys[self->cur_index]);
}
static void
@@ -258,7 +258,7 @@ ws_wep_key_new (NMConnection *connection,
gboolean secrets_only)
{
WirelessSecurity *parent;
- WirelessSecurityWEPKey *sec;
+ WirelessSecurityWEPKey *self;
NMSettingWirelessSecurity *s_wsec = NULL;
NMSetting *setting = NULL;
guint8 default_key_idx = 0;
@@ -274,27 +274,27 @@ ws_wep_key_new (NMConnection *connection,
"/org/gnome/ControlCenter/network/ws-wep-key.ui");
if (!parent)
return NULL;
- sec = (WirelessSecurityWEPKey *) parent;
+ self = (WirelessSecurityWEPKey *) parent;
- sec->auth_method_combo = GTK_COMBO_BOX (gtk_builder_get_object (parent->builder,
"auth_method_combo"));
- sec->auth_method_label = GTK_LABEL (gtk_builder_get_object (parent->builder, "auth_method_label"));
- sec->grid = GTK_GRID (gtk_builder_get_object (parent->builder, "grid"));
- sec->key_entry = GTK_ENTRY (gtk_builder_get_object (parent->builder, "key_entry"));
- sec->key_index_combo = GTK_COMBO_BOX (gtk_builder_get_object (parent->builder, "key_index_combo"));
- sec->key_index_label = GTK_LABEL (gtk_builder_get_object (parent->builder, "key_index_label"));
- sec->key_label = GTK_LABEL (gtk_builder_get_object (parent->builder, "key_label"));
- sec->show_key_check = GTK_CHECK_BUTTON (gtk_builder_get_object (parent->builder, "show_key_check"));
+ self->auth_method_combo = GTK_COMBO_BOX (gtk_builder_get_object (parent->builder,
"auth_method_combo"));
+ self->auth_method_label = GTK_LABEL (gtk_builder_get_object (parent->builder, "auth_method_label"));
+ self->grid = GTK_GRID (gtk_builder_get_object (parent->builder, "grid"));
+ self->key_entry = GTK_ENTRY (gtk_builder_get_object (parent->builder, "key_entry"));
+ self->key_index_combo = GTK_COMBO_BOX (gtk_builder_get_object (parent->builder, "key_index_combo"));
+ self->key_index_label = GTK_LABEL (gtk_builder_get_object (parent->builder, "key_index_label"));
+ self->key_label = GTK_LABEL (gtk_builder_get_object (parent->builder, "key_label"));
+ self->show_key_check = GTK_CHECK_BUTTON (gtk_builder_get_object (parent->builder, "show_key_check"));
- sec->editing_connection = secrets_only ? FALSE : TRUE;
- sec->password_flags_name = NM_SETTING_WIRELESS_SECURITY_WEP_KEY0;
- sec->type = type;
+ self->editing_connection = secrets_only ? FALSE : TRUE;
+ self->password_flags_name = NM_SETTING_WIRELESS_SECURITY_WEP_KEY0;
+ self->type = type;
- gtk_entry_set_width_chars (sec->key_entry, 28);
+ gtk_entry_set_width_chars (self->key_entry, 28);
/* Create password-storage popup menu for password entry under entry's secondary icon */
if (connection)
setting = (NMSetting *) nm_connection_get_setting_wireless_security (connection);
- nma_utils_setup_password_storage (GTK_WIDGET (sec->key_entry), 0, setting, sec->password_flags_name,
+ nma_utils_setup_password_storage (GTK_WIDGET (self->key_entry), 0, setting, self->password_flags_name,
FALSE, secrets_only);
if (connection) {
@@ -314,35 +314,35 @@ ws_wep_key_new (NMConnection *connection,
}
}
- g_signal_connect_swapped (sec->key_entry, "changed", G_CALLBACK (changed_cb), sec);
- g_signal_connect_swapped (sec->key_entry, "insert-text", G_CALLBACK (wep_entry_filter_cb), sec);
- if (sec->type == NM_WEP_KEY_TYPE_KEY)
- gtk_entry_set_max_length (sec->key_entry, 26);
- else if (sec->type == NM_WEP_KEY_TYPE_PASSPHRASE)
- gtk_entry_set_max_length (sec->key_entry, 64);
+ g_signal_connect_swapped (self->key_entry, "changed", G_CALLBACK (changed_cb), self);
+ g_signal_connect_swapped (self->key_entry, "insert-text", G_CALLBACK (wep_entry_filter_cb), self);
+ if (self->type == NM_WEP_KEY_TYPE_KEY)
+ gtk_entry_set_max_length (self->key_entry, 26);
+ else if (self->type == NM_WEP_KEY_TYPE_PASSPHRASE)
+ gtk_entry_set_max_length (self->key_entry, 64);
if (connection && s_wsec)
default_key_idx = nm_setting_wireless_security_get_wep_tx_keyidx (s_wsec);
- gtk_combo_box_set_active (sec->key_index_combo, default_key_idx);
- sec->cur_index = default_key_idx;
- g_signal_connect_swapped (sec->key_index_combo, "changed", G_CALLBACK (key_index_combo_changed_cb),
sec);
+ gtk_combo_box_set_active (self->key_index_combo, default_key_idx);
+ self->cur_index = default_key_idx;
+ 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) {
- gtk_widget_hide (GTK_WIDGET (sec->key_index_combo));
- gtk_widget_hide (GTK_WIDGET (sec->key_index_label));
+ gtk_widget_hide (GTK_WIDGET (self->key_index_combo));
+ gtk_widget_hide (GTK_WIDGET (self->key_index_label));
}
/* Fill the key entry with the key for that index */
if (connection)
- update_secrets (WIRELESS_SECURITY (sec), connection);
+ update_secrets (WIRELESS_SECURITY (self), connection);
- g_signal_connect_swapped (sec->show_key_check, "toggled", G_CALLBACK (show_toggled_cb), sec);
+ g_signal_connect_swapped (self->show_key_check, "toggled", G_CALLBACK (show_toggled_cb), self);
- gtk_combo_box_set_active (sec->auth_method_combo, is_shared_key ? 1 : 0);
+ gtk_combo_box_set_active (self->auth_method_combo, is_shared_key ? 1 : 0);
- g_signal_connect_swapped (sec->auth_method_combo, "changed", G_CALLBACK (changed_cb), sec);
+ g_signal_connect_swapped (self->auth_method_combo, "changed", G_CALLBACK (changed_cb), self);
/* Don't show auth method for adhoc (which always uses open-system) or
* when in "simple" mode.
@@ -350,11 +350,11 @@ ws_wep_key_new (NMConnection *connection,
if (is_adhoc || secrets_only) {
/* Ad-Hoc connections can't use Shared Key auth */
if (is_adhoc)
- gtk_combo_box_set_active (sec->auth_method_combo, 0);
- gtk_widget_hide (GTK_WIDGET (sec->auth_method_combo));
- gtk_widget_hide (GTK_WIDGET (sec->auth_method_label));
+ gtk_combo_box_set_active (self->auth_method_combo, 0);
+ gtk_widget_hide (GTK_WIDGET (self->auth_method_combo));
+ gtk_widget_hide (GTK_WIDGET (self->auth_method_label));
}
- return sec;
+ return self;
}
diff --git a/panels/network/wireless-security/ws-wpa-eap.c b/panels/network/wireless-security/ws-wpa-eap.c
index 312074cbf..ee1a38181 100644
--- a/panels/network/wireless-security/ws-wpa-eap.c
+++ b/panels/network/wireless-security/ws-wpa-eap.c
@@ -44,10 +44,10 @@ struct _WirelessSecurityWPAEAP {
static void
destroy (WirelessSecurity *parent)
{
- WirelessSecurityWPAEAP *sec = (WirelessSecurityWPAEAP *) parent;
+ WirelessSecurityWPAEAP *self = (WirelessSecurityWPAEAP *) parent;
- if (sec->size_group)
- g_object_unref (sec->size_group);
+ if (self->size_group)
+ g_object_unref (self->size_group);
}
static GtkWidget *
@@ -67,13 +67,13 @@ validate (WirelessSecurity *parent, GError **error)
static void
add_to_size_group (WirelessSecurity *parent, GtkSizeGroup *group)
{
- WirelessSecurityWPAEAP *sec = (WirelessSecurityWPAEAP *) parent;
+ WirelessSecurityWPAEAP *self = (WirelessSecurityWPAEAP *) parent;
- if (sec->size_group)
- g_object_unref (sec->size_group);
- sec->size_group = g_object_ref (group);
+ if (self->size_group)
+ g_object_unref (self->size_group);
+ self->size_group = g_object_ref (group);
- ws_802_1x_add_to_size_group (sec->size_group, sec->auth_label, sec->auth_combo);
+ ws_802_1x_add_to_size_group (self->size_group, self->auth_label, self->auth_combo);
}
static void
@@ -94,12 +94,12 @@ static void
auth_combo_changed_cb (GtkWidget *combo, gpointer user_data)
{
WirelessSecurity *parent = WIRELESS_SECURITY (user_data);
- WirelessSecurityWPAEAP *sec = (WirelessSecurityWPAEAP *) parent;
+ WirelessSecurityWPAEAP *self = (WirelessSecurityWPAEAP *) parent;
ws_802_1x_auth_combo_changed (combo,
parent,
- sec->method_box,
- sec->size_group);
+ self->method_box,
+ self->size_group);
}
WirelessSecurityWPAEAP *
@@ -138,6 +138,6 @@ ws_wpa_eap_new (NMConnection *connection,
secrets_only);
auth_combo_changed_cb (GTK_WIDGET (self->auth_combo), parent);
- return (WirelessSecurityWPAEAP *) parent;
+ return self;
}
diff --git a/panels/network/wireless-security/ws-wpa-psk.c b/panels/network/wireless-security/ws-wpa-psk.c
index 4e1ba3006..9e4dac701 100644
--- a/panels/network/wireless-security/ws-wpa-psk.c
+++ b/panels/network/wireless-security/ws-wpa-psk.c
@@ -107,7 +107,7 @@ add_to_size_group (WirelessSecurity *parent, GtkSizeGroup *group)
static void
fill_connection (WirelessSecurity *parent, NMConnection *connection)
{
- WirelessSecurityWPAPSK *wpa_psk = (WirelessSecurityWPAPSK *) parent;
+ WirelessSecurityWPAPSK *self = (WirelessSecurityWPAPSK *) parent;
const char *key;
NMSettingWireless *s_wireless;
NMSettingWirelessSecurity *s_wireless_sec;
@@ -126,18 +126,18 @@ fill_connection (WirelessSecurity *parent, NMConnection *connection)
s_wireless_sec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new ();
nm_connection_add_setting (connection, (NMSetting *) s_wireless_sec);
- key = gtk_entry_get_text (wpa_psk->password_entry);
+ key = gtk_entry_get_text (self->password_entry);
g_object_set (s_wireless_sec, NM_SETTING_WIRELESS_SECURITY_PSK, key, NULL);
/* Save PSK_FLAGS to the connection */
- secret_flags = nma_utils_menu_to_secret_flags (GTK_WIDGET (wpa_psk->password_entry));
+ secret_flags = nma_utils_menu_to_secret_flags (GTK_WIDGET (self->password_entry));
nm_setting_set_secret_flags (NM_SETTING (s_wireless_sec), NM_SETTING_WIRELESS_SECURITY_PSK,
secret_flags, NULL);
/* Update secret flags and popup when editing the connection */
- if (wpa_psk->editing_connection)
- nma_utils_update_password_storage (GTK_WIDGET (wpa_psk->password_entry), secret_flags,
- NM_SETTING (s_wireless_sec), wpa_psk->password_flags_name);
+ 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);
wireless_security_clear_ciphers (connection);
if (is_adhoc) {
@@ -179,7 +179,7 @@ WirelessSecurityWPAPSK *
ws_wpa_psk_new (NMConnection *connection, gboolean secrets_only)
{
WirelessSecurity *parent;
- WirelessSecurityWPAPSK *sec;
+ WirelessSecurityWPAPSK *self;
NMSetting *setting = NULL;
parent = wireless_security_init (sizeof (WirelessSecurityWPAPSK),
@@ -191,42 +191,42 @@ ws_wpa_psk_new (NMConnection *connection, gboolean secrets_only)
"/org/gnome/ControlCenter/network/ws-wpa-psk.ui");
if (!parent)
return NULL;
- sec = (WirelessSecurityWPAPSK *) parent;
+ self = (WirelessSecurityWPAPSK *) parent;
- sec->grid = GTK_GRID (gtk_builder_get_object (parent->builder, "grid"));
- sec->password_entry = GTK_ENTRY (gtk_builder_get_object (parent->builder, "password_entry"));
- sec->password_label = GTK_LABEL (gtk_builder_get_object (parent->builder, "password_label"));
- sec->show_password_check = GTK_CHECK_BUTTON (gtk_builder_get_object (parent->builder,
"show_password_check"));
- sec->type_combo = GTK_COMBO_BOX (gtk_builder_get_object (parent->builder, "type_combo"));
- sec->type_label = GTK_LABEL (gtk_builder_get_object (parent->builder, "type_label"));
+ self->grid = GTK_GRID (gtk_builder_get_object (parent->builder, "grid"));
+ self->password_entry = GTK_ENTRY (gtk_builder_get_object (parent->builder, "password_entry"));
+ self->password_label = GTK_LABEL (gtk_builder_get_object (parent->builder, "password_label"));
+ self->show_password_check = GTK_CHECK_BUTTON (gtk_builder_get_object (parent->builder,
"show_password_check"));
+ self->type_combo = GTK_COMBO_BOX (gtk_builder_get_object (parent->builder, "type_combo"));
+ self->type_label = GTK_LABEL (gtk_builder_get_object (parent->builder, "type_label"));
wireless_security_set_adhoc_compatible (parent, FALSE);
- sec->editing_connection = secrets_only ? FALSE : TRUE;
- sec->password_flags_name = NM_SETTING_WIRELESS_SECURITY_PSK;
+ self->editing_connection = secrets_only ? FALSE : TRUE;
+ self->password_flags_name = NM_SETTING_WIRELESS_SECURITY_PSK;
- g_signal_connect_swapped (sec->password_entry, "changed", G_CALLBACK (changed_cb), sec);
- gtk_entry_set_width_chars (sec->password_entry, 28);
+ g_signal_connect_swapped (self->password_entry, "changed", G_CALLBACK (changed_cb), self);
+ gtk_entry_set_width_chars (self->password_entry, 28);
/* Create password-storage popup menu for password entry under entry's secondary icon */
if (connection)
setting = (NMSetting *) nm_connection_get_setting_wireless_security (connection);
- nma_utils_setup_password_storage (GTK_WIDGET (sec->password_entry), 0, setting,
sec->password_flags_name,
+ nma_utils_setup_password_storage (GTK_WIDGET (self->password_entry), 0, setting,
self->password_flags_name,
FALSE, secrets_only);
/* Fill secrets, if any */
if (connection)
- update_secrets (WIRELESS_SECURITY (sec), connection);
+ update_secrets (WIRELESS_SECURITY (self), connection);
- g_signal_connect_swapped (sec->show_password_check, "toggled", G_CALLBACK (show_toggled_cb), sec);
+ g_signal_connect_swapped (self->show_password_check, "toggled", G_CALLBACK (show_toggled_cb), self);
/* Hide WPA/RSN for now since this can be autodetected by NM and the
* supplicant when connecting to the AP.
*/
- gtk_widget_hide (GTK_WIDGET (sec->type_combo));
- gtk_widget_hide (GTK_WIDGET (sec->type_label));
+ gtk_widget_hide (GTK_WIDGET (self->type_combo));
+ gtk_widget_hide (GTK_WIDGET (self->type_label));
- return sec;
+ return self;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]