[gnome-bluetooth/wip/hadess/remove-gtk-tree: 4/18] lib: Remove sync device removal during setup




commit 791018a5d0ba02f9325afa086b619139122bfab7
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Dec 1 14:15:05 2021 +0100

    lib: Remove sync device removal during setup
    
    RemoveDevice() in bluetoothd:
    - marks a device as temporary, thus removed when discovery finishes
    - disconnect the device if it was connected
    - remove the device from the D-Bus hierarchy
    
    At no point would we be able to remove a device and then pair with it as
    the object path would suddenly be invalid.

 lib/bluetooth-client.c | 21 ++-------------------
 1 file changed, 2 insertions(+), 19 deletions(-)
---
diff --git a/lib/bluetooth-client.c b/lib/bluetooth-client.c
index b6504f9d..cc608f36 100644
--- a/lib/bluetooth-client.c
+++ b/lib/bluetooth-client.c
@@ -1340,8 +1340,7 @@ bluetooth_client_setup_device (BluetoothClient          *client,
 {
        GTask *task;
        g_autoptr(GDBusProxy) device = NULL;
-       GtkTreeIter iter, adapter_iter;
-       gboolean paired;
+       GtkTreeIter iter;
 
        g_return_if_fail (BLUETOOTH_IS_CLIENT (client));
        g_return_if_fail (path != NULL);
@@ -1363,23 +1362,7 @@ bluetooth_client_setup_device (BluetoothClient          *client,
 
        gtk_tree_model_get (GTK_TREE_MODEL(client->store), &iter,
                            BLUETOOTH_COLUMN_PROXY, &device,
-                           BLUETOOTH_COLUMN_PAIRED, &paired, -1);
-
-       if (paired != FALSE &&
-           gtk_tree_model_iter_parent (GTK_TREE_MODEL(client->store), &adapter_iter, &iter)) {
-               GDBusProxy *adapter;
-               g_autoptr(GError) err = NULL;
-
-               gtk_tree_model_get (GTK_TREE_MODEL(client->store), &adapter_iter,
-                                   BLUETOOTH_COLUMN_PROXY, &adapter,
-                                   -1);
-               adapter1_call_remove_device_sync (ADAPTER1 (adapter),
-                                                 path,
-                                                 NULL, &err);
-               if (err != NULL)
-                       g_warning ("Failed to remove device: %s", err->message);
-               g_object_unref (adapter);
-       }
+                           -1);
 
        if (pair == TRUE) {
                device1_call_pair (DEVICE1(device),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]