[gnome-control-center] network: Connect signals in swapped form
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] network: Connect signals in swapped form
- Date: Tue, 22 Oct 2019 20:17:22 +0000 (UTC)
commit 54f8fce47fde184f85adde7d4190877830a601ea
Author: Robert Ancell <robert ancell canonical com>
Date: Tue Oct 15 11:15:30 2019 +1300
network: Connect signals in swapped form
panels/network/cc-network-panel.c | 44 +++++++-------
panels/network/cc-wifi-connection-row.c | 5 +-
panels/network/cc-wifi-panel.c | 25 +++-----
.../connection-editor/ce-page-8021x-security.c | 6 +-
panels/network/connection-editor/ce-page-details.c | 18 +++---
.../network/connection-editor/ce-page-ethernet.c | 30 ++++------
panels/network/connection-editor/ce-page-ip4.c | 26 +++-----
panels/network/connection-editor/ce-page-ip6.c | 26 +++-----
.../network/connection-editor/ce-page-security.c | 10 ++--
.../connection-editor/net-connection-editor.c | 12 ++--
panels/network/net-device-ethernet.c | 67 +++++++++------------
panels/network/net-device-mobile.c | 70 ++++++++++------------
panels/network/net-device-simple.c | 16 +++--
panels/network/net-device-wifi.c | 50 +++++++---------
panels/network/net-device.c | 14 ++---
panels/network/net-proxy.c | 48 +++++++--------
panels/network/net-vpn.c | 41 ++++++-------
panels/network/wireless-security/eap-method-fast.c | 31 +++++-----
panels/network/wireless-security/eap-method-leap.c | 23 ++++---
panels/network/wireless-security/eap-method-peap.c | 28 ++++-----
.../network/wireless-security/eap-method-simple.c | 33 ++++------
panels/network/wireless-security/eap-method-tls.c | 21 +++----
panels/network/wireless-security/eap-method-ttls.c | 29 ++++-----
panels/network/wireless-security/ws-leap.c | 13 ++--
panels/network/wireless-security/ws-wep-key.c | 58 ++++++++----------
panels/network/wireless-security/ws-wpa-psk.c | 13 ++--
26 files changed, 320 insertions(+), 437 deletions(-)
---
diff --git a/panels/network/cc-network-panel.c b/panels/network/cc-network-panel.c
index 14858c619..2f411e343 100644
--- a/panels/network/cc-network-panel.c
+++ b/panels/network/cc-network-panel.c
@@ -237,7 +237,7 @@ cc_network_panel_get_help_uri (CcPanel *panel)
}
static void
-object_removed_cb (NetObject *object, CcNetworkPanel *panel)
+object_removed_cb (CcNetworkPanel *panel, NetObject *object)
{
GtkWidget *stack;
@@ -545,7 +545,7 @@ panel_add_device (CcNetworkPanel *panel, NMDevice *device)
update_simple_section (panel);
g_signal_connect_object (net_device, "removed",
- G_CALLBACK (object_removed_cb), panel, 0);
+ G_CALLBACK (object_removed_cb), panel, G_CONNECT_SWAPPED);
}
static void
@@ -560,7 +560,7 @@ panel_remove_device (CcNetworkPanel *panel, NMDevice *device)
return;
/* NMObject will not fire the "removed" signal, so handle the UI removal explicitly */
- object_removed_cb (object, panel);
+ object_removed_cb (panel, object);
g_ptr_array_remove (panel->devices, object);
/* update vpn widgets */
@@ -591,19 +591,18 @@ panel_add_proxy_device (CcNetworkPanel *panel)
}
static void
-connection_state_changed (NMActiveConnection *c, GParamSpec *pspec, CcNetworkPanel *panel)
+connection_state_changed (CcNetworkPanel *panel)
{
}
static void
-active_connections_changed (NMClient *client, GParamSpec *pspec, gpointer user_data)
+active_connections_changed (CcNetworkPanel *panel)
{
- CcNetworkPanel *panel = user_data;
const GPtrArray *connections;
int i, j;
g_debug ("Active connections changed:");
- connections = nm_client_get_active_connections (client);
+ connections = nm_client_get_active_connections (panel->client);
for (i = 0; connections && (i < connections->len); i++) {
NMActiveConnection *connection;
const GPtrArray *devices;
@@ -618,14 +617,14 @@ active_connections_changed (NMClient *client, GParamSpec *pspec, gpointer user_d
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, 0);
+ G_CALLBACK (connection_state_changed), panel,
G_CONNECT_SWAPPED);
g_object_set_data (G_OBJECT (connection), "has-state-changed-handler",
GINT_TO_POINTER (TRUE));
}
}
}
static void
-device_added_cb (NMClient *client, NMDevice *device, CcNetworkPanel *panel)
+device_added_cb (CcNetworkPanel *panel, NMDevice *device)
{
g_debug ("New device added");
panel_add_device (panel, device);
@@ -633,7 +632,7 @@ device_added_cb (NMClient *client, NMDevice *device, CcNetworkPanel *panel)
}
static void
-device_removed_cb (NMClient *client, NMDevice *device, CcNetworkPanel *panel)
+device_removed_cb (CcNetworkPanel *panel, NMDevice *device)
{
g_debug ("Device removed");
panel_remove_device (panel, device);
@@ -641,21 +640,20 @@ device_removed_cb (NMClient *client, NMDevice *device, CcNetworkPanel *panel)
}
static void
-manager_running (NMClient *client, GParamSpec *pspec, gpointer user_data)
+manager_running (CcNetworkPanel *panel)
{
const GPtrArray *devices;
int i;
NMDevice *device_tmp;
- CcNetworkPanel *panel = CC_NETWORK_PANEL (user_data);
/* clear all devices we added */
- if (!nm_client_get_nm_running (client)) {
+ if (!nm_client_get_nm_running (panel->client)) {
g_debug ("NM disappeared");
goto out;
}
g_debug ("coldplugging devices");
- devices = nm_client_get_devices (client);
+ devices = nm_client_get_devices (panel->client);
if (devices == NULL) {
g_debug ("No devices to add");
return;
@@ -711,7 +709,7 @@ panel_add_vpn_device (CcNetworkPanel *panel, NMConnection *connection)
"client", panel->client,
NULL);
g_signal_connect_object (net_vpn, "removed",
- G_CALLBACK (object_removed_cb), panel, 0);
+ G_CALLBACK (object_removed_cb), panel, G_CONNECT_SWAPPED);
/* add as a panel */
stack = add_device_stack (panel, NET_OBJECT (net_vpn));
@@ -752,9 +750,7 @@ add_connection (CcNetworkPanel *panel,
}
static void
-notify_connection_added_cb (NMClient *client,
- NMRemoteConnection *connection,
- CcNetworkPanel *panel)
+notify_connection_added_cb (CcNetworkPanel *panel, NMRemoteConnection *connection)
{
add_connection (panel, NM_CONNECTION (connection));
}
@@ -793,7 +789,7 @@ panel_check_network_manager_version (CcNetworkPanel *panel)
gtk_widget_show_all (box);
} else {
- manager_running (panel->client, NULL, panel);
+ manager_running (panel);
}
}
@@ -878,13 +874,13 @@ cc_network_panel_init (CcNetworkPanel *panel)
panel->client = cc_object_storage_get_object (CC_OBJECT_NMCLIENT);
g_signal_connect_object (panel->client, "notify::nm-running" ,
- G_CALLBACK (manager_running), panel, 0);
+ G_CALLBACK (manager_running), panel, G_CONNECT_SWAPPED);
g_signal_connect_object (panel->client, "notify::active-connections",
- G_CALLBACK (active_connections_changed), panel, 0);
+ G_CALLBACK (active_connections_changed), panel, G_CONNECT_SWAPPED);
g_signal_connect_object (panel->client, "device-added",
- G_CALLBACK (device_added_cb), panel, 0);
+ G_CALLBACK (device_added_cb), panel, G_CONNECT_SWAPPED);
g_signal_connect_object (panel->client, "device-removed",
- G_CALLBACK (device_removed_cb), panel, 0);
+ G_CALLBACK (device_removed_cb), panel, G_CONNECT_SWAPPED);
/* Setup ModemManager client */
system_bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
@@ -903,7 +899,7 @@ cc_network_panel_init (CcNetworkPanel *panel)
/* 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, 0);
+ G_CALLBACK (notify_connection_added_cb), panel, G_CONNECT_SWAPPED);
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (panel));
g_signal_connect_after (toplevel, "map", G_CALLBACK (on_toplevel_map), panel);
diff --git a/panels/network/cc-wifi-connection-row.c b/panels/network/cc-wifi-connection-row.c
index 84c8aee10..bd7b32f4a 100644
--- a/panels/network/cc-wifi-connection-row.c
+++ b/panels/network/cc-wifi-connection-row.c
@@ -481,8 +481,7 @@ cc_wifi_connection_row_class_init (CcWifiConnectionRowClass *klass)
}
static void
-configure_clicked_cb (GtkButton *btn,
- CcWifiConnectionRow *row)
+configure_clicked_cb (CcWifiConnectionRow *row)
{
g_signal_emit_by_name (row, "configure");
}
@@ -492,7 +491,7 @@ cc_wifi_connection_row_init (CcWifiConnectionRow *row)
{
gtk_widget_init_template (GTK_WIDGET (row));
- g_signal_connect (row->configure_button, "clicked", G_CALLBACK (configure_clicked_cb), row);
+ g_signal_connect_swapped (row->configure_button, "clicked", G_CALLBACK (configure_clicked_cb), row);
row->aps = g_ptr_array_new_with_free_func (g_object_unref);
diff --git a/panels/network/cc-wifi-panel.c b/panels/network/cc-wifi-panel.c
index c75a4d4ba..7f6ced7d3 100644
--- a/panels/network/cc-wifi-panel.c
+++ b/panels/network/cc-wifi-panel.c
@@ -423,18 +423,14 @@ verify_argv (CcWifiPanel *self,
/* Callbacks */
static void
-device_added_cb (NMClient *client,
- NMDevice *device,
- CcWifiPanel *self)
+device_added_cb (CcWifiPanel *self, NMDevice *device)
{
add_wifi_device (self, device);
check_main_stack_page (self);
}
static void
-device_removed_cb (NMClient *client,
- NMDevice *device,
- CcWifiPanel *self)
+device_removed_cb (CcWifiPanel *self, NMDevice *device)
{
GtkWidget *child;
const gchar *id;
@@ -472,18 +468,13 @@ device_removed_cb (NMClient *client,
}
static void
-wireless_enabled_cb (NMClient *client,
- NMDevice *device,
- CcWifiPanel *self)
+wireless_enabled_cb (CcWifiPanel *self)
{
check_main_stack_page (self);
}
static void
-on_rfkill_proxy_properties_changed_cb (GDBusProxy *proxy,
- GVariant *changed_properties,
- GStrv invalidated_properties,
- CcWifiPanel *self)
+on_rfkill_proxy_properties_changed_cb (CcWifiPanel *self)
{
g_debug ("Rfkill properties changed");
@@ -517,7 +508,7 @@ rfkill_proxy_acquired_cb (GObject *source_object,
"g-properties-changed",
G_CALLBACK (on_rfkill_proxy_properties_changed_cb),
self,
- 0);
+ G_CONNECT_SWAPPED);
sync_airplane_mode_switch (self);
}
@@ -742,19 +733,19 @@ cc_wifi_panel_init (CcWifiPanel *self)
"device-added",
G_CALLBACK (device_added_cb),
self,
- 0);
+ G_CONNECT_SWAPPED);
g_signal_connect_object (self->client,
"device-removed",
G_CALLBACK (device_removed_cb),
self,
- 0);
+ G_CONNECT_SWAPPED);
g_signal_connect_object (self->client,
"notify::wireless-enabled",
G_CALLBACK (wireless_enabled_cb),
self,
- 0);
+ G_CONNECT_SWAPPED);
/* Load Wi-Fi devices */
load_wifi_devices (self);
diff --git a/panels/network/connection-editor/ce-page-8021x-security.c
b/panels/network/connection-editor/ce-page-8021x-security.c
index 764041876..072a7692a 100644
--- a/panels/network/connection-editor/ce-page-8021x-security.c
+++ b/panels/network/connection-editor/ce-page-8021x-security.c
@@ -37,10 +37,8 @@
G_DEFINE_TYPE (CEPage8021xSecurity, ce_page_8021x_security, CE_TYPE_PAGE)
static void
-enable_toggled (GObject *sw, GParamSpec *pspec, gpointer user_data)
+enable_toggled (CEPage8021xSecurity *page)
{
- CEPage8021xSecurity *page = CE_PAGE_8021X_SECURITY (user_data);
-
gtk_widget_set_sensitive (page->security_widget, gtk_switch_get_active (page->enabled));
ce_page_changed (CE_PAGE (page));
}
@@ -79,7 +77,7 @@ finish_setup (CEPage8021xSecurity *page, gpointer unused, GError *error, gpointe
gtk_container_remove (GTK_CONTAINER (parent), page->security_widget);
gtk_switch_set_active (page->enabled, page->initial_have_8021x);
- g_signal_connect (page->enabled, "notify::active", G_CALLBACK (enable_toggled), page);
+ g_signal_connect_swapped (page->enabled, "notify::active", G_CALLBACK (enable_toggled), page);
gtk_widget_set_sensitive (page->security_widget, page->initial_have_8021x);
gtk_size_group_add_widget (page->group, heading);
diff --git a/panels/network/connection-editor/ce-page-details.c
b/panels/network/connection-editor/ce-page-details.c
index 0c90a8e9f..a3c04632e 100644
--- a/panels/network/connection-editor/ce-page-details.c
+++ b/panels/network/connection-editor/ce-page-details.c
@@ -32,7 +32,7 @@
G_DEFINE_TYPE (CEPageDetails, ce_page_details, CE_TYPE_PAGE)
static void
-forget_cb (GtkButton *button, CEPageDetails *page)
+forget_cb (CEPageDetails *page)
{
net_connection_editor_forget (page->editor);
}
@@ -116,13 +116,13 @@ out:
}
static void
-all_user_changed (GtkToggleButton *b, CEPageDetails *page)
+all_user_changed (CEPageDetails *page)
{
gboolean all_users;
NMSettingConnection *sc;
sc = nm_connection_get_setting_connection (CE_PAGE (page)->connection);
- all_users = gtk_toggle_button_get_active (b);
+ all_users = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON ((gtk_builder_get_object (CE_PAGE
(page)->builder, "all_user_check"))));
g_object_set (sc, "permissions", NULL, NULL);
if (!all_users)
@@ -130,14 +130,14 @@ all_user_changed (GtkToggleButton *b, CEPageDetails *page)
}
static void
-restrict_data_changed (GtkToggleButton *toggle, GParamSpec *pspec, CEPageDetails *page)
+restrict_data_changed (CEPageDetails *page)
{
NMSettingConnection *s_con;
NMMetered metered;
s_con = nm_connection_get_setting_connection (CE_PAGE (page)->connection);
- if (gtk_toggle_button_get_active (toggle))
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (gtk_builder_get_object (CE_PAGE
(page)->builder, "restrict_data_check"))))
metered = NM_METERED_YES;
else
metered = NM_METERED_NO;
@@ -171,7 +171,7 @@ update_restrict_data (CEPageDetails *page)
metered == NM_METERED_YES || metered == NM_METERED_GUESS_YES);
gtk_widget_show (widget);
- g_signal_connect (widget, "notify::active", G_CALLBACK (restrict_data_changed), page);
+ g_signal_connect_swapped (widget, "notify::active", G_CALLBACK (restrict_data_changed), page);
g_signal_connect_swapped (widget, "notify::active", G_CALLBACK (ce_page_changed), page);
}
@@ -299,8 +299,8 @@ connect_details_page (CEPageDetails *page)
"all_user_check"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget),
nm_setting_connection_get_num_permissions (sc) == 0);
- g_signal_connect (widget, "toggled",
- G_CALLBACK (all_user_changed), page);
+ g_signal_connect_swapped (widget, "toggled",
+ G_CALLBACK (all_user_changed), page);
g_signal_connect_swapped (widget, "toggled", G_CALLBACK (ce_page_changed), page);
/* Restrict Data check */
@@ -308,7 +308,7 @@ connect_details_page (CEPageDetails *page)
/* Forget button */
widget = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "button_forget"));
- g_signal_connect (widget, "clicked", G_CALLBACK (forget_cb), page);
+ g_signal_connect_swapped (widget, "clicked", G_CALLBACK (forget_cb), page);
if (g_str_equal (type, NM_SETTING_WIRELESS_SETTING_NAME))
gtk_button_set_label (GTK_BUTTON (widget), _("Forget Connection"));
diff --git a/panels/network/connection-editor/ce-page-ethernet.c
b/panels/network/connection-editor/ce-page-ethernet.c
index dd57fc30b..ccaa25d3e 100644
--- a/panels/network/connection-editor/ce-page-ethernet.c
+++ b/panels/network/connection-editor/ce-page-ethernet.c
@@ -34,38 +34,36 @@
G_DEFINE_TYPE (CEPageEthernet, ce_page_ethernet, CE_TYPE_PAGE)
static void
-mtu_changed (GtkSpinButton *mtu, CEPageEthernet *page)
+mtu_changed (CEPageEthernet *page)
{
- if (gtk_spin_button_get_value_as_int (mtu) == 0)
+ if (gtk_spin_button_get_value_as_int (page->mtu) == 0)
gtk_widget_hide (page->mtu_label);
else
gtk_widget_show (page->mtu_label);
}
-static gint
-ce_spin_output_with_default (GtkSpinButton *spin, gpointer user_data)
+static void
+mtu_output_cb (CEPageEthernet *page)
{
- gint defvalue = GPOINTER_TO_INT (user_data);
+ gint defvalue;
gint val;
g_autofree gchar *buf = NULL;
- val = gtk_spin_button_get_value_as_int (spin);
+ val = gtk_spin_button_get_value_as_int (page->mtu);
+ defvalue = ce_get_property_default (NM_SETTING (page->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 (spin))))
- gtk_entry_set_text (GTK_ENTRY (spin), buf);
-
- return TRUE;
+ if (strcmp (buf, gtk_entry_get_text (GTK_ENTRY (page->mtu))))
+ gtk_entry_set_text (GTK_ENTRY (page->mtu), buf);
}
static void
connect_ethernet_page (CEPageEthernet *page)
{
NMSettingWired *setting = page->setting_wired;
- int mtu_def;
char **mac_list;
const char *s_mac_str;
const gchar *name;
@@ -88,14 +86,10 @@ connect_ethernet_page (CEPageEthernet *page)
g_signal_connect_swapped (page->cloned_mac, "changed", G_CALLBACK (ce_page_changed), page);
/* MTU */
- mtu_def = ce_get_property_default (NM_SETTING (setting), NM_SETTING_WIRED_MTU);
- g_signal_connect (page->mtu, "output",
- G_CALLBACK (ce_spin_output_with_default),
- GINT_TO_POINTER (mtu_def));
+ 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 (page->mtu, "value-changed",
- G_CALLBACK (mtu_changed), page);
- mtu_changed (page->mtu, page);
+ g_signal_connect_swapped (page->mtu, "value-changed", G_CALLBACK (mtu_changed), page);
+ mtu_changed (page);
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);
diff --git a/panels/network/connection-editor/ce-page-ip4.c b/panels/network/connection-editor/ce-page-ip4.c
index c00765527..9cf694313 100644
--- a/panels/network/connection-editor/ce-page-ip4.c
+++ b/panels/network/connection-editor/ce-page-ip4.c
@@ -53,7 +53,7 @@ enum {
};
static void
-method_changed (GtkToggleButton *radio, CEPageIP4 *page)
+method_changed (CEPageIP4 *page)
{
gboolean addr_enabled;
gboolean dns_enabled;
@@ -79,14 +79,6 @@ method_changed (GtkToggleButton *radio, CEPageIP4 *page)
ce_page_changed (CE_PAGE (page));
}
-static void
-switch_toggled (GObject *object,
- GParamSpec *pspec,
- CEPage *page)
-{
- ce_page_changed (page);
-}
-
static void
update_row_sensitivity (CEPageIP4 *page, GtkWidget *list)
{
@@ -134,13 +126,13 @@ update_row_gateway_sensitivity (CEPageIP4 *page)
}
static void
-remove_row (GtkButton *button, CEPageIP4 *page)
+remove_row (CEPageIP4 *page)
{
GtkWidget *list;
GtkWidget *row;
GtkWidget *row_box;
- row_box = gtk_widget_get_parent (GTK_WIDGET (button));
+ row_box = gtk_widget_get_parent (GTK_WIDGET (CE_PAGE (page)->page));
row = gtk_widget_get_parent (row_box);
list = gtk_widget_get_parent (row);
@@ -246,7 +238,7 @@ 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 (delete_button, "clicked", G_CALLBACK (remove_row), page);
+ g_signal_connect_swapped (delete_button, "clicked", G_CALLBACK (remove_row), page);
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);
@@ -329,7 +321,7 @@ add_dns_section (CEPageIP4 *page)
page->auto_dns = GTK_SWITCH (gtk_builder_get_object (CE_PAGE (page)->builder, "auto_dns_switch"));
gtk_switch_set_active (page->auto_dns, !nm_setting_ip_config_get_ignore_auto_dns (page->setting));
- g_signal_connect (page->auto_dns, "notify::active", G_CALLBACK (switch_toggled), page);
+ g_signal_connect_swapped (page->auto_dns, "notify::active", G_CALLBACK (ce_page_changed), page);
page->dns_entry = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "dns_entry"));
entry = GTK_ENTRY (page->dns_entry);
@@ -416,7 +408,7 @@ add_route_row (CEPageIP4 *page,
delete_button = gtk_button_new ();
gtk_style_context_add_class (gtk_widget_get_style_context (delete_button), "image-button");
- g_signal_connect (delete_button, "clicked", G_CALLBACK (remove_row), page);
+ g_signal_connect_swapped (delete_button, "clicked", G_CALLBACK (remove_row), page);
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);
@@ -469,7 +461,7 @@ add_routes_section (CEPageIP4 *page)
gtk_container_add (GTK_CONTAINER (widget), list);
page->auto_routes = GTK_SWITCH (gtk_builder_get_object (CE_PAGE (page)->builder,
"auto_routes_switch"));
gtk_switch_set_active (page->auto_routes, !nm_setting_ip_config_get_ignore_auto_routes
(page->setting));
- g_signal_connect (page->auto_routes, "notify::active", G_CALLBACK (switch_toggled), page);
+ g_signal_connect_swapped (page->auto_routes, "notify::active", G_CALLBACK (ce_page_changed), page);
for (i = 0; i < nm_setting_ip_config_get_num_routes (page->setting); i++) {
@@ -552,7 +544,7 @@ connect_ip4_page (CEPageIP4 *page)
radios[RADIO_DISABLED] = page->disabled;
for (i = RADIO_AUTOMATIC; i < RADIO_DISABLED; i++)
- g_signal_connect (radios[i], "toggled", G_CALLBACK (method_changed), page);
+ g_signal_connect_swapped (radios[i], "toggled", G_CALLBACK (method_changed), page);
switch (method) {
case IP4_METHOD_AUTO:
@@ -571,7 +563,7 @@ connect_ip4_page (CEPageIP4 *page)
break;
}
- method_changed (NULL, page);
+ method_changed (page);
}
static gboolean
diff --git a/panels/network/connection-editor/ce-page-ip6.c b/panels/network/connection-editor/ce-page-ip6.c
index c2d6649e4..a76df6bdc 100644
--- a/panels/network/connection-editor/ce-page-ip6.c
+++ b/panels/network/connection-editor/ce-page-ip6.c
@@ -54,7 +54,7 @@ enum {
};
static void
-method_changed (GtkToggleButton *button, CEPageIP6 *page)
+method_changed (CEPageIP6 *page)
{
gboolean addr_enabled;
gboolean dns_enabled;
@@ -80,14 +80,6 @@ method_changed (GtkToggleButton *button, CEPageIP6 *page)
ce_page_changed (CE_PAGE (page));
}
-static void
-switch_toggled (GObject *object,
- GParamSpec *pspec,
- CEPage *page)
-{
- ce_page_changed (page);
-}
-
static void
update_row_sensitivity (CEPageIP6 *page, GtkWidget *list)
{
@@ -115,13 +107,13 @@ update_row_sensitivity (CEPageIP6 *page, GtkWidget *list)
}
static void
-remove_row (GtkButton *button, CEPageIP6 *page)
+remove_row (CEPageIP6 *page)
{
GtkWidget *row;
GtkWidget *row_box;
GtkWidget *list;
- row_box = gtk_widget_get_parent (GTK_WIDGET (button));
+ row_box = gtk_widget_get_parent (GTK_WIDGET (CE_PAGE (page)->page));
row = gtk_widget_get_parent (row_box);
list = gtk_widget_get_parent (row);
@@ -225,7 +217,7 @@ 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 (delete_button, "clicked", G_CALLBACK (remove_row), page);
+ g_signal_connect_swapped (delete_button, "clicked", G_CALLBACK (remove_row), page);
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);
@@ -299,7 +291,7 @@ add_dns_section (CEPageIP6 *page)
page->auto_dns = GTK_SWITCH (gtk_builder_get_object (CE_PAGE (page)->builder, "auto_dns_switch"));
gtk_switch_set_active (page->auto_dns, !nm_setting_ip_config_get_ignore_auto_dns (page->setting));
- g_signal_connect (page->auto_dns, "notify::active", G_CALLBACK (switch_toggled), page);
+ g_signal_connect_swapped (page->auto_dns, "notify::active", G_CALLBACK (ce_page_changed), page);
page->dns_entry = GTK_WIDGET (gtk_builder_get_object (CE_PAGE (page)->builder, "dns_entry"));
entry = GTK_ENTRY (page->dns_entry);
@@ -384,7 +376,7 @@ add_route_row (CEPageIP6 *page,
delete_button = gtk_button_new ();
gtk_style_context_add_class (gtk_widget_get_style_context (delete_button), "image-button");
- g_signal_connect (delete_button, "clicked", G_CALLBACK (remove_row), page);
+ g_signal_connect_swapped (delete_button, "clicked", G_CALLBACK (remove_row), page);
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);
@@ -443,7 +435,7 @@ add_routes_section (CEPageIP6 *page)
gtk_container_add (GTK_CONTAINER (widget), list);
page->auto_routes = GTK_SWITCH (gtk_builder_get_object (CE_PAGE (page)->builder,
"auto_routes_switch"));
gtk_switch_set_active (page->auto_routes, !nm_setting_ip_config_get_ignore_auto_routes
(page->setting));
- g_signal_connect (page->auto_routes, "notify::active", G_CALLBACK (switch_toggled), page);
+ g_signal_connect_swapped (page->auto_routes, "notify::active", G_CALLBACK (ce_page_changed), page);
for (i = 0; i < nm_setting_ip_config_get_num_routes (page->setting); i++) {
NMIPRoute *route;
@@ -525,7 +517,7 @@ connect_ip6_page (CEPageIP6 *page)
radios[RADIO_DISABLED] = page->disabled;
for (i = RADIO_AUTOMATIC; i < RADIO_DISABLED; i++)
- g_signal_connect (radios[i], "toggled", G_CALLBACK (method_changed), page);
+ g_signal_connect_swapped (radios[i], "toggled", G_CALLBACK (method_changed), page);
switch (method) {
case IP6_METHOD_AUTO:
@@ -547,7 +539,7 @@ connect_ip6_page (CEPageIP6 *page)
break;
}
- method_changed (NULL, page);
+ method_changed (page);
}
static gboolean
diff --git a/panels/network/connection-editor/ce-page-security.c
b/panels/network/connection-editor/ce-page-security.c
index f5c71a761..676f4f9ba 100644
--- a/panels/network/connection-editor/ce-page-security.c
+++ b/panels/network/connection-editor/ce-page-security.c
@@ -124,10 +124,8 @@ wsec_size_group_clear (GtkSizeGroup *group)
}
static void
-security_combo_changed (GtkComboBox *combo,
- gpointer user_data)
+security_combo_changed (CEPageSecurity *page)
{
- CEPageSecurity *page = CE_PAGE_SECURITY (user_data);
GtkWidget *vbox;
GList *l, *children;
g_autoptr(WirelessSecurity) sec = NULL;
@@ -352,9 +350,9 @@ finish_setup (CEPageSecurity *page)
page->security_combo = combo;
- security_combo_changed (combo, page);
- g_signal_connect (combo, "changed",
- G_CALLBACK (security_combo_changed), page);
+ security_combo_changed (page);
+ g_signal_connect_swapped (combo, "changed",
+ G_CALLBACK (security_combo_changed), page);
}
static gboolean
diff --git a/panels/network/connection-editor/net-connection-editor.c
b/panels/network/connection-editor/net-connection-editor.c
index 1db3880ff..869868b26 100644
--- a/panels/network/connection-editor/net-connection-editor.c
+++ b/panels/network/connection-editor/net-connection-editor.c
@@ -49,7 +49,7 @@ static guint signals[LAST_SIGNAL] = { 0 };
G_DEFINE_TYPE (NetConnectionEditor, net_connection_editor, GTK_TYPE_DIALOG)
-static void page_changed (CEPage *page, gpointer user_data);
+static void page_changed (NetConnectionEditor *editor);
static void
cancel_editing (NetConnectionEditor *editor)
@@ -349,10 +349,8 @@ done:
}
static void
-page_changed (CEPage *page, gpointer user_data)
+page_changed (NetConnectionEditor *editor)
{
- NetConnectionEditor *editor= user_data;
-
if (editor_is_initialized (editor))
editor->is_changed = TRUE;
validate (editor);
@@ -381,7 +379,7 @@ recheck_initialization (NetConnectionEditor *editor)
}
static void
-page_initialized (CEPage *page, GError *error, NetConnectionEditor *editor)
+page_initialized (NetConnectionEditor *editor, GError *error, CEPage *page)
{
GtkWidget *widget;
GtkWidget *label;
@@ -467,8 +465,8 @@ add_page (NetConnectionEditor *editor, CEPage *page)
editor->initializing_pages = g_slist_append (editor->initializing_pages, page);
- g_signal_connect (page, "changed", G_CALLBACK (page_changed), editor);
- g_signal_connect (page, "initialized", G_CALLBACK (page_initialized), editor);
+ g_signal_connect_swapped (page, "changed", G_CALLBACK (page_changed), editor);
+ g_signal_connect_swapped (page, "initialized", G_CALLBACK (page_initialized), editor);
}
static void
diff --git a/panels/network/net-device-ethernet.c b/panels/network/net-device-ethernet.c
index e4239891b..5d471ae85 100644
--- a/panels/network/net-device-ethernet.c
+++ b/panels/network/net-device-ethernet.c
@@ -231,15 +231,13 @@ device_ethernet_refresh_ui (NetDeviceEthernet *device)
}
static void
-editor_done (NetConnectionEditor *editor,
- gboolean success,
- NetDeviceEthernet *device)
+editor_done (NetDeviceEthernet *device)
{
device_ethernet_refresh_ui (device);
}
static void
-show_details (GtkButton *button, NetDeviceEthernet *device, const gchar *title)
+show_details (NetDeviceEthernet *device, GtkButton *button, const gchar *title)
{
GtkWidget *row;
NMConnection *connection;
@@ -248,7 +246,7 @@ show_details (GtkButton *button, NetDeviceEthernet *device, const gchar *title)
NMClient *client;
NMDevice *nmdev;
- window = gtk_widget_get_toplevel (GTK_WIDGET (button));
+ window = gtk_widget_get_toplevel (GTK_WIDGET (gtk_builder_get_object (device->builder, "vbox6")));
row = g_object_get_data (G_OBJECT (button), "row");
connection = NM_CONNECTION (g_object_get_data (G_OBJECT (row), "connection"));
@@ -258,25 +256,25 @@ show_details (GtkButton *button, NetDeviceEthernet *device, const gchar *title)
editor = net_connection_editor_new (GTK_WINDOW (window), connection, nmdev, NULL, client);
if (title)
net_connection_editor_set_title (editor, title);
- g_signal_connect (editor, "done", G_CALLBACK (editor_done), device);
+ g_signal_connect_swapped (editor, "done", G_CALLBACK (editor_done), device);
net_connection_editor_run (editor);
}
static void
-show_details_for_row (GtkButton *button, NetDeviceEthernet *device)
+show_details_for_row (NetDeviceEthernet *device, GtkButton *button)
{
- show_details (button, device, NULL);
+ show_details (device, button, NULL);
}
static void
-show_details_for_wired (GtkButton *button, NetDeviceEthernet *device)
+show_details_for_wired (NetDeviceEthernet *device)
{
/* 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 (button, device, _("Wired"));
+ show_details (device, GTK_BUTTON (device->details_button), _("Wired"));
}
static void
@@ -348,8 +346,7 @@ 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 (widget, "clicked",
- G_CALLBACK (show_details_for_row), device);
+ g_signal_connect_swapped (widget, "clicked", G_CALLBACK (show_details_for_row), device);
gtk_widget_show_all (row);
@@ -359,9 +356,7 @@ add_row (NetDeviceEthernet *device, NMConnection *connection)
}
static void
-connection_removed (NMClient *client,
- NMRemoteConnection *connection,
- NetDeviceEthernet *device)
+connection_removed (NetDeviceEthernet *device, NMRemoteConnection *connection)
{
if (g_hash_table_remove (device->connections, connection))
device_ethernet_refresh_ui (device);
@@ -413,15 +408,13 @@ populate_ui (NetDeviceEthernet *device)
}
static void
-client_connection_added_cb (NMClient *client,
- NMRemoteConnection *connection,
- NetDeviceEthernet *device)
+client_connection_added_cb (NetDeviceEthernet *device)
{
device_ethernet_refresh_ui (device);
}
static void
-add_profile (GtkButton *button, NetDeviceEthernet *device)
+add_profile (NetDeviceEthernet *device)
{
NMConnection *connection;
NMSettingConnection *sc;
@@ -452,18 +445,16 @@ add_profile (GtkButton *button, NetDeviceEthernet *device)
nm_connection_add_setting (connection, nm_setting_wired_new ());
- window = gtk_widget_get_toplevel (GTK_WIDGET (button));
+ window = gtk_widget_get_toplevel (GTK_WIDGET (gtk_builder_get_object (device->builder, "vbox6")));
nmdev = net_device_get_nm_device (NET_DEVICE (device));
editor = net_connection_editor_new (GTK_WINDOW (window), connection, nmdev, NULL, client);
- g_signal_connect (editor, "done", G_CALLBACK (editor_done), device);
+ g_signal_connect_swapped (editor, "done", G_CALLBACK (editor_done), device);
net_connection_editor_run (editor);
}
static void
-device_off_toggled (GtkSwitch *sw,
- GParamSpec *pspec,
- NetDeviceEthernet *device)
+device_off_toggled (NetDeviceEthernet *device)
{
NMClient *client;
NMDevice *nm_device;
@@ -475,7 +466,7 @@ device_off_toggled (GtkSwitch *sw,
client = net_object_get_client (NET_OBJECT (device));
nm_device = net_device_get_nm_device (NET_DEVICE (device));
- if (gtk_switch_get_active (sw)) {
+ if (gtk_switch_get_active (GTK_SWITCH (gtk_builder_get_object (device->builder,
"device_off_switch")))) {
connection = net_device_get_find_connection (NET_DEVICE (device));
if (connection != NULL) {
nm_client_activate_connection_async (client,
@@ -489,15 +480,13 @@ device_off_toggled (GtkSwitch *sw,
}
static void
-device_title_changed (NetDeviceEthernet *device,
- GParamSpec *pspec,
- gpointer user_data)
+device_title_changed (NetDeviceEthernet *device)
{
device_ethernet_refresh_ui (device);
}
static void
-connection_activated (GtkListBox *list, GtkListBoxRow *row, NetDeviceEthernet *device)
+connection_activated (NetDeviceEthernet *device, GtkListBoxRow *row)
{
NMClient *client;
NMDevice *nm_device;
@@ -529,33 +518,33 @@ device_ethernet_constructed (GObject *object)
widget = GTK_WIDGET (gtk_builder_get_object (device->builder,
"device_off_switch"));
- g_signal_connect (widget, "notify::active",
- G_CALLBACK (device_off_toggled), device);
+ g_signal_connect_swapped (widget, "notify::active",
+ G_CALLBACK (device_off_toggled), device);
device->scrolled_window = swin = GTK_WIDGET (gtk_builder_get_object (device->builder, "list"));
device->list = list = GTK_WIDGET (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_container_add (GTK_CONTAINER (swin), list);
- g_signal_connect (list, "row-activated",
- G_CALLBACK (connection_activated), device);
+ g_signal_connect_swapped (list, "row-activated",
+ G_CALLBACK (connection_activated), device);
gtk_widget_show (list);
device->details = GTK_WIDGET (gtk_builder_get_object (device->builder, "details"));
device->details_button = GTK_WIDGET (gtk_builder_get_object (device->builder, "details_button"));
- g_signal_connect (device->details_button, "clicked",
- G_CALLBACK (show_details_for_wired), device);
+ g_signal_connect_swapped (device->details_button, "clicked",
+ G_CALLBACK (show_details_for_wired), device);
device->add_profile_button = GTK_WIDGET (gtk_builder_get_object (device->builder,
"add_profile_button"));
- g_signal_connect (device->add_profile_button, "clicked",
- G_CALLBACK (add_profile), device);
+ g_signal_connect_swapped (device->add_profile_button, "clicked",
+ G_CALLBACK (add_profile), device);
client = net_object_get_client (NET_OBJECT (object));
g_signal_connect_object (client, NM_CLIENT_CONNECTION_ADDED,
- G_CALLBACK (client_connection_added_cb), object, 0);
+ G_CALLBACK (client_connection_added_cb), object, G_CONNECT_SWAPPED);
g_signal_connect_object (client, NM_CLIENT_CONNECTION_REMOVED,
- G_CALLBACK (connection_removed), device, 0);
+ G_CALLBACK (connection_removed), device, G_CONNECT_SWAPPED);
device_ethernet_refresh_ui (device);
}
diff --git a/panels/network/net-device-mobile.c b/panels/network/net-device-mobile.c
index 59b40b874..48dfa86d3 100644
--- a/panels/network/net-device-mobile.c
+++ b/panels/network/net-device-mobile.c
@@ -102,7 +102,7 @@ connection_activate_cb (GObject *source_object,
}
static void
-mobile_connection_changed_cb (GtkComboBox *combo_box, NetDeviceMobile *device_mobile)
+mobile_connection_changed_cb (NetDeviceMobile *device_mobile)
{
gboolean ret;
g_autofree gchar *object_path = NULL;
@@ -117,7 +117,7 @@ mobile_connection_changed_cb (GtkComboBox *combo_box, NetDeviceMobile *device_mo
if (device_mobile->updating_device)
return;
- ret = gtk_combo_box_get_active_iter (combo_box, &iter);
+ ret = gtk_combo_box_get_active_iter (GTK_COMBO_BOX (gtk_builder_get_object (device_mobile->builder,
"combobox_network")), &iter);
if (!ret)
return;
@@ -127,7 +127,7 @@ mobile_connection_changed_cb (GtkComboBox *combo_box, NetDeviceMobile *device_mo
client = net_object_get_client (NET_OBJECT (device_mobile));
/* get entry */
- model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo_box));
+ model = gtk_combo_box_get_model (GTK_COMBO_BOX (gtk_builder_get_object (device_mobile->builder,
"combobox_network")));
gtk_tree_model_get (model, &iter,
COLUMN_ID, &object_path,
-1);
@@ -155,9 +155,7 @@ mobile_connection_changed_cb (GtkComboBox *combo_box, NetDeviceMobile *device_mo
}
static void
-mobilebb_enabled_toggled (NMClient *client,
- GParamSpec *pspec,
- NetDeviceMobile *device_mobile)
+mobilebb_enabled_toggled (NetDeviceMobile *device_mobile)
{
gboolean enabled = FALSE;
GtkSwitch *sw;
@@ -167,7 +165,7 @@ mobilebb_enabled_toggled (NMClient *client,
if (nm_device_get_device_type (device) != NM_DEVICE_TYPE_MODEM)
return;
- if (nm_client_wwan_get_enabled (client)) {
+ if (nm_client_wwan_get_enabled (net_object_get_client (NET_OBJECT (device_mobile)))) {
NMDeviceState state;
state = nm_device_get_state (device);
@@ -379,7 +377,6 @@ nm_device_mobile_refresh_ui (NetDeviceMobile *device_mobile)
gboolean is_connected;
GtkListStore *liststore;
GtkWidget *widget;
- NMClient *client;
NMDeviceModemCapabilities caps;
NMDevice *nm_device;
g_autofree gchar *status = NULL;
@@ -393,8 +390,7 @@ nm_device_mobile_refresh_ui (NetDeviceMobile *device_mobile)
/* set up the device on/off switch */
widget = GTK_WIDGET (gtk_builder_get_object (device_mobile->builder, "device_off_switch"));
gtk_widget_show (widget);
- client = net_object_get_client (NET_OBJECT (device_mobile));
- mobilebb_enabled_toggled (client, NULL, device_mobile);
+ mobilebb_enabled_toggled (device_mobile);
/* set device state, with status */
widget = GTK_WIDGET (gtk_builder_get_object (device_mobile->builder, "label_status"));
@@ -444,9 +440,7 @@ device_mobile_refresh (NetObject *object)
}
static void
-device_off_toggled (GtkSwitch *sw,
- GParamSpec *pspec,
- NetDeviceMobile *device_mobile)
+device_off_toggled (NetDeviceMobile *device_mobile)
{
const GPtrArray *acs;
gboolean active;
@@ -458,7 +452,7 @@ device_off_toggled (GtkSwitch *sw,
if (device_mobile->updating_device)
return;
- active = gtk_switch_get_active (sw);
+ active = gtk_switch_get_active (GTK_SWITCH (gtk_builder_get_object (device_mobile->builder,
"device_off_switch")));
if (active) {
client = net_object_get_client (NET_OBJECT (device_mobile));
connection = net_device_get_find_connection (NET_DEVICE (device_mobile));
@@ -488,7 +482,7 @@ device_off_toggled (GtkSwitch *sw,
}
static void
-edit_connection (GtkButton *button, NetDeviceMobile *device_mobile)
+edit_connection (NetDeviceMobile *device_mobile)
{
net_object_edit (NET_OBJECT (device_mobile));
}
@@ -581,16 +575,14 @@ device_mobile_get_registration_info_cb (GObject *source_object,
}
static void
-device_mobile_gsm_signal_cb (GDBusProxy *proxy,
- gchar *sender_name,
- gchar *signal_name,
- GVariant *parameters,
- gpointer user_data)
+device_mobile_gsm_signal_cb (NetDeviceMobile *device_mobile,
+ const gchar *sender_name,
+ const gchar *signal_name,
+ GVariant *parameters)
{
guint registration_status = 0;
g_autofree gchar *operator_code = NULL;
g_autofree gchar *operator_name = NULL;
- NetDeviceMobile *device_mobile = (NetDeviceMobile *)user_data;
if (!g_str_equal (signal_name, "RegistrationInfo"))
return;
@@ -629,10 +621,10 @@ device_mobile_device_got_modem_manager_gsm_cb (GObject *source_object,
}
/* Setup value updates */
- g_signal_connect (device_mobile->gsm_proxy,
- "g-signal",
- G_CALLBACK (device_mobile_gsm_signal_cb),
- device_mobile);
+ g_signal_connect_swapped (device_mobile->gsm_proxy,
+ "g-signal",
+ G_CALLBACK (device_mobile_gsm_signal_cb),
+ device_mobile);
/* Load initial value */
g_dbus_proxy_call (device_mobile->gsm_proxy,
@@ -766,14 +758,12 @@ net_device_mobile_constructed (GObject *object)
client = net_object_get_client (NET_OBJECT (device_mobile));
g_signal_connect_object (client, "notify::wwan-enabled",
G_CALLBACK (mobilebb_enabled_toggled),
- device_mobile, 0);
+ device_mobile, G_CONNECT_SWAPPED);
nm_device_mobile_refresh_ui (device_mobile);
}
static void
-operator_name_updated (MMModem3gpp *modem_3gpp_iface,
- GParamSpec *pspec,
- NetDeviceMobile *self)
+operator_name_updated (NetDeviceMobile *self)
{
device_mobile_refresh_operator_name (self);
}
@@ -793,10 +783,10 @@ net_device_mobile_setup_modem_object (NetDeviceMobile *self)
modem_3gpp = mm_object_peek_modem_3gpp (self->mm_object);
if (modem_3gpp != NULL) {
g_assert (self->operator_name_updated == 0);
- self->operator_name_updated = g_signal_connect (modem_3gpp,
- "notify::operator-name",
- G_CALLBACK (operator_name_updated),
- self);
+ self->operator_name_updated = g_signal_connect_swapped (modem_3gpp,
+ "notify::operator-name",
+ G_CALLBACK (operator_name_updated),
+ self);
device_mobile_refresh_operator_name (self);
}
}
@@ -901,9 +891,9 @@ net_device_mobile_init (NetDeviceMobile *device_mobile)
/* setup mobile combobox model */
combobox = GTK_COMBO_BOX (gtk_builder_get_object (device_mobile->builder,
"combobox_network"));
- g_signal_connect (combobox, "changed",
- G_CALLBACK (mobile_connection_changed_cb),
- device_mobile);
+ g_signal_connect_swapped (combobox, "changed",
+ G_CALLBACK (mobile_connection_changed_cb),
+ device_mobile);
renderer = gtk_cell_renderer_text_new ();
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox),
renderer,
@@ -914,11 +904,11 @@ net_device_mobile_init (NetDeviceMobile *device_mobile)
widget = GTK_WIDGET (gtk_builder_get_object (device_mobile->builder,
"device_off_switch"));
- g_signal_connect (widget, "notify::active",
- G_CALLBACK (device_off_toggled), device_mobile);
+ g_signal_connect_swapped (widget, "notify::active",
+ G_CALLBACK (device_off_toggled), device_mobile);
widget = GTK_WIDGET (gtk_builder_get_object (device_mobile->builder,
"button_options"));
- g_signal_connect (widget, "clicked",
- G_CALLBACK (edit_connection), device_mobile);
+ g_signal_connect_swapped (widget, "clicked",
+ G_CALLBACK (edit_connection), device_mobile);
}
diff --git a/panels/network/net-device-simple.c b/panels/network/net-device-simple.c
index 3a50bc7ec..fce761c9a 100644
--- a/panels/network/net-device-simple.c
+++ b/panels/network/net-device-simple.c
@@ -125,9 +125,7 @@ device_simple_refresh (NetObject *object)
}
static void
-device_off_toggled (GtkSwitch *sw,
- GParamSpec *pspec,
- NetDeviceSimple *device_simple)
+device_off_toggled (NetDeviceSimple *device_simple)
{
NetDeviceSimplePrivate *priv = net_device_simple_get_instance_private (device_simple);
const GPtrArray *acs;
@@ -140,7 +138,7 @@ device_off_toggled (GtkSwitch *sw,
if (priv->updating_device)
return;
- active = gtk_switch_get_active (sw);
+ active = gtk_switch_get_active (GTK_SWITCH (gtk_builder_get_object (priv->builder,
"device_off_switch")));
if (active) {
client = net_object_get_client (NET_OBJECT (device_simple));
connection = net_device_get_find_connection (NET_DEVICE (device_simple));
@@ -170,7 +168,7 @@ device_off_toggled (GtkSwitch *sw,
}
static void
-edit_connection (GtkButton *button, NetDeviceSimple *device_simple)
+edit_connection (NetDeviceSimple *device_simple)
{
net_object_edit (NET_OBJECT (device_simple));
}
@@ -235,13 +233,13 @@ net_device_simple_init (NetDeviceSimple *device_simple)
/* setup simple combobox model */
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
"device_off_switch"));
- g_signal_connect (widget, "notify::active",
- G_CALLBACK (device_off_toggled), device_simple);
+ g_signal_connect_swapped (widget, "notify::active",
+ G_CALLBACK (device_off_toggled), device_simple);
widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
"button_options"));
- g_signal_connect (widget, "clicked",
- G_CALLBACK (edit_connection), device_simple);
+ g_signal_connect_swapped (widget, "clicked",
+ G_CALLBACK (edit_connection), device_simple);
}
char *
diff --git a/panels/network/net-device-wifi.c b/panels/network/net-device-wifi.c
index 1126e1fc5..f009bd24f 100644
--- a/panels/network/net-device-wifi.c
+++ b/panels/network/net-device-wifi.c
@@ -49,7 +49,7 @@
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 (GtkListBox *list, GtkListBoxRow *row, NetDeviceWifi *device_wifi);
+static void ap_activated (NetDeviceWifi *device_wifi, 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 );
@@ -129,9 +129,7 @@ disable_scan_timeout (NetDeviceWifi *device_wifi)
}
static void
-wireless_enabled_toggled (NMClient *client,
- GParamSpec *pspec,
- NetDeviceWifi *device_wifi)
+wireless_enabled_toggled (NetDeviceWifi *device_wifi)
{
gboolean enabled;
GtkSwitch *sw;
@@ -141,7 +139,7 @@ wireless_enabled_toggled (NMClient *client,
if (nm_device_get_device_type (device) != NM_DEVICE_TYPE_WIFI)
return;
- enabled = nm_client_wireless_get_enabled (client);
+ enabled = nm_client_wireless_get_enabled (net_object_get_client (NET_OBJECT (device_wifi)));
sw = GTK_SWITCH (gtk_builder_get_object (device_wifi->builder,
"device_off_switch"));
@@ -422,7 +420,7 @@ nm_device_wifi_refresh_ui (NetDeviceWifi *device_wifi)
nm_device = net_device_get_nm_device (NET_DEVICE (device_wifi));
/* keep this in sync with the signal handler setup in cc_network_panel_init */
- wireless_enabled_toggled (client, NULL, device_wifi);
+ wireless_enabled_toggled (device_wifi);
widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->builder, "heading_status"));
status = panel_device_status_to_localized_string (nm_device, NULL);
@@ -440,9 +438,7 @@ device_wifi_refresh (NetObject *object)
}
static void
-device_off_toggled (GtkSwitch *sw,
- GParamSpec *pspec,
- NetDeviceWifi *device_wifi)
+device_off_toggled (NetDeviceWifi *device_wifi)
{
NMClient *client;
gboolean active;
@@ -451,7 +447,7 @@ device_off_toggled (GtkSwitch *sw,
return;
client = net_object_get_client (NET_OBJECT (device_wifi));
- active = gtk_switch_get_active (sw);
+ active = gtk_switch_get_active (GTK_SWITCH (gtk_builder_get_object (device_wifi->builder,
"device_off_switch")));
nm_client_wireless_set_enabled (client, active);
if (!active)
disable_scan_timeout (device_wifi);
@@ -781,7 +777,7 @@ overwrite_ssid_cb (GObject *source_object,
}
static void
-start_hotspot (GtkButton *button, NetDeviceWifi *device_wifi)
+start_hotspot (NetDeviceWifi *device_wifi)
{
NMDevice *device;
g_autofree gchar *active_ssid = NULL;
@@ -795,7 +791,7 @@ start_hotspot (GtkButton *button, NetDeviceWifi *device_wifi)
client = net_object_get_client (NET_OBJECT (device_wifi));
device = net_device_get_nm_device (NET_DEVICE (device_wifi));
- window = gtk_widget_get_toplevel (GTK_WIDGET (button));
+ window = gtk_widget_get_toplevel (GTK_WIDGET (gtk_builder_get_object (device_wifi->builder,
"notebook_view")));
if (!device_wifi->hotspot_dialog)
device_wifi->hotspot_dialog = cc_wifi_hotspot_dialog_new (GTK_WINDOW (window));
@@ -872,7 +868,7 @@ stop_shared_connection (NetDeviceWifi *device_wifi)
}
static void
-stop_hotspot_response_cb (GtkWidget *dialog, gint response, NetDeviceWifi *device_wifi)
+stop_hotspot_response_cb (NetDeviceWifi *device_wifi, gint response, GtkWidget *dialog)
{
if (response == GTK_RESPONSE_OK) {
stop_shared_connection (device_wifi);
@@ -885,9 +881,7 @@ stop_hotspot_response_cb (GtkWidget *dialog, gint response, NetDeviceWifi *devic
}
static void
-switch_hotspot_changed_cb (GtkSwitch *sw,
- GParamSpec *pspec,
- NetDeviceWifi *device_wifi)
+switch_hotspot_changed_cb (NetDeviceWifi *device_wifi)
{
GtkWidget *dialog;
GtkWidget *window;
@@ -907,8 +901,8 @@ switch_hotspot_changed_cb (GtkSwitch *sw,
_("_Cancel"), GTK_RESPONSE_CANCEL,
_("_Stop Hotspot"), GTK_RESPONSE_OK,
NULL);
- g_signal_connect (dialog, "response",
- G_CALLBACK (stop_hotspot_response_cb), device_wifi);
+ g_signal_connect_swapped (dialog, "response",
+ G_CALLBACK (stop_hotspot_response_cb), device_wifi);
gtk_window_present (GTK_WINDOW (dialog));
}
@@ -936,7 +930,7 @@ net_device_wifi_constructed (GObject *object)
client = net_object_get_client (NET_OBJECT (device_wifi));
g_signal_connect_object (client, "notify::wireless-enabled",
- G_CALLBACK (wireless_enabled_toggled), device_wifi, 0);
+ G_CALLBACK (wireless_enabled_toggled), device_wifi, G_CONNECT_SWAPPED);
nm_device = net_device_get_nm_device (NET_DEVICE (device_wifi));
@@ -948,8 +942,8 @@ net_device_wifi_constructed (GObject *object)
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 (list, "row-activated",
- G_CALLBACK (ap_activated), device_wifi);
+ g_signal_connect_swapped (list, "row-activated",
+ G_CALLBACK (ap_activated), device_wifi);
g_signal_connect_swapped (list, "configure",
G_CALLBACK (show_details_for_row),
device_wifi);
@@ -1367,7 +1361,7 @@ open_history (NetDeviceWifi *device_wifi)
}
static void
-ap_activated (GtkListBox *list, GtkListBoxRow *row, NetDeviceWifi *device_wifi)
+ap_activated (NetDeviceWifi *device_wifi, GtkListBoxRow *row)
{
CcWifiConnectionRow *c_row;
NMConnection *connection;
@@ -1426,8 +1420,8 @@ net_device_wifi_init (NetDeviceWifi *device_wifi)
/* setup wifi views */
widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->builder,
"device_off_switch"));
- g_signal_connect (widget, "notify::active",
- G_CALLBACK (device_off_toggled), device_wifi);
+ g_signal_connect_swapped (widget, "notify::active",
+ G_CALLBACK (device_off_toggled), device_wifi);
/* setup view */
widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->builder,
@@ -1437,8 +1431,8 @@ net_device_wifi_init (NetDeviceWifi *device_wifi)
widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->builder,
"start_hotspot_button"));
- g_signal_connect (widget, "clicked",
- G_CALLBACK (start_hotspot), device_wifi);
+ g_signal_connect_swapped (widget, "clicked",
+ G_CALLBACK (start_hotspot), device_wifi);
widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->builder,
"connect_hidden_button"));
@@ -1453,6 +1447,6 @@ net_device_wifi_init (NetDeviceWifi *device_wifi)
widget = GTK_WIDGET (gtk_builder_get_object (device_wifi->builder,
"switch_hotspot_off"));
device_wifi->hotspot_switch = GTK_SWITCH (widget);
- g_signal_connect (widget, "notify::active",
- G_CALLBACK (switch_hotspot_changed_cb), device_wifi);
+ g_signal_connect_swapped (widget, "notify::active",
+ G_CALLBACK (switch_hotspot_changed_cb), device_wifi);
}
diff --git a/panels/network/net-device.c b/panels/network/net-device.c
index 4c5c59426..eb3b9bb72 100644
--- a/panels/network/net-device.c
+++ b/panels/network/net-device.c
@@ -162,11 +162,7 @@ net_device_get_find_connection (NetDevice *device)
}
static void
-state_changed_cb (NMDevice *device,
- NMDeviceState new_state,
- NMDeviceState old_state,
- NMDeviceStateReason reason,
- NetDevice *net_device)
+state_changed_cb (NetDevice *net_device)
{
net_object_emit_changed (NET_OBJECT (net_device));
net_object_refresh (NET_OBJECT (net_device));
@@ -242,10 +238,10 @@ net_device_set_property (GObject *device_,
}
priv->nm_device = g_value_dup_object (value);
if (priv->nm_device) {
- priv->changed_id = g_signal_connect (priv->nm_device,
- "state-changed",
- G_CALLBACK (state_changed_cb),
- net_device);
+ priv->changed_id = g_signal_connect_swapped (priv->nm_device,
+ "state-changed",
+ G_CALLBACK (state_changed_cb),
+ net_device);
} else
priv->changed_id = 0;
break;
diff --git a/panels/network/net-proxy.c b/panels/network/net-proxy.c
index d5ebb7af7..5796d1afc 100644
--- a/panels/network/net-proxy.c
+++ b/panels/network/net-proxy.c
@@ -41,7 +41,7 @@ struct _NetProxy
GSettings *settings;
GtkBuilder *builder;
- GtkToggleButton *mode_radios[3];
+ GtkRadioButton *mode_radios[3];
};
G_DEFINE_TYPE (NetProxy, net_proxy, NET_TYPE_OBJECT)
@@ -119,9 +119,7 @@ out:
}
static void
-settings_changed_cb (GSettings *settings,
- const gchar *key,
- NetProxy *proxy)
+settings_changed_cb (NetProxy *proxy)
{
check_wpad_warning (proxy);
}
@@ -153,12 +151,11 @@ panel_proxy_mode_setup_widgets (NetProxy *proxy, ProxyMode value)
}
static void
-panel_proxy_mode_radio_changed_cb (GtkToggleButton *radio,
- NetProxy *proxy)
+panel_proxy_mode_radio_changed_cb (NetProxy *proxy, GtkRadioButton *radio)
{
ProxyMode value;
- if (!gtk_toggle_button_get_active (radio))
+ if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio)))
return;
/* get selected radio */
@@ -182,13 +179,12 @@ panel_proxy_mode_radio_changed_cb (GtkToggleButton *radio,
}
static void
-show_dialog_cb (GtkWidget *button,
- NetProxy *self)
+show_dialog_cb (NetProxy *self)
{
GtkWidget *toplevel;
GtkWindow *dialog;
- toplevel = gtk_widget_get_toplevel (button);
+ toplevel = gtk_widget_get_toplevel (GTK_WIDGET (gtk_builder_get_object (self->builder,
"main_widget")));
dialog = GTK_WINDOW (gtk_builder_get_object (self->builder, "dialog"));
gtk_window_set_transient_for (dialog, GTK_WINDOW (toplevel));
@@ -306,10 +302,10 @@ net_proxy_init (NetProxy *proxy)
}
proxy->settings = g_settings_new ("org.gnome.system.proxy");
- g_signal_connect (proxy->settings,
- "changed",
- G_CALLBACK (settings_changed_cb),
- proxy);
+ g_signal_connect_swapped (proxy->settings,
+ "changed",
+ G_CALLBACK (settings_changed_cb),
+ proxy);
/* actions */
value = g_settings_get_enum (proxy->settings, "mode");
@@ -383,31 +379,31 @@ net_proxy_init (NetProxy *proxy)
/* radio buttons */
proxy->mode_radios[MODE_DISABLED] =
- GTK_TOGGLE_BUTTON (gtk_builder_get_object (proxy->builder, "radio_none"));
+ GTK_RADIO_BUTTON (gtk_builder_get_object (proxy->builder, "radio_none"));
proxy->mode_radios[MODE_MANUAL] =
- GTK_TOGGLE_BUTTON (gtk_builder_get_object (proxy->builder, "radio_manual"));
+ GTK_RADIO_BUTTON (gtk_builder_get_object (proxy->builder, "radio_manual"));
proxy->mode_radios[MODE_AUTOMATIC] =
- GTK_TOGGLE_BUTTON (gtk_builder_get_object (proxy->builder, "radio_automatic"));
+ GTK_RADIO_BUTTON (gtk_builder_get_object (proxy->builder, "radio_automatic"));
/* setup the radio before connecting to the :toggled signal */
- gtk_toggle_button_set_active (proxy->mode_radios[value], TRUE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (proxy->mode_radios[value]), TRUE);
panel_proxy_mode_setup_widgets (proxy, value);
panel_update_status_label (proxy, value);
for (i = MODE_DISABLED; i < N_MODES; i++) {
- g_signal_connect (proxy->mode_radios[i],
- "toggled",
- G_CALLBACK (panel_proxy_mode_radio_changed_cb),
- proxy);
+ g_signal_connect_swapped (proxy->mode_radios[i],
+ "toggled",
+ G_CALLBACK (panel_proxy_mode_radio_changed_cb),
+ proxy);
}
/* show dialog button */
widget = GTK_WIDGET (gtk_builder_get_object (proxy->builder, "dialog_button"));
- g_signal_connect (widget,
- "clicked",
- G_CALLBACK (show_dialog_cb),
- proxy);
+ g_signal_connect_swapped (widget,
+ "clicked",
+ G_CALLBACK (show_dialog_cb),
+ proxy);
/* prevent the dialog from being destroyed */
widget = GTK_WIDGET (gtk_builder_get_object (proxy->builder, "dialog"));
diff --git a/panels/network/net-vpn.c b/panels/network/net-vpn.c
index 6a3d35a04..199633be0 100644
--- a/panels/network/net-vpn.c
+++ b/panels/network/net-vpn.c
@@ -65,17 +65,14 @@ net_vpn_set_show_separator (NetVpn *self,
}
static void
-connection_changed_cb (NMConnection *connection,
- NetVpn *vpn)
+connection_changed_cb (NetVpn *vpn)
{
net_object_emit_changed (NET_OBJECT (vpn));
nm_device_refresh_vpn_ui (vpn);
}
static void
-connection_removed_cb (NMClient *client,
- NMConnection *connection,
- NetVpn *vpn)
+connection_removed_cb (NetVpn *vpn, NMConnection *connection)
{
if (vpn->connection == connection)
net_object_emit_removed (NET_OBJECT (vpn));
@@ -111,13 +108,13 @@ net_vpn_set_connection (NetVpn *vpn, NMConnection *connection)
client = net_object_get_client (NET_OBJECT (vpn));
g_signal_connect_object (client,
- NM_CLIENT_CONNECTION_REMOVED,
- G_CALLBACK (connection_removed_cb),
- vpn, 0);
+ NM_CLIENT_CONNECTION_REMOVED,
+ G_CALLBACK (connection_removed_cb),
+ vpn, G_CONNECT_SWAPPED);
g_signal_connect_object (connection,
- NM_CONNECTION_CHANGED,
- G_CALLBACK (connection_changed_cb),
- vpn, 0);
+ NM_CONNECTION_CHANGED,
+ G_CALLBACK (connection_changed_cb),
+ vpn, G_CONNECT_SWAPPED);
vpn->service_type = net_vpn_connection_to_type (vpn->connection);
}
@@ -223,9 +220,7 @@ vpn_proxy_refresh (NetObject *object)
}
static void
-device_off_toggled (GtkSwitch *sw,
- GParamSpec *pspec,
- NetVpn *vpn)
+device_off_toggled (NetVpn *vpn)
{
const GPtrArray *acs;
gboolean active;
@@ -236,7 +231,7 @@ device_off_toggled (GtkSwitch *sw,
if (vpn->updating_device)
return;
- active = gtk_switch_get_active (sw);
+ active = gtk_switch_get_active (GTK_SWITCH (gtk_builder_get_object (vpn->builder,
"device_off_switch")));
if (active) {
client = net_object_get_client (NET_OBJECT (vpn));
nm_client_activate_connection_async (client,
@@ -259,15 +254,13 @@ device_off_toggled (GtkSwitch *sw,
}
static void
-edit_connection (GtkButton *button, NetVpn *vpn)
+edit_connection (NetVpn *vpn)
{
net_object_edit (NET_OBJECT (vpn));
}
static void
-editor_done (NetConnectionEditor *editor,
- gboolean success,
- NetVpn *vpn)
+editor_done (NetVpn *vpn)
{
net_object_refresh (NET_OBJECT (vpn));
g_object_unref (vpn);
@@ -294,7 +287,7 @@ vpn_proxy_edit (NetObject *object)
title = g_strdup_printf (_("%s VPN"), nm_connection_get_id (vpn->connection));
net_connection_editor_set_title (editor, title);
- g_signal_connect (editor, "done", G_CALLBACK (editor_done), g_object_ref (vpn));
+ g_signal_connect_swapped (editor, "done", G_CALLBACK (editor_done), g_object_ref (vpn));
net_connection_editor_run (editor);
}
@@ -423,11 +416,11 @@ net_vpn_init (NetVpn *vpn)
widget = GTK_WIDGET (gtk_builder_get_object (vpn->builder,
"device_off_switch"));
- g_signal_connect (widget, "notify::active",
- G_CALLBACK (device_off_toggled), vpn);
+ g_signal_connect_swapped (widget, "notify::active",
+ G_CALLBACK (device_off_toggled), vpn);
widget = GTK_WIDGET (gtk_builder_get_object (vpn->builder,
"button_options"));
- g_signal_connect (widget, "clicked",
- G_CALLBACK (edit_connection), vpn);
+ g_signal_connect_swapped (widget, "clicked",
+ G_CALLBACK (edit_connection), vpn);
}
diff --git a/panels/network/wireless-security/eap-method-fast.c
b/panels/network/wireless-security/eap-method-fast.c
index 74666a39f..232d7c4e8 100644
--- a/panels/network/wireless-security/eap-method-fast.c
+++ b/panels/network/wireless-security/eap-method-fast.c
@@ -187,17 +187,17 @@ fill_connection (EAPMethod *parent, NMConnection *connection, NMSettingSecretFla
}
static void
-inner_auth_combo_changed_cb (GtkWidget *combo, gpointer user_data)
+inner_auth_combo_changed_cb (EAPMethodFAST *self)
{
- EAPMethod *parent = (EAPMethod *) user_data;
- EAPMethodFAST *method = (EAPMethodFAST *) parent;
- GtkWidget *vbox;
+ EAPMethod *parent = (EAPMethod *) self;
+ GtkWidget *combo, *vbox;
g_autoptr(EAPMethod) eap = NULL;
GList *elt, *children;
GtkTreeModel *model;
GtkTreeIter iter;
GtkWidget *eap_widget;
+ combo = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_fast_inner_auth_combo"));
vbox = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_fast_inner_auth_vbox"));
g_assert (vbox);
@@ -216,11 +216,11 @@ inner_auth_combo_changed_cb (GtkWidget *combo, gpointer user_data)
g_assert (eap_widget);
gtk_widget_unparent (eap_widget);
- if (method->size_group)
- eap_method_add_to_size_group (eap, method->size_group);
+ if (self->size_group)
+ eap_method_add_to_size_group (eap, self->size_group);
gtk_container_add (GTK_CONTAINER (vbox), eap_widget);
- wireless_security_notify_changed (method->sec_parent);
+ wireless_security_notify_changed (self->sec_parent);
}
static GtkWidget *
@@ -288,9 +288,7 @@ inner_auth_combo_init (EAPMethodFAST *method,
gtk_combo_box_set_model (GTK_COMBO_BOX (combo), GTK_TREE_MODEL (auth_model));
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), active);
- g_signal_connect (G_OBJECT (combo), "changed",
- (GCallback) inner_auth_combo_changed_cb,
- method);
+ g_signal_connect_swapped (combo, "changed", G_CALLBACK (inner_auth_combo_changed_cb), method);
return combo;
}
@@ -304,21 +302,22 @@ update_secrets (EAPMethod *parent, NMConnection *connection)
}
static void
-pac_toggled_cb (GtkWidget *widget, gpointer user_data)
+pac_toggled_cb (EAPMethodFAST *self)
{
- EAPMethod *parent = (EAPMethod *) user_data;
- EAPMethodFAST *method = (EAPMethodFAST *) parent;
+ GtkWidget *widget;
+ EAPMethod *parent = (EAPMethod *) self;
gboolean enabled = FALSE;
GtkWidget *provision_combo;
provision_combo = GTK_WIDGET (gtk_builder_get_object (parent->builder,
"eap_fast_pac_provision_combo"));
g_return_if_fail (provision_combo);
+ widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_fast_pac_provision_checkbutton"));
enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
gtk_widget_set_sensitive (provision_combo, enabled);
- wireless_security_notify_changed (method->sec_parent);
+ wireless_security_notify_changed (self->sec_parent);
}
static void
@@ -386,7 +385,7 @@ eap_method_fast_new (WirelessSecurity *ws_parent,
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_fast_pac_provision_checkbutton"));
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), provisioning_enabled);
- g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (pac_toggled_cb), parent);
+ g_signal_connect_swapped (widget, "toggled", G_CALLBACK (pac_toggled_cb), method);
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_fast_anon_identity_entry"));
if (s_8021x && nm_setting_802_1x_get_anonymous_identity (s_8021x))
@@ -416,7 +415,7 @@ eap_method_fast_new (WirelessSecurity *ws_parent,
}
widget = inner_auth_combo_init (method, connection, s_8021x, secrets_only);
- inner_auth_combo_changed_cb (widget, (gpointer) method);
+ inner_auth_combo_changed_cb (method);
if (secrets_only) {
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder,
"eap_fast_anon_identity_label"));
diff --git a/panels/network/wireless-security/eap-method-leap.c
b/panels/network/wireless-security/eap-method-leap.c
index 91b24d02b..92010c61b 100644
--- a/panels/network/wireless-security/eap-method-leap.c
+++ b/panels/network/wireless-security/eap-method-leap.c
@@ -44,11 +44,14 @@ struct _EAPMethodLEAP {
};
static void
-show_toggled_cb (GtkToggleButton *button, EAPMethodLEAP *method)
+show_toggled_cb (EAPMethodLEAP *method)
{
+ EAPMethod *parent = (EAPMethod *) method;
+ GtkWidget *widget;
gboolean visible;
- visible = gtk_toggle_button_get_active (button);
+ widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "show_checkbutton_eapleap"));
+ visible = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
gtk_entry_set_visibility (method->password_entry, visible);
}
@@ -152,13 +155,13 @@ set_userpass_ui (EAPMethodLEAP *method)
}
static void
-widgets_realized (GtkWidget *widget, EAPMethodLEAP *method)
+widgets_realized (EAPMethodLEAP *method)
{
set_userpass_ui (method);
}
static void
-widgets_unrealized (GtkWidget *widget, EAPMethodLEAP *method)
+widgets_unrealized (EAPMethodLEAP *method)
{
wireless_security_set_userpass (method->ws_parent,
gtk_entry_get_text (method->username_entry),
@@ -218,12 +221,8 @@ eap_method_leap_new (WirelessSecurity *ws_parent,
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_leap_grid"));
g_assert (widget);
- g_signal_connect (G_OBJECT (widget), "realize",
- (GCallback) widgets_realized,
- method);
- g_signal_connect (G_OBJECT (widget), "unrealize",
- (GCallback) widgets_unrealized,
- method);
+ g_signal_connect_swapped (widget, "realize", G_CALLBACK (widgets_realized), method);
+ g_signal_connect_swapped (widget, "unrealize", G_CALLBACK (widgets_unrealized), method);
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_leap_username_entry"));
g_assert (widget);
@@ -247,9 +246,7 @@ eap_method_leap_new (WirelessSecurity *ws_parent,
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "show_checkbutton_eapleap"));
g_assert (widget);
method->show_password = GTK_TOGGLE_BUTTON (widget);
- g_signal_connect (G_OBJECT (widget), "toggled",
- (GCallback) show_toggled_cb,
- parent);
+ g_signal_connect_swapped (widget, "toggled", G_CALLBACK (show_toggled_cb), method);
/* Initialize the UI fields with the security settings from method->ws_parent.
* This will be done again when the widget gets realized. It must be done here as well,
diff --git a/panels/network/wireless-security/eap-method-peap.c
b/panels/network/wireless-security/eap-method-peap.c
index aec1ea821..9fa893a5e 100644
--- a/panels/network/wireless-security/eap-method-peap.c
+++ b/panels/network/wireless-security/eap-method-peap.c
@@ -82,9 +82,9 @@ validate (EAPMethod *parent, GError **error)
}
static void
-ca_cert_not_required_toggled (GtkWidget *ignored, gpointer user_data)
+ca_cert_not_required_toggled (EAPMethodPEAP *self)
{
- EAPMethod *parent = user_data;
+ EAPMethod *parent = (EAPMethod *) self;
eap_method_ca_cert_not_required_toggled (GTK_TOGGLE_BUTTON (gtk_builder_get_object (parent->builder,
"eap_peap_ca_cert_not_required_checkbox")),
GTK_FILE_CHOOSER (gtk_builder_get_object (parent->builder,
"eap_peap_ca_cert_button")));
@@ -191,11 +191,10 @@ fill_connection (EAPMethod *parent, NMConnection *connection, NMSettingSecretFla
eap_method_fill_connection (eap, connection, flags);
}
static void
-inner_auth_combo_changed_cb (GtkWidget *combo, gpointer user_data)
+inner_auth_combo_changed_cb (EAPMethodPEAP *self)
{
- EAPMethod *parent = (EAPMethod *) user_data;
- EAPMethodPEAP *method = (EAPMethodPEAP *) parent;
- GtkWidget *vbox;
+ EAPMethod *parent = (EAPMethod *) self;
+ GtkWidget *combo, *vbox;
g_autoptr(EAPMethod) eap = NULL;
GList *elt, *children;
GtkTreeModel *model;
@@ -210,6 +209,7 @@ inner_auth_combo_changed_cb (GtkWidget *combo, gpointer user_data)
for (elt = children; elt; elt = g_list_next (elt))
gtk_container_remove (GTK_CONTAINER (vbox), GTK_WIDGET (elt->data));
+ combo = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_peap_inner_auth_combo"));
model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo));
gtk_combo_box_get_active_iter (GTK_COMBO_BOX (combo), &iter);
gtk_tree_model_get (model, &iter, I_METHOD_COLUMN, &eap, -1);
@@ -219,11 +219,11 @@ inner_auth_combo_changed_cb (GtkWidget *combo, gpointer user_data)
g_assert (eap_widget);
gtk_widget_unparent (eap_widget);
- if (method->size_group)
- eap_method_add_to_size_group (eap, method->size_group);
+ if (self->size_group)
+ eap_method_add_to_size_group (eap, self->size_group);
gtk_container_add (GTK_CONTAINER (vbox), eap_widget);
- wireless_security_notify_changed (method->sec_parent);
+ wireless_security_notify_changed (self->sec_parent);
}
static GtkWidget *
@@ -306,9 +306,7 @@ inner_auth_combo_init (EAPMethodPEAP *method,
gtk_combo_box_set_model (GTK_COMBO_BOX (combo), GTK_TREE_MODEL (auth_model));
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), active);
- g_signal_connect (G_OBJECT (combo), "changed",
- (GCallback) inner_auth_combo_changed_cb,
- method);
+ g_signal_connect_swapped (combo, "changed", G_CALLBACK (inner_auth_combo_changed_cb), method);
return combo;
}
@@ -363,9 +361,7 @@ eap_method_peap_new (WirelessSecurity *ws_parent,
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder,
"eap_peap_ca_cert_not_required_checkbox"));
g_assert (widget);
- g_signal_connect (G_OBJECT (widget), "toggled",
- (GCallback) ca_cert_not_required_toggled,
- parent);
+ g_signal_connect_swapped (widget, "toggled", G_CALLBACK (ca_cert_not_required_toggled), method);
g_signal_connect_swapped (widget, "toggled", G_CALLBACK (changed_cb), method);
widget_ca_not_required_checkbox = widget;
@@ -389,7 +385,7 @@ eap_method_peap_new (WirelessSecurity *ws_parent,
}
widget = inner_auth_combo_init (method, connection, s_8021x, secrets_only);
- inner_auth_combo_changed_cb (widget, (gpointer) method);
+ inner_auth_combo_changed_cb (method);
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_peap_version_combo"));
g_assert (widget);
diff --git a/panels/network/wireless-security/eap-method-simple.c
b/panels/network/wireless-security/eap-method-simple.c
index e58a27a66..2e36e0dcb 100644
--- a/panels/network/wireless-security/eap-method-simple.c
+++ b/panels/network/wireless-security/eap-method-simple.c
@@ -46,12 +46,15 @@ struct _EAPMethodSimple {
};
static void
-show_toggled_cb (GtkToggleButton *button, EAPMethodSimple *method)
+show_toggled_cb (EAPMethodSimple *self)
{
+ EAPMethod *parent = (EAPMethod *) self;
+ GtkWidget *widget;
gboolean visible;
- visible = gtk_toggle_button_get_active (button);
- gtk_entry_set_visibility (method->password_entry, visible);
+ widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "show_checkbutton_eapsimple"));
+ visible = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
+ gtk_entry_set_visibility (self->password_entry, visible);
}
static gboolean
@@ -203,9 +206,7 @@ stuff_changed (EAPMethodSimple *method)
}
static void
-password_storage_changed (GObject *entry,
- GParamSpec *pspec,
- EAPMethodSimple *method)
+password_storage_changed (EAPMethodSimple *method)
{
gboolean always_ask;
gboolean secrets_only = method->flags & EAP_METHOD_SIMPLE_FLAG_SECRETS_ONLY;
@@ -244,13 +245,13 @@ set_userpass_ui (EAPMethodSimple *method)
}
static void
-widgets_realized (GtkWidget *widget, EAPMethodSimple *method)
+widgets_realized (EAPMethodSimple *method)
{
set_userpass_ui (method);
}
static void
-widgets_unrealized (GtkWidget *widget, EAPMethodSimple *method)
+widgets_unrealized (EAPMethodSimple *method)
{
wireless_security_set_userpass (method->ws_parent,
gtk_entry_get_text (method->username_entry),
@@ -316,12 +317,8 @@ eap_method_simple_new (WirelessSecurity *ws_parent,
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_simple_grid"));
g_assert (widget);
- g_signal_connect (G_OBJECT (widget), "realize",
- (GCallback) widgets_realized,
- method);
- g_signal_connect (G_OBJECT (widget), "unrealize",
- (GCallback) widgets_unrealized,
- method);
+ g_signal_connect_swapped (widget, "realize", G_CALLBACK (widgets_realized), method);
+ g_signal_connect_swapped (widget, "unrealize", G_CALLBACK (widgets_unrealized), method);
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_simple_username_entry"));
g_assert (widget);
@@ -342,16 +339,12 @@ eap_method_simple_new (WirelessSecurity *ws_parent,
nma_utils_setup_password_storage (widget, 0, (NMSetting *) s_8021x, parent->password_flags_name,
FALSE, flags & EAP_METHOD_SIMPLE_FLAG_SECRETS_ONLY);
- g_signal_connect (method->password_entry, "notify::secondary-icon-name",
- G_CALLBACK (password_storage_changed),
- method);
+ g_signal_connect_swapped (method->password_entry, "notify::secondary-icon-name", G_CALLBACK
(password_storage_changed), method);
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "show_checkbutton_eapsimple"));
g_assert (widget);
method->show_password = GTK_TOGGLE_BUTTON (widget);
- g_signal_connect (G_OBJECT (widget), "toggled",
- (GCallback) show_toggled_cb,
- method);
+ g_signal_connect_swapped (widget, "toggled", G_CALLBACK (show_toggled_cb), method);
/* Initialize the UI fields with the security settings from method->ws_parent.
* This will be done again when the widget gets realized. It must be done here as well,
diff --git a/panels/network/wireless-security/eap-method-tls.c
b/panels/network/wireless-security/eap-method-tls.c
index c8c75666d..d8c771cd4 100644
--- a/panels/network/wireless-security/eap-method-tls.c
+++ b/panels/network/wireless-security/eap-method-tls.c
@@ -40,15 +40,16 @@ struct _EAPMethodTLS {
static void
-show_toggled_cb (GtkCheckButton *button, EAPMethod *method)
+show_toggled_cb (EAPMethodTLS *self)
{
+ EAPMethod *method = (EAPMethod *) self;
GtkWidget *widget;
gboolean visible;
- widget = GTK_WIDGET (gtk_builder_get_object (method->builder, "eap_tls_private_key_password_entry"));
- g_assert (widget);
+ widget = GTK_WIDGET (gtk_builder_get_object (method->builder, "show_checkbutton_eaptls"));
+ visible = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
- visible = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
+ widget = GTK_WIDGET (gtk_builder_get_object (method->builder, "eap_tls_private_key_password_entry"));
gtk_entry_set_visibility (GTK_ENTRY (widget), visible);
}
@@ -121,9 +122,9 @@ validate (EAPMethod *parent, GError **error)
}
static void
-ca_cert_not_required_toggled (GtkWidget *ignored, gpointer user_data)
+ca_cert_not_required_toggled (EAPMethodTLS *self)
{
- EAPMethod *parent = user_data;
+ EAPMethod *parent = (EAPMethod *) self;
eap_method_ca_cert_not_required_toggled (GTK_TOGGLE_BUTTON (gtk_builder_get_object (parent->builder,
"eap_tls_ca_cert_not_required_checkbox")),
GTK_FILE_CHOOSER (gtk_builder_get_object (parent->builder,
"eap_tls_ca_cert_button")));
@@ -463,9 +464,7 @@ eap_method_tls_new (WirelessSecurity *ws_parent,
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder,
"eap_tls_ca_cert_not_required_checkbox"));
g_assert (widget);
- g_signal_connect (G_OBJECT (widget), "toggled",
- (GCallback) ca_cert_not_required_toggled,
- parent);
+ g_signal_connect_swapped (widget, "toggled", G_CALLBACK (ca_cert_not_required_toggled), method);
g_signal_connect_swapped (widget, "toggled", G_CALLBACK (changed_cb), method);
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_tls_identity_entry"));
@@ -514,9 +513,7 @@ eap_method_tls_new (WirelessSecurity *ws_parent,
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "show_checkbutton_eaptls"));
g_assert (widget);
- g_signal_connect (G_OBJECT (widget), "toggled",
- (GCallback) show_toggled_cb,
- parent);
+ g_signal_connect_swapped (widget, "toggled", G_CALLBACK (show_toggled_cb), method);
if (secrets_only) {
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_tls_identity_entry"));
diff --git a/panels/network/wireless-security/eap-method-ttls.c
b/panels/network/wireless-security/eap-method-ttls.c
index 195d30110..05f655165 100644
--- a/panels/network/wireless-security/eap-method-ttls.c
+++ b/panels/network/wireless-security/eap-method-ttls.c
@@ -82,10 +82,9 @@ validate (EAPMethod *parent, GError **error)
}
static void
-ca_cert_not_required_toggled (GtkWidget *ignored, gpointer user_data)
+ca_cert_not_required_toggled (EAPMethodTTLS *self)
{
- EAPMethod *parent = user_data;
-
+ EAPMethod *parent = (EAPMethod *) self;
eap_method_ca_cert_not_required_toggled (GTK_TOGGLE_BUTTON (gtk_builder_get_object (parent->builder,
"eap_ttls_ca_cert_not_required_checkbox")),
GTK_FILE_CHOOSER (gtk_builder_get_object (parent->builder,
"eap_ttls_ca_cert_button")));
}
@@ -183,17 +182,17 @@ fill_connection (EAPMethod *parent, NMConnection *connection, NMSettingSecretFla
}
static void
-inner_auth_combo_changed_cb (GtkWidget *combo, gpointer user_data)
+inner_auth_combo_changed_cb (EAPMethodTTLS *self)
{
- EAPMethod *parent = (EAPMethod *) user_data;
- EAPMethodTTLS *method = (EAPMethodTTLS *) parent;
- GtkWidget *vbox;
+ EAPMethod *parent = (EAPMethod *) self;
+ GtkWidget *combo, *vbox;
g_autoptr(EAPMethod) eap = NULL;
GList *elt, *children;
GtkTreeModel *model;
GtkTreeIter iter;
GtkWidget *eap_widget;
+ combo = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_inner_auth_combo"));
vbox = GTK_WIDGET (gtk_builder_get_object (parent->builder, "eap_ttls_inner_auth_vbox"));
g_assert (vbox);
@@ -212,11 +211,11 @@ inner_auth_combo_changed_cb (GtkWidget *combo, gpointer user_data)
g_assert (eap_widget);
gtk_widget_unparent (eap_widget);
- if (method->size_group)
- eap_method_add_to_size_group (eap, method->size_group);
+ if (self->size_group)
+ eap_method_add_to_size_group (eap, self->size_group);
gtk_container_add (GTK_CONTAINER (vbox), eap_widget);
- wireless_security_notify_changed (method->sec_parent);
+ wireless_security_notify_changed (self->sec_parent);
}
static GtkWidget *
@@ -361,9 +360,7 @@ inner_auth_combo_init (EAPMethodTTLS *method,
gtk_combo_box_set_model (GTK_COMBO_BOX (combo), GTK_TREE_MODEL (auth_model));
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), active);
- g_signal_connect (G_OBJECT (combo), "changed",
- (GCallback) inner_auth_combo_changed_cb,
- method);
+ g_signal_connect_swapped (combo, "changed", G_CALLBACK (inner_auth_combo_changed_cb), method);
return combo;
}
@@ -418,9 +415,7 @@ eap_method_ttls_new (WirelessSecurity *ws_parent,
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder,
"eap_ttls_ca_cert_not_required_checkbox"));
g_assert (widget);
- g_signal_connect (G_OBJECT (widget), "toggled",
- (GCallback) ca_cert_not_required_toggled,
- parent);
+ g_signal_connect_swapped (widget, "toggled", G_CALLBACK (ca_cert_not_required_toggled), method);
g_signal_connect_swapped (widget, "toggled", G_CALLBACK (changed_cb), method);
widget_ca_not_required_checkbox = widget;
@@ -453,7 +448,7 @@ eap_method_ttls_new (WirelessSecurity *ws_parent,
g_signal_connect_swapped (widget, "changed", G_CALLBACK (changed_cb), method);
widget = inner_auth_combo_init (method, connection, s_8021x, secrets_only);
- inner_auth_combo_changed_cb (widget, (gpointer) method);
+ inner_auth_combo_changed_cb (method);
if (secrets_only) {
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder,
"eap_ttls_anon_identity_label"));
diff --git a/panels/network/wireless-security/ws-leap.c b/panels/network/wireless-security/ws-leap.c
index 95548c6ad..814819358 100644
--- a/panels/network/wireless-security/ws-leap.c
+++ b/panels/network/wireless-security/ws-leap.c
@@ -37,15 +37,16 @@ struct _WirelessSecurityLEAP {
};
static void
-show_toggled_cb (GtkCheckButton *button, WirelessSecurity *sec)
+show_toggled_cb (WirelessSecurityLEAP *self)
{
+ WirelessSecurity *sec = (WirelessSecurity *) self;
GtkWidget *widget;
gboolean visible;
- widget = GTK_WIDGET (gtk_builder_get_object (sec->builder, "leap_password_entry"));
- g_assert (widget);
+ widget = GTK_WIDGET (gtk_builder_get_object (sec->builder, "show_checkbutton_leap"));
+ visible = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
- visible = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
+ widget = GTK_WIDGET (gtk_builder_get_object (sec->builder, "leap_password_entry"));
gtk_entry_set_visibility (GTK_ENTRY (widget), visible);
}
@@ -210,9 +211,7 @@ ws_leap_new (NMConnection *connection, gboolean secrets_only)
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "show_checkbutton_leap"));
g_assert (widget);
- g_signal_connect (G_OBJECT (widget), "toggled",
- (GCallback) show_toggled_cb,
- sec);
+ g_signal_connect_swapped (widget, "toggled", G_CALLBACK (show_toggled_cb), sec);
return sec;
}
diff --git a/panels/network/wireless-security/ws-wep-key.c b/panels/network/wireless-security/ws-wep-key.c
index 209d497f1..d2527e5d6 100644
--- a/panels/network/wireless-security/ws-wep-key.c
+++ b/panels/network/wireless-security/ws-wep-key.c
@@ -42,23 +42,25 @@ struct _WirelessSecurityWEPKey {
};
static void
-show_toggled_cb (GtkCheckButton *button, WirelessSecurity *sec)
+show_toggled_cb (WirelessSecurityWEPKey *self)
{
- GtkWidget *widget;
+ WirelessSecurity *parent = (WirelessSecurity *) self;
+ GtkWidget *widget, *button;
gboolean visible;
- widget = GTK_WIDGET (gtk_builder_get_object (sec->builder, "wep_key_entry"));
+ widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "wep_key_entry"));
g_assert (widget);
+ button = GTK_WIDGET (gtk_builder_get_object (parent->builder, "show_checkbutton_wep"));
visible = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
gtk_entry_set_visibility (GTK_ENTRY (widget), visible);
}
static void
-key_index_combo_changed_cb (GtkWidget *combo, WirelessSecurity *parent)
+key_index_combo_changed_cb (WirelessSecurityWEPKey *self)
{
- WirelessSecurityWEPKey *sec = (WirelessSecurityWEPKey *) parent;
- GtkWidget *entry;
+ WirelessSecurity *parent = (WirelessSecurity *) self;
+ GtkWidget *combo, *entry;
const char *key;
int key_index;
@@ -66,17 +68,18 @@ key_index_combo_changed_cb (GtkWidget *combo, WirelessSecurity *parent)
entry = GTK_WIDGET (gtk_builder_get_object (parent->builder, "wep_key_entry"));
key = gtk_entry_get_text (GTK_ENTRY (entry));
if (key)
- g_strlcpy (sec->keys[sec->cur_index], key, sizeof (sec->keys[sec->cur_index]));
+ g_strlcpy (self->keys[self->cur_index], key, sizeof (self->keys[self->cur_index]));
else
- memset (sec->keys[sec->cur_index], 0, sizeof (sec->keys[sec->cur_index]));
+ memset (self->keys[self->cur_index], 0, sizeof (self->keys[self->cur_index]));
+ combo = GTK_WIDGET (gtk_builder_get_object (parent->builder, "key_index_combo"));
key_index = gtk_combo_box_get_active (GTK_COMBO_BOX (combo));
g_return_if_fail (key_index <= 3);
g_return_if_fail (key_index >= 0);
/* Populate entry with key from new index */
- gtk_entry_set_text (GTK_ENTRY (entry), sec->keys[key_index]);
- sec->cur_index = key_index;
+ gtk_entry_set_text (GTK_ENTRY (entry), self->keys[key_index]);
+ self->cur_index = key_index;
wireless_security_notify_changed (parent);
}
@@ -213,15 +216,16 @@ fill_connection (WirelessSecurity *parent, NMConnection *connection)
}
static void
-wep_entry_filter_cb (GtkEditable *editable,
+wep_entry_filter_cb (WirelessSecurityWEPKey *self,
gchar *text,
gint length,
- gint *position,
- gpointer data)
+ gint *position)
{
- WirelessSecurityWEPKey *sec = (WirelessSecurityWEPKey *) data;
+ WirelessSecurity *parent = (WirelessSecurity *) self;
+ GtkWidget *widget;
- if (sec->type == NM_WEP_KEY_TYPE_KEY) {
+ widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "wep_key_entry"));
+ if (self->type == NM_WEP_KEY_TYPE_KEY) {
int i, count = 0;
g_autofree gchar *result = g_new (gchar, length+1);
@@ -232,15 +236,11 @@ wep_entry_filter_cb (GtkEditable *editable,
result[count] = 0;
if (count > 0) {
- g_signal_handlers_block_by_func (G_OBJECT (editable),
- G_CALLBACK (wep_entry_filter_cb),
- data);
- gtk_editable_insert_text (editable, result, count, position);
- g_signal_handlers_unblock_by_func (G_OBJECT (editable),
- G_CALLBACK (wep_entry_filter_cb),
- data);
+ g_signal_handlers_block_by_func (widget, G_CALLBACK (wep_entry_filter_cb), self);
+ gtk_editable_insert_text (GTK_EDITABLE (widget), result, count, position);
+ g_signal_handlers_unblock_by_func (widget, G_CALLBACK (wep_entry_filter_cb), self);
}
- g_signal_stop_emission_by_name (G_OBJECT (editable), "insert-text");
+ g_signal_stop_emission_by_name (widget, "insert-text");
}
}
@@ -329,9 +329,7 @@ ws_wep_key_new (NMConnection *connection,
}
g_signal_connect_swapped (widget, "changed", G_CALLBACK (changed_cb), sec);
- g_signal_connect (G_OBJECT (widget), "insert-text",
- (GCallback) wep_entry_filter_cb,
- sec);
+ g_signal_connect_swapped (widget, "insert-text", G_CALLBACK (wep_entry_filter_cb), sec);
if (sec->type == NM_WEP_KEY_TYPE_KEY)
gtk_entry_set_max_length (GTK_ENTRY (widget), 26);
else if (sec->type == NM_WEP_KEY_TYPE_PASSPHRASE)
@@ -343,9 +341,7 @@ ws_wep_key_new (NMConnection *connection,
gtk_combo_box_set_active (GTK_COMBO_BOX (widget), default_key_idx);
sec->cur_index = default_key_idx;
- g_signal_connect (G_OBJECT (widget), "changed",
- (GCallback) key_index_combo_changed_cb,
- sec);
+ g_signal_connect_swapped (widget, "changed", G_CALLBACK (key_index_combo_changed_cb), sec);
/* Key index is useless with adhoc networks */
if (is_adhoc || secrets_only) {
@@ -360,9 +356,7 @@ ws_wep_key_new (NMConnection *connection,
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "show_checkbutton_wep"));
g_assert (widget);
- g_signal_connect (G_OBJECT (widget), "toggled",
- (GCallback) show_toggled_cb,
- sec);
+ g_signal_connect_swapped (widget, "toggled", G_CALLBACK (show_toggled_cb), sec);
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "auth_method_combo"));
gtk_combo_box_set_active (GTK_COMBO_BOX (widget), is_shared_key ? 1 : 0);
diff --git a/panels/network/wireless-security/ws-wpa-psk.c b/panels/network/wireless-security/ws-wpa-psk.c
index ae3fde94e..31e071628 100644
--- a/panels/network/wireless-security/ws-wpa-psk.c
+++ b/panels/network/wireless-security/ws-wpa-psk.c
@@ -47,15 +47,16 @@ get_widget (WirelessSecurity *parent)
}
static void
-show_toggled_cb (GtkCheckButton *button, WirelessSecurity *sec)
+show_toggled_cb (WirelessSecurityWPAPSK *self)
{
+ WirelessSecurity *sec = (WirelessSecurity *) self;
GtkWidget *widget;
gboolean visible;
- widget = GTK_WIDGET (gtk_builder_get_object (sec->builder, "wpa_psk_entry"));
- g_assert (widget);
+ widget = GTK_WIDGET (gtk_builder_get_object (sec->builder, "show_checkbutton_wpa"));
+ visible = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
- visible = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
+ widget = GTK_WIDGET (gtk_builder_get_object (sec->builder, "wpa_psk_entry"));
gtk_entry_set_visibility (GTK_ENTRY (widget), visible);
}
@@ -220,9 +221,7 @@ ws_wpa_psk_new (NMConnection *connection, gboolean secrets_only)
widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "show_checkbutton_wpa"));
g_assert (widget);
- g_signal_connect (G_OBJECT (widget), "toggled",
- (GCallback) show_toggled_cb,
- sec);
+ g_signal_connect_swapped (widget, "toggled", G_CALLBACK (show_toggled_cb), sec);
/* Hide WPA/RSN for now since this can be autodetected by NM and the
* supplicant when connecting to the AP.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]