gnome-control-center/SOURCES/0001-network-Populate-AP-list-from-idle-handler.patch

74 lines
2.5 KiB
Diff
Raw Normal View History

From 3e03aaba0453894aa0affd5b2e4f6a54794387cf Mon Sep 17 00:00:00 2001
From: Benjamin Berg <bberg@redhat.com>
Date: Wed, 28 Jul 2021 22:16:21 +0200
Subject: [PATCH 1/8] network: Populate AP list from idle handler
Doing this should prevent the UI from becoming completely unusable as
updates of the AP list should be batched up rather than processed
sequentially.
---
panels/network/net-device-wifi.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/panels/network/net-device-wifi.c b/panels/network/net-device-wifi.c
index 313e9ab8c..33758e499 100644
--- a/panels/network/net-device-wifi.c
+++ b/panels/network/net-device-wifi.c
@@ -64,6 +64,7 @@ struct _NetDeviceWifiPrivate
gchar *selected_connection_id;
gchar *selected_ap_id;
guint scan_id;
+ guint populate_ap_list_idle_id;
GCancellable *cancellable;
};
@@ -1619,6 +1620,7 @@ net_device_wifi_finalize (GObject *object)
g_clear_object (&priv->cancellable);
}
disable_scan_timeout (device_wifi);
+ g_clear_handle_id (&priv->populate_ap_list_idle_id, g_source_remove);
g_clear_pointer (&priv->details_dialog, gtk_widget_destroy);
g_object_unref (priv->builder);
@@ -2145,8 +2147,8 @@ open_history (NetDeviceWifi *device_wifi)
gtk_window_present (GTK_WINDOW (dialog));
}
-static void
-populate_ap_list (NetDeviceWifi *device_wifi)
+static gboolean
+populate_ap_list_idle (NetDeviceWifi *device_wifi)
{
GtkWidget *list;
GtkSizeGroup *rows;
@@ -2162,6 +2164,8 @@ populate_ap_list (NetDeviceWifi *device_wifi)
GtkWidget *button;
GList *children, *child;
+ device_wifi->priv->populate_ap_list_idle_id = 0;
+
list = GTK_WIDGET (gtk_builder_get_object (device_wifi->priv->builder, "listbox"));
children = gtk_container_get_children (GTK_CONTAINER (list));
@@ -2217,6 +2221,17 @@ populate_ap_list (NetDeviceWifi *device_wifi)
g_slist_free (connections);
g_ptr_array_free (aps_unique, TRUE);
+
+ return G_SOURCE_REMOVE;
+}
+
+static void
+populate_ap_list (NetDeviceWifi *device_wifi)
+{
+ if (device_wifi->priv->populate_ap_list_idle_id != 0)
+ return;
+
+ device_wifi->priv->populate_ap_list_idle_id = g_idle_add ((GSourceFunc) populate_ap_list_idle, device_wifi);
}
static void
--
2.34.1