Blame SOURCES/0001-network-Populate-AP-list-from-idle-handler.patch

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