summaryrefslogtreecommitdiff
path: root/lib/bluetooth-client.c
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2021-12-01 15:33:36 +0100
committerBastien Nocera <hadess@hadess.net>2021-12-02 12:02:42 +0100
commit626826464c1e04e8e000361db96d9f003dbc64c0 (patch)
tree2971a039437feaa5df6a500d9fd0ebe881f44ba2 /lib/bluetooth-client.c
parent57f47018fb55a3a6767a89dea211f837bff61931 (diff)
downloadgnome-bluetooth-626826464c1e04e8e000361db96d9f003dbc64c0.tar.gz
lib: Remove GtkTreeModel usage when populating GListModel
Diffstat (limited to 'lib/bluetooth-client.c')
-rw-r--r--lib/bluetooth-client.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/bluetooth-client.c b/lib/bluetooth-client.c
index 127f7cdb..4a58fe64 100644
--- a/lib/bluetooth-client.c
+++ b/lib/bluetooth-client.c
@@ -580,10 +580,13 @@ static void
add_devices_to_list_store (BluetoothClient *client)
{
GList *object_list, *l;
+ const char *default_adapter_path;
g_debug ("Emptying list store as default adapter changed");
g_list_store_remove_all (client->list_store);
+ default_adapter_path = g_dbus_proxy_get_object_path (G_DBUS_PROXY (client->default_adapter));
+
g_debug ("Coldplugging devices for new default adapter");
object_list = g_dbus_object_manager_get_objects (client->manager);
for (l = object_list; l != NULL; l = l->next) {
@@ -591,11 +594,9 @@ add_devices_to_list_store (BluetoothClient *client)
GDBusInterface *iface;
const char *adapter_path, *address, *alias, *name, *icon;
g_auto(GStrv) uuids = NULL;
- gboolean default_adapter;
gboolean paired, trusted, connected;
int legacypairing;
BluetoothType type = BLUETOOTH_TYPE_ANY;
- GtkTreeIter parent;
BluetoothDevice *device_obj;
iface = g_dbus_object_get_interface (object, BLUEZ_DEVICE_INTERFACE);
@@ -603,12 +604,7 @@ add_devices_to_list_store (BluetoothClient *client)
continue;
adapter_path = device1_get_adapter (DEVICE1 (iface));
- if (get_iter_from_path (client->store, &parent, adapter_path) == FALSE)
- continue;
- gtk_tree_model_get (GTK_TREE_MODEL(client->store), &parent,
- BLUETOOTH_COLUMN_DEFAULT, &default_adapter,
- -1);
- if (!default_adapter)
+ if (g_strcmp0 (adapter_path, default_adapter_path) != 0)
continue;
address = device1_get_address (DEVICE1 (iface));