[gnome-control-center] wifi: Fix bug in Known Wi-Fi Networks dialog
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] wifi: Fix bug in Known Wi-Fi Networks dialog
- Date: Wed, 3 Aug 2022 11:09:09 +0000 (UTC)
commit 48497080b33a78013be60d9e071d53ce44b46395
Author: Hendrik Müller <henne90gen gmail com>
Date: Fri Jul 15 08:37:45 2022 +0200
wifi: Fix bug in Known Wi-Fi Networks dialog
The "Forget" button would only update it's sensitivity after the first
select and deselect, when selecting and deselecting rows in the
"Known Wi-Fi Networks" dialog.
When selecting the first row, it would go from disabled to enabled.
Then deselecting that row would cause the button to go from enabled to
disabled.
Selecting any rows after that would no longer update the sensitivity and
make the dialog essentially useless.
The issue was, that the signals "add" and "remove" where being
expected to be emitted when the connection list updates its rows.
However, neither CcWifiConnectionList nor GtkListBox emit these signals.
The fix was, to emit these two signals at the appropriate locations.
The signals have also been renamed to "add-row" and "remove-row" to
make their purpose more clear.
Closes https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/1824
panels/network/cc-wifi-connection-list.c | 16 ++++++++++++++++
panels/network/net-device-wifi.c | 4 ++--
2 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/panels/network/cc-wifi-connection-list.c b/panels/network/cc-wifi-connection-list.c
index 6ce08c6dd..6a11d2034 100644
--- a/panels/network/cc-wifi-connection-list.c
+++ b/panels/network/cc-wifi-connection-list.c
@@ -135,6 +135,8 @@ cc_wifi_connection_list_row_add (CcWifiConnectionList *self,
g_signal_connect_object (res, "configure", G_CALLBACK (on_row_configured_cb), self, G_CONNECT_SWAPPED);
+ g_signal_emit_by_name (self, "add-row", res);
+
return res;
}
@@ -156,6 +158,7 @@ clear_widget (CcWifiConnectionList *self)
while (g_hash_table_iter_next (&iter, NULL, (gpointer*) &row))
{
g_hash_table_iter_remove (&iter);
+ g_signal_emit_by_name (self, "remove-row", row);
gtk_list_box_remove (self->listbox, GTK_WIDGET (row));
}
@@ -167,6 +170,7 @@ clear_widget (CcWifiConnectionList *self)
row = g_ptr_array_index (self->connections_row, i);
g_ptr_array_index (self->connections_row, i) = NULL;
+ g_signal_emit_by_name (self, "remove-row", row);
gtk_list_box_remove (self->listbox, GTK_WIDGET (row));
}
@@ -414,6 +418,7 @@ on_device_ap_removed_cb (CcWifiConnectionList *self,
if (self->hide_unavailable)
{
g_ptr_array_index (self->connections_row, i) = NULL;
+ g_signal_emit_by_name (self, "remove-row", row);
gtk_list_box_remove (self->listbox, GTK_WIDGET (row));
}
}
@@ -435,6 +440,7 @@ on_device_ap_removed_cb (CcWifiConnectionList *self,
if (cc_wifi_connection_row_remove_access_point (row, ap))
{
g_hash_table_remove (self->ssid_to_row, ssid);
+ g_signal_emit_by_name (self, "remove-row", row);
gtk_list_box_remove (self->listbox, GTK_WIDGET (row));
}
}
@@ -709,6 +715,16 @@ cc_wifi_connection_list_class_init (CcWifiConnectionListClass *klass)
G_SIGNAL_RUN_LAST,
0, NULL, NULL, NULL,
G_TYPE_NONE, 1, CC_TYPE_WIFI_CONNECTION_ROW);
+ g_signal_new ("add-row",
+ CC_TYPE_WIFI_CONNECTION_LIST,
+ G_SIGNAL_RUN_LAST,
+ 0, NULL, NULL, NULL,
+ G_TYPE_NONE, 1, CC_TYPE_WIFI_CONNECTION_ROW);
+ g_signal_new ("remove-row",
+ CC_TYPE_WIFI_CONNECTION_LIST,
+ G_SIGNAL_RUN_LAST,
+ 0, NULL, NULL, NULL,
+ G_TYPE_NONE, 1, CC_TYPE_WIFI_CONNECTION_ROW);
}
static void
diff --git a/panels/network/net-device-wifi.c b/panels/network/net-device-wifi.c
index b052699e1..28160b4a4 100644
--- a/panels/network/net-device-wifi.c
+++ b/panels/network/net-device-wifi.c
@@ -1077,11 +1077,11 @@ show_history (NetDeviceWifi *self)
g_object_set_data (G_OBJECT (list), "forget", forget);
g_object_set_data (G_OBJECT (list), "net", self);
- g_signal_connect_object (list, "add",
+ g_signal_connect_object (list, "add-row",
G_CALLBACK (on_connection_list_row_added_cb),
self,
G_CONNECT_SWAPPED);
- g_signal_connect_object (list, "remove",
+ g_signal_connect_object (list, "remove-row",
G_CALLBACK (on_connection_list_row_removed_cb),
self,
G_CONNECT_SWAPPED);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]