[gnome-bluetooth/wip/hadess/small-fixes: 2/8] lib: Add debug when manipulating model




commit 1a8b66fbf1dd89df646adef57def1e755e8c26ed
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 | 13 +++++++++++++
 1 file changed, 13 insertions(+)
---
diff --git a/lib/bluetooth-client.c b/lib/bluetooth-client.c
index 6bd784df..54a6ef86 100644
--- a/lib/bluetooth-client.c
+++ b/lib/bluetooth-client.c
@@ -410,6 +410,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 (client->store, &parent, adapter_path) == FALSE)
                return;
 
@@ -455,6 +457,8 @@ device_removed (const char      *path,
 {
        GtkTreeIter iter;
 
+       g_debug ("Removing device '%s'", path);
+
        if (get_iter_from_path(client->store, &iter, path) == TRUE) {
                /* Note that removal can also happen from adapter_removed. */
                g_signal_emit (G_OBJECT (client), signals[DEVICE_REMOVED], 0, path);
@@ -520,6 +524,8 @@ default_adapter_changed (GDBusObjectManager   *manager,
        if (get_iter_from_path (client->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 (client->store), &iter);
        client->default_adapter = gtk_tree_row_reference_new (GTK_TREE_MODEL (client->store), tree_path);
        gtk_tree_path_free (tree_path);
@@ -635,6 +641,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(client->store, &iter, NULL, -1,
                                          BLUETOOTH_COLUMN_PROXY, adapter,
                                          BLUETOOTH_COLUMN_ADDRESS, address,
@@ -667,6 +675,8 @@ adapter_removed (GDBusObjectManager   *manager,
        if (get_iter_from_path (client->store, &iter, path) == FALSE)
                return;
 
+       g_debug ("Removing adapter '%s'", path);
+
        gtk_tree_model_get (GTK_TREE_MODEL(client->store), &iter,
                           BLUETOOTH_COLUMN_DEFAULT, &was_default, -1);
 
@@ -832,6 +842,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;
@@ -845,6 +856,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;
@@ -1440,6 +1452,7 @@ bluetooth_client_get_device (BluetoothClient *client,
        GDBusProxy *proxy;
 
        if (get_iter_from_path (client->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]