[gnome-bluetooth] lib: Make _set_discoverable() more efficient
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth] lib: Make _set_discoverable() more efficient
- Date: Fri, 6 Dec 2013 11:03:21 +0000 (UTC)
commit 10f0cf5ca37b8f79a69829a545d39cd71747beec
Author: Bastien Nocera <hadess hadess net>
Date: Mon Dec 2 14:41:44 2013 +0100
lib: Make _set_discoverable() more efficient
Get the properties proxy directly from the adapter treepath.
This avoids an unnecessary search in the treeview.
https://bugzilla.gnome.org/show_bug.cgi?id=719564
lib/bluetooth-client.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/lib/bluetooth-client.c b/lib/bluetooth-client.c
index ff062e0..db799ca 100644
--- a/lib/bluetooth-client.c
+++ b/lib/bluetooth-client.c
@@ -996,20 +996,21 @@ _bluetooth_client_set_discoverable (BluetoothClient *client,
{
BluetoothClientPrivate *priv = BLUETOOTH_CLIENT_GET_PRIVATE (client);
GError *error = NULL;
- GDBusProxy *adapter;
+ GtkTreePath *path;
Properties *properties;
gboolean ret;
GtkTreeIter iter;
g_return_val_if_fail (BLUETOOTH_IS_CLIENT (client), FALSE);
- adapter = _bluetooth_client_get_default_adapter (client);
- if (adapter == NULL)
+ if (priv->default_adapter == NULL)
return FALSE;
- get_iter_from_proxy (priv->store, &iter, adapter);
+ path = gtk_tree_row_reference_get_path (priv->default_adapter);
+ gtk_tree_model_get_iter (GTK_TREE_MODEL (priv->store), &iter, path);
gtk_tree_model_get (GTK_TREE_MODEL (priv->store), &iter,
- BLUETOOTH_COLUMN_PROPERTIES, &properties, -1);
+ BLUETOOTH_COLUMN_PROPERTIES, &properties, -1);
+ gtk_tree_path_free (path);
if (properties == NULL)
return FALSE;
@@ -1035,7 +1036,6 @@ _bluetooth_client_set_discoverable (BluetoothClient *client,
}
g_object_unref (properties);
- g_object_unref(adapter);
return ret;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]