[gnome-bluetooth/wip/hadess/remove-gtk-tree: 15/18] lib: Remove GtkTreeModel usage when adding devices




commit 1505644f12259d9f15e06ebaf5f7580336e6349b
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Dec 1 16:25:11 2021 +0100

    lib: Remove GtkTreeModel usage when adding devices

 lib/bluetooth-client.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/lib/bluetooth-client.c b/lib/bluetooth-client.c
index 1eea1dbf..d63e03f5 100644
--- a/lib/bluetooth-client.c
+++ b/lib/bluetooth-client.c
@@ -431,6 +431,7 @@ device_added (GDBusObjectManager   *manager,
              gboolean              coldplug)
 {
        g_autoptr (GDBusProxy) adapter = NULL;
+       const char *default_adapter_path;
        const char *adapter_path, *address, *alias, *name, *icon;
        g_auto(GStrv) uuids = NULL;
        gboolean default_adapter;
@@ -456,12 +457,14 @@ device_added (GDBusObjectManager   *manager,
 
        g_debug ("Inserting device '%s' on adapter '%s'", address, adapter_path);
 
+       default_adapter_path = g_dbus_proxy_get_object_path (G_DBUS_PROXY (client->default_adapter));
+       default_adapter = (g_strcmp0 (default_adapter_path, adapter_path) == 0);
+
        if (get_iter_from_path (client->store, &parent, adapter_path) == FALSE)
                return;
 
        gtk_tree_model_get (GTK_TREE_MODEL(client->store), &parent,
                            BLUETOOTH_COLUMN_PROXY, &adapter,
-                           BLUETOOTH_COLUMN_DEFAULT, &default_adapter,
                            -1);
 
        if (get_iter_from_address (client->store, &iter, address, adapter) == FALSE) {


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