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

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