[gnome-bluetooth] Simplify get_iter_from_proxy()



commit ce55174698241f5559723300e22a44f6d0ae7ee0
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Jun 10 23:34:35 2009 +0100

    Simplify get_iter_from_proxy()
    
    Because it's pretty much all the same code.
---
 lib/bluetooth-client.c |   36 ++++++++++--------------------------
 1 files changed, 10 insertions(+), 26 deletions(-)

diff --git a/lib/bluetooth-client.c b/lib/bluetooth-client.c
index f24ddd7..2b51c81 100644
--- a/lib/bluetooth-client.c
+++ b/lib/bluetooth-client.c
@@ -264,31 +264,6 @@ static gboolean iter_search(GtkTreeStore *store,
 	return found;
 }
 
-static gboolean compare_proxy(GtkTreeStore *store,
-					GtkTreeIter *iter, gpointer user_data)
-{
-	DBusGProxy *proxy = user_data;
-	DBusGProxy *object;
-	gboolean found = FALSE;
-
-	gtk_tree_model_get(GTK_TREE_MODEL(store), iter,
-					BLUETOOTH_COLUMN_PROXY, &object, -1);
-
-	if (object != NULL) {
-		found = g_str_equal(dbus_g_proxy_get_path(proxy),
-						dbus_g_proxy_get_path(object));
-		g_object_unref(object);
-	}
-
-	return found;
-}
-
-static gboolean get_iter_from_proxy(GtkTreeStore *store,
-					GtkTreeIter *iter, DBusGProxy *proxy)
-{
-	return iter_search(store, iter, NULL, compare_proxy, proxy);
-}
-
 static gboolean compare_path(GtkTreeStore *store,
 					GtkTreeIter *iter, gpointer user_data)
 {
@@ -309,11 +284,20 @@ static gboolean compare_path(GtkTreeStore *store,
 
 static gboolean
 get_iter_from_path (GtkTreeStore *store,
-		    GtkTreeIter *iter, const char *path)
+		    GtkTreeIter *iter,
+		    const char *path)
 {
 	return iter_search(store, iter, NULL, compare_path, (gpointer) path);
 }
 
+static gboolean
+get_iter_from_proxy(GtkTreeStore *store,
+		    GtkTreeIter *iter,
+		    DBusGProxy *proxy)
+{
+	return iter_search(store, iter, NULL, compare_path, dbus_g_proxy_get_path (proxy));
+}
+
 static void
 device_services_changed (DBusGProxy *iface, const char *property,
 			 GValue *value, gpointer user_data)



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