[gnome-bluetooth] lib: Remove unused adapter parameter



commit 0b0aef39a6e2f5c48b01e5b4e31bfdedf27002cb
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Sep 22 18:12:15 2011 +0100

    lib: Remove unused adapter parameter
    
    to bluetooth_client_get_device_model(). Seeing as every caller
    was just using the default adapter anyway.

 applet/bluetooth-applet.c      |    5 +----
 lib/bluetooth-chooser-button.c |    2 +-
 lib/bluetooth-chooser.c        |    4 ++--
 lib/bluetooth-client.c         |   18 ++++--------------
 lib/bluetooth-client.h         |    3 +--
 lib/plugins/geoclue.c          |    2 +-
 6 files changed, 10 insertions(+), 24 deletions(-)
---
diff --git a/applet/bluetooth-applet.c b/applet/bluetooth-applet.c
index a0c24e6..a05746e 100644
--- a/applet/bluetooth-applet.c
+++ b/applet/bluetooth-applet.c
@@ -495,10 +495,7 @@ default_adapter_changed (GObject    *client,
 		g_signal_handler_disconnect (self->device_model, self->signal_row_deleted);
 		g_object_unref (self->device_model);
 	}
-	if (self->default_adapter)
-		self->device_model = bluetooth_client_get_device_model (self->client, self->default_adapter);
-	else
-		self->device_model = NULL;
+	self->device_model = bluetooth_client_get_device_model (self->client);
 
 	if (self->device_model) {
 		self->signal_row_added = g_signal_connect (self->device_model, "row-inserted",
diff --git a/lib/bluetooth-chooser-button.c b/lib/bluetooth-chooser-button.c
index d713195..5ced45a 100644
--- a/lib/bluetooth-chooser-button.c
+++ b/lib/bluetooth-chooser-button.c
@@ -88,7 +88,7 @@ set_btdevname (BluetoothChooserButton *button, const char *bdaddr, const char *n
 		GtkTreeIter iter;
 		gboolean cont = FALSE;
 
-		model = bluetooth_client_get_device_model (button->client, NULL);
+		model = bluetooth_client_get_device_model (button->client);
 		if (model != NULL) {
 			cont = gtk_tree_model_iter_children (GTK_TREE_MODEL(model),
 							     &iter, NULL);
diff --git a/lib/bluetooth-chooser.c b/lib/bluetooth-chooser.c
index 0c7073e..f738c65 100644
--- a/lib/bluetooth-chooser.c
+++ b/lib/bluetooth-chooser.c
@@ -748,7 +748,7 @@ static void default_adapter_changed (GObject    *gobject,
 
 	g_free (adapter);
 
-	priv->model = bluetooth_client_get_device_model (priv->client, NULL);
+	priv->model = bluetooth_client_get_device_model (priv->client);
 	if (priv->model) {
 		priv->filter = gtk_tree_model_filter_new (priv->model, NULL);
 		gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (priv->filter),
@@ -844,7 +844,7 @@ create_treeview (BluetoothChooser *self)
 			  G_CALLBACK(select_browse_device_callback), self);
 
 	/* Set the model, and filter */
-	priv->model = bluetooth_client_get_device_model (priv->client, NULL);
+	priv->model = bluetooth_client_get_device_model (priv->client);
 	if (priv->model) {
 		priv->filter = gtk_tree_model_filter_new (priv->model, NULL);
 		gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (priv->filter),
diff --git a/lib/bluetooth-client.c b/lib/bluetooth-client.c
index 1309e0c..68ebfed 100644
--- a/lib/bluetooth-client.c
+++ b/lib/bluetooth-client.c
@@ -1201,14 +1201,12 @@ GtkTreeModel *bluetooth_client_get_adapter_model (BluetoothClient *client)
 /**
  * bluetooth_client_get_device_model:
  * @client: a #BluetoothClient object
- * @adapter: a #DBusGProxy of the adapter object, or %NULL to get the default adapter.
  *
- * Returns a filtered #GtkTreeModel with only devices belonging to the selected adapter listed. Note that the model will follow a specific adapter, and will not follow the default-adapter when %NULL is passed.
+ * Returns a filtered #GtkTreeModel with only devices belonging to the default adapter listed. Note that the model will follow a specific adapter, and will not follow the default-adapter.
  *
  * Return value: (transfer full): a #GtkTreeModel object.
  **/
-GtkTreeModel *bluetooth_client_get_device_model (BluetoothClient *client,
-						 DBusGProxy *adapter)
+GtkTreeModel *bluetooth_client_get_device_model (BluetoothClient *client)
 {
 	BluetoothClientPrivate *priv;
 	GtkTreeModel *model;
@@ -1225,23 +1223,15 @@ GtkTreeModel *bluetooth_client_get_device_model (BluetoothClient *client,
 									&iter);
 
 	while (cont == TRUE) {
-		DBusGProxy *proxy;
 		gboolean is_default;
 
 		gtk_tree_model_get(GTK_TREE_MODEL(priv->store), &iter,
-				BLUETOOTH_COLUMN_PROXY, &proxy,
 				BLUETOOTH_COLUMN_DEFAULT, &is_default, -1);
 
-		if (adapter == NULL && is_default == TRUE)
+		if (is_default == TRUE) {
 			found = TRUE;
-
-		if (proxy == adapter)
-			found = TRUE;
-
-		g_object_unref(proxy);
-
-		if (found == TRUE)
 			break;
+		}
 
 		cont = gtk_tree_model_iter_next(GTK_TREE_MODEL(priv->store),
 									&iter);
diff --git a/lib/bluetooth-client.h b/lib/bluetooth-client.h
index 9a4322a..e51b476 100644
--- a/lib/bluetooth-client.h
+++ b/lib/bluetooth-client.h
@@ -64,8 +64,7 @@ GtkTreeModel *bluetooth_client_get_filter_model(BluetoothClient *client,
 				GtkTreeModelFilterVisibleFunc func,
 				gpointer data, GDestroyNotify destroy);
 GtkTreeModel *bluetooth_client_get_adapter_model(BluetoothClient *client);
-GtkTreeModel *bluetooth_client_get_device_model(BluetoothClient *client,
-							DBusGProxy *adapter);
+GtkTreeModel *bluetooth_client_get_device_model(BluetoothClient *client);
 
 gboolean bluetooth_client_get_discoverable (BluetoothClient *client);
 
diff --git a/lib/plugins/geoclue.c b/lib/plugins/geoclue.c
index af368f0..463865a 100644
--- a/lib/plugins/geoclue.c
+++ b/lib/plugins/geoclue.c
@@ -47,7 +47,7 @@ get_name_and_type (const char *address, BluetoothType *ret_type)
 	found_name = NULL;
 	*ret_type = 0;
 	client = bluetooth_client_new (); 
-	model = bluetooth_client_get_device_model (client, NULL);
+	model = bluetooth_client_get_device_model (client);
 	if (model == NULL) {
 		g_object_unref (client);
 		return NULL;



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