[gnome-bluetooth/wip/hadess/bluetooth-off-turn-off] lib: Add debug when manipulating model



commit 9c5b3ab418f8be6f390153b558b0cdad06762ecb
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Nov 23 15:19:42 2021 +0100

    lib: Add debug when manipulating model

 lib/bluetooth-client.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
---
diff --git a/lib/bluetooth-client.c b/lib/bluetooth-client.c
index 1fe3f4ad..7a0dbe4b 100644
--- a/lib/bluetooth-client.c
+++ b/lib/bluetooth-client.c
@@ -414,6 +414,8 @@ device_added (GDBusObjectManager   *manager,
 
        device_resolve_type_and_icon (device, &type, &icon);
 
+       g_debug ("Inserting device '%s' on adapter '%s'", address, adapter_path);
+
        if (get_iter_from_path (priv->store, &parent, adapter_path) == FALSE)
                return;
 
@@ -460,6 +462,8 @@ device_removed (const char      *path,
        BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE(client);
        GtkTreeIter iter;
 
+       g_debug ("Removing device '%s'", path);
+
        if (get_iter_from_path(priv->store, &iter, path) == TRUE) {
                /* Note that removal can also happen from adapter_removed. */
                g_signal_emit (G_OBJECT (client), signals[DEVICE_REMOVED], 0, path);
@@ -527,8 +531,11 @@ default_adapter_changed (GDBusObjectManager   *manager,
        if (get_iter_from_path (priv->store, &iter, path) == FALSE)
                return;
 
+       g_debug ("Setting '%s' as the new default adapter", path);
+
        tree_path = gtk_tree_model_get_path (GTK_TREE_MODEL (priv->store), &iter);
        priv->default_adapter = gtk_tree_row_reference_new (GTK_TREE_MODEL (priv->store), tree_path);
+       gtk_tree_path_free (tree_path);
 
        gtk_tree_model_get (GTK_TREE_MODEL(priv->store), &iter,
                            BLUETOOTH_COLUMN_DEFAULT, &is_default,
@@ -647,6 +654,8 @@ adapter_added (GDBusObjectManager   *manager,
        powered = adapter1_get_powered (adapter);
        discoverable = adapter1_get_discoverable (adapter);
 
+       g_debug ("Inserting adapter '%s'", address);
+
        gtk_tree_store_insert_with_values(priv->store, &iter, NULL, -1,
                                          BLUETOOTH_COLUMN_PROXY, adapter,
                                          BLUETOOTH_COLUMN_ADDRESS, address,
@@ -677,6 +686,8 @@ adapter_removed (GDBusObjectManager   *manager,
        if (get_iter_from_path (priv->store, &iter, path) == FALSE)
                return;
 
+       g_debug ("Removing adapter '%s'", path);
+
        gtk_tree_model_get (GTK_TREE_MODEL(priv->store), &iter,
                           BLUETOOTH_COLUMN_DEFAULT, &was_default, -1);
 
@@ -840,6 +851,7 @@ object_manager_new_callback(GObject      *source_object,
        /* We need to add the adapters first, otherwise the devices will
         * be dropped to the floor, as they wouldn't have a parent in
         * the treestore */
+       g_debug ("Adding adapters from ObjectManager");
        for (l = object_list; l != NULL; l = l->next) {
                GDBusObject *object = l->data;
                GDBusInterface *iface;
@@ -853,6 +865,7 @@ object_manager_new_callback(GObject      *source_object,
                               client);
        }
 
+       g_debug ("Adding devices from ObjectManager");
        for (l = object_list; l != NULL; l = l->next) {
                GDBusObject *object = l->data;
                GDBusInterface *iface;
@@ -1561,6 +1574,7 @@ bluetooth_client_get_device (BluetoothClient *client,
        GDBusProxy *proxy;
 
        if (get_iter_from_path (priv->store, &iter, path) == FALSE) {
+               g_debug ("Couldn't find device '%s' in tree", path);
                return NULL;
        }
 


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