[gnome-bluetooth/wip/hadess/lib-changes: 22/24] XXX lib: find_device_in_model function...




commit d6e35b723897e8650bef4deab91f8fc145bc6b51
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Nov 26 13:10:18 2021 +0100

    XXX lib: find_device_in_model function...

 lib/bluetooth-settings-widget.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
---
diff --git a/lib/bluetooth-settings-widget.c b/lib/bluetooth-settings-widget.c
index e964a2f3..b7242233 100644
--- a/lib/bluetooth-settings-widget.c
+++ b/lib/bluetooth-settings-widget.c
@@ -1081,6 +1081,24 @@ switch_connected_state_set (GtkSwitch               *button,
        return TRUE;
 }
 
+static BluetoothDevice *
+find_device_in_model (GListStore *model,
+                     GDBusProxy *proxy)
+{
+       const char *proxy_path;
+       guint n_devices, i;
+
+       proxy_path = g_dbus_proxy_get_object_path (proxy);
+       n_devices = g_list_model_get_n_items (G_LIST_MODEL (model));
+       for (i = 0; i < n_devices; i++) {
+               g_autoptr(BluetoothDevice) device = NULL;
+
+               if (g_strcmp0 (proxy_path, bluetooth_device_get_object_path (device)) == 0)
+                       return g_steal_pointer (&device);
+       }
+       return NULL;
+}
+
 static void
 update_properties (BluetoothSettingsWidget *self,
                   GDBusProxy              *proxy)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]