[gnome-bluetooth] lib: do not call set discovering if value is the same



commit d10e9e4562d050570090ff934bb91aeb62087f32
Author: Gustavo Padovan <gustavo padovan collabora co uk>
Date:   Fri May 31 20:18:18 2013 -0300

    lib: do not call set discovering if value is the same
    
    We now check if the discovering value we get is equal to the current one.
    Before this check the code was calling org.bluez.Adapter1.StopDiscovery()
    with Discovering already set to False which leads bluetoothd to return a
    error to us.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=701399

 lib/bluetooth-client.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
---
diff --git a/lib/bluetooth-client.c b/lib/bluetooth-client.c
index 019a52e..03ec815 100644
--- a/lib/bluetooth-client.c
+++ b/lib/bluetooth-client.c
@@ -929,12 +929,24 @@ static void
 _bluetooth_client_set_default_adapter_discovering (BluetoothClient *client,
                                                   gboolean         discover)
 {
+       BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE (client);
+       GtkTreeIter iter;
        GDBusProxy *adapter;
+       gboolean current;
 
        adapter = _bluetooth_client_get_default_adapter (client);
        if (adapter == NULL)
                return;
 
+       get_iter_from_proxy (priv->store, &iter, adapter);
+       gtk_tree_model_get (GTK_TREE_MODEL (priv->store), &iter,
+                           BLUETOOTH_COLUMN_DISCOVERING, &current, -1);
+
+       if (current == discover) {
+               g_object_unref(adapter);
+               return;
+       }
+
        if (discover)
                adapter1_call_start_discovery_sync (ADAPTER1 (adapter), NULL, NULL);
        else


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