[gnome-bluetooth/wip/hadess/remove-gtk-tree: 7/19] lib: Remove GtkTreeModel usage when populating GListModel
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth/wip/hadess/remove-gtk-tree: 7/19] lib: Remove GtkTreeModel usage when populating GListModel
- Date: Wed, 1 Dec 2021 16:43:24 +0000 (UTC)
commit e419e8aab4c29d96e647f849bb177b120952cceb
Author: Bastien Nocera <hadess hadess net>
Date: Wed Dec 1 15:33:36 2021 +0100
lib: Remove GtkTreeModel usage when populating GListModel
lib/bluetooth-client.c | 12 ++++--------
1 file 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));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]