[gnome-bluetooth/wip/hadess/remove-gtk-tree: 6/18] lib: Simplify device_notify_cb()
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth/wip/hadess/remove-gtk-tree: 6/18] lib: Simplify device_notify_cb()
- Date: Thu, 2 Dec 2021 11:03:44 +0000 (UTC)
commit 3607faf8e4d9c5c8468d70c2e63dc0d27f6555d1
Author: Bastien Nocera <hadess hadess net>
Date: Wed Dec 1 15:18:07 2021 +0100
lib: Simplify device_notify_cb()
Using new helper
lib/bluetooth-client.c | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)
---
diff --git a/lib/bluetooth-client.c b/lib/bluetooth-client.c
index dabc9009..b0a1b8d8 100644
--- a/lib/bluetooth-client.c
+++ b/lib/bluetooth-client.c
@@ -343,7 +343,6 @@ device_notify_cb (Device1 *device1,
{
const char *property = g_param_spec_get_name (pspec);
GtkTreeIter iter;
- guint i, n_items;
g_autoptr(BluetoothDevice) device = NULL;
const char *device_path;
@@ -351,17 +350,7 @@ device_notify_cb (Device1 *device1,
return;
device_path = g_dbus_proxy_get_object_path (G_DBUS_PROXY (device1));
- n_items = g_list_model_get_n_items (G_LIST_MODEL (client->list_store));
- for (i = 0; i < n_items; i++) {
- g_autoptr(BluetoothDevice) d = NULL;
-
- d = g_list_model_get_item (G_LIST_MODEL (client->list_store), i);
- if (g_str_equal (device_path, bluetooth_device_get_object_path (d))) {
- device = g_steal_pointer (&d);
- break;
- }
- }
-
+ device = get_device_for_path (client, device_path);
if (!device) {
g_debug ("Device %s was not known, so property '%s' not applied", device_path, property);
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]