[gnome-bluetooth/wip/hadess/remove-gtk-tree: 7/18] lib: Use GListModel in _setup_device()
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth/wip/hadess/remove-gtk-tree: 7/18] lib: Use GListModel in _setup_device()
- Date: Thu, 2 Dec 2021 11:03:44 +0000 (UTC)
commit 57f47018fb55a3a6767a89dea211f837bff61931
Author: Bastien Nocera <hadess hadess net>
Date: Wed Dec 1 15:18:58 2021 +0100
lib: Use GListModel in _setup_device()
lib/bluetooth-client.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/lib/bluetooth-client.c b/lib/bluetooth-client.c
index b0a1b8d8..127f7cdb 100644
--- a/lib/bluetooth-client.c
+++ b/lib/bluetooth-client.c
@@ -1346,8 +1346,8 @@ bluetooth_client_setup_device (BluetoothClient *client,
gpointer user_data)
{
GTask *task;
- g_autoptr(GDBusProxy) device = NULL;
- GtkTreeIter iter;
+ g_autoptr(BluetoothDevice) device = NULL;
+ g_autoptr(GDBusProxy) proxy = NULL;
g_return_if_fail (BLUETOOTH_IS_CLIENT (client));
g_return_if_fail (path != NULL);
@@ -1359,7 +1359,8 @@ bluetooth_client_setup_device (BluetoothClient *client,
g_task_set_source_tag (task, bluetooth_client_setup_device);
g_task_set_task_data (task, g_strdup (path), (GDestroyNotify) g_free);
- if (get_iter_from_path (client->store, &iter, path) == FALSE) {
+ device = get_device_for_path (client, path);
+ if (!device) {
g_task_return_new_error (task, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
"Device with object path %s does not exist",
path);
@@ -1367,12 +1368,12 @@ bluetooth_client_setup_device (BluetoothClient *client,
return;
}
- gtk_tree_model_get (GTK_TREE_MODEL(client->store), &iter,
- BLUETOOTH_COLUMN_PROXY, &device,
- -1);
+ g_object_get (device,
+ "proxy", &proxy,
+ NULL);
if (pair == TRUE) {
- device1_call_pair (DEVICE1(device),
+ device1_call_pair (DEVICE1(proxy),
cancellable,
(GAsyncReadyCallback) device_pair_callback,
task);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]