[gnome-bluetooth/wip/hadess/lib-changes: 4/8] lib: Add some g_debug() when manipulating model




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

    lib: Add some g_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 90865b3a..4529b369 100644
--- a/lib/bluetooth-client.c
+++ b/lib/bluetooth-client.c
@@ -412,6 +412,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;
 
@@ -457,6 +459,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);
@@ -522,6 +526,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);
@@ -637,6 +643,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,
@@ -669,6 +677,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);
 
@@ -834,6 +844,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;
@@ -847,6 +858,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;
@@ -1461,6 +1473,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]