summaryrefslogtreecommitdiff
path: root/lib/bluetooth-client.c
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2021-12-01 16:00:25 +0100
committerBastien Nocera <hadess@hadess.net>2021-12-02 12:03:07 +0100
commite623883d32cd25cfb742079040d1661584d84114 (patch)
treef482e93f940c1f7b50c2ec184e6579712290db7a /lib/bluetooth-client.c
parent406cf79bf8f65791299e6893ba81522f1ac310cf (diff)
downloadgnome-bluetooth-e623883d32cd25cfb742079040d1661584d84114.tar.gz
lib: Use GListModel in _set_trusted()
Diffstat (limited to 'lib/bluetooth-client.c')
-rw-r--r--lib/bluetooth-client.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/lib/bluetooth-client.c b/lib/bluetooth-client.c
index 37db9de9..20af2d23 100644
--- a/lib/bluetooth-client.c
+++ b/lib/bluetooth-client.c
@@ -1481,25 +1481,23 @@ bluetooth_client_set_trusted (BluetoothClient *client,
const char *device_path,
gboolean trusted)
{
- GObject *device;
- GtkTreeIter iter;
+ g_autoptr(BluetoothDevice) device = NULL;
+ g_autoptr(GDBusProxy) proxy = NULL;
g_return_val_if_fail (BLUETOOTH_IS_CLIENT (client), FALSE);
g_return_val_if_fail (device_path != NULL, FALSE);
- if (get_iter_from_path (client->store, &iter, device_path) == FALSE) {
+ device = get_device_for_path (client, device_path);
+ if (device == NULL) {
g_debug ("Couldn't find device '%s' in tree to mark it as trusted", device_path);
return FALSE;
}
- gtk_tree_model_get (GTK_TREE_MODEL (client->store), &iter,
- BLUETOOTH_COLUMN_PROXY, &device, -1);
-
- if (device == NULL)
- return FALSE;
+ g_object_get (G_OBJECT (device),
+ "proxy", &proxy,
+ NULL);
- g_object_set (device, "trusted", trusted, NULL);
- g_object_unref (device);
+ g_object_set (proxy, "trusted", trusted, NULL);
return TRUE;
}