[gnome-bluetooth] lib: Insert data straight away



commit 3ad555e76e33e4e55c4b76bc46e149efaf57c514
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Nov 28 10:57:04 2013 +0100

    lib: Insert data straight away
    
    The data is available, so insert the new devices with their values
    straight away. This means that front-ends don't receive as many
    signals, and that they don't have to filter out NULL names.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=719564

 lib/bluetooth-client.c |   48 +++++++++++++++++++++++++++++++-----------------
 1 files changed, 31 insertions(+), 17 deletions(-)
---
diff --git a/lib/bluetooth-client.c b/lib/bluetooth-client.c
index d83c8d6..7149dc6 100644
--- a/lib/bluetooth-client.c
+++ b/lib/bluetooth-client.c
@@ -403,23 +403,37 @@ device_added (ObjectManager   *manager,
        gtk_tree_model_get (GTK_TREE_MODEL(priv->store), &parent,
                            BLUETOOTH_COLUMN_PROXY, &adapter, -1);
 
-       if (get_iter_from_address (priv->store, &iter, address, adapter) == FALSE)
-               gtk_tree_store_insert (priv->store, &iter, &parent, -1);
-
-       gtk_tree_store_set(priv->store, &iter,
-                          BLUETOOTH_COLUMN_ADDRESS, address,
-                          BLUETOOTH_COLUMN_ALIAS, alias,
-                          BLUETOOTH_COLUMN_NAME, name,
-                          BLUETOOTH_COLUMN_TYPE, type,
-                          BLUETOOTH_COLUMN_ICON, icon,
-                          BLUETOOTH_COLUMN_LEGACYPAIRING, legacypairing,
-                          BLUETOOTH_COLUMN_UUIDS, uuids,
-                          BLUETOOTH_COLUMN_PAIRED, paired,
-                          BLUETOOTH_COLUMN_CONNECTED, connected,
-                          BLUETOOTH_COLUMN_TRUSTED, trusted,
-                          BLUETOOTH_COLUMN_PROXY, device,
-                          BLUETOOTH_COLUMN_PROPERTIES, properties,
-                          -1);
+       if (get_iter_from_address (priv->store, &iter, address, adapter) == FALSE) {
+               gtk_tree_store_insert_with_values (priv->store, &iter, &parent, -1,
+                                                  BLUETOOTH_COLUMN_ADDRESS, address,
+                                                  BLUETOOTH_COLUMN_ALIAS, alias,
+                                                  BLUETOOTH_COLUMN_NAME, name,
+                                                  BLUETOOTH_COLUMN_TYPE, type,
+                                                  BLUETOOTH_COLUMN_ICON, icon,
+                                                  BLUETOOTH_COLUMN_LEGACYPAIRING, legacypairing,
+                                                  BLUETOOTH_COLUMN_UUIDS, uuids,
+                                                  BLUETOOTH_COLUMN_PAIRED, paired,
+                                                  BLUETOOTH_COLUMN_CONNECTED, connected,
+                                                  BLUETOOTH_COLUMN_TRUSTED, trusted,
+                                                  BLUETOOTH_COLUMN_PROXY, device,
+                                                  BLUETOOTH_COLUMN_PROPERTIES, properties,
+                                                  -1);
+       } else {
+               gtk_tree_store_set(priv->store, &iter,
+                                  BLUETOOTH_COLUMN_ADDRESS, address,
+                                  BLUETOOTH_COLUMN_ALIAS, alias,
+                                  BLUETOOTH_COLUMN_NAME, name,
+                                  BLUETOOTH_COLUMN_TYPE, type,
+                                  BLUETOOTH_COLUMN_ICON, icon,
+                                  BLUETOOTH_COLUMN_LEGACYPAIRING, legacypairing,
+                                  BLUETOOTH_COLUMN_UUIDS, uuids,
+                                  BLUETOOTH_COLUMN_PAIRED, paired,
+                                  BLUETOOTH_COLUMN_CONNECTED, connected,
+                                  BLUETOOTH_COLUMN_TRUSTED, trusted,
+                                  BLUETOOTH_COLUMN_PROXY, device,
+                                  BLUETOOTH_COLUMN_PROPERTIES, properties,
+                                  -1);
+       }
        g_strfreev (uuids);
 
        g_signal_connect (G_OBJECT (device), "g-properties-changed",


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