[gnome-bluetooth] lib: Add private function to read the adapter name
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-bluetooth] lib: Add private function to read the adapter name
- Date: Mon, 21 Feb 2011 22:24:34 +0000 (UTC)
commit f6a1344779a5fe7c47aa0d2ed4bb2e32a10de664
Author: Bastien Nocera <hadess hadess net>
Date: Mon Feb 21 22:23:54 2011 +0000
lib: Add private function to read the adapter name
lib/bluetooth-client-private.h | 1 +
lib/bluetooth-client.c | 30 ++++++++++++++++++++++++++++++
lib/gnome-bluetooth.symbols | 1 +
3 files changed, 32 insertions(+), 0 deletions(-)
---
diff --git a/lib/bluetooth-client-private.h b/lib/bluetooth-client-private.h
index 07d1501..3938cfe 100644
--- a/lib/bluetooth-client-private.h
+++ b/lib/bluetooth-client-private.h
@@ -40,6 +40,7 @@ gboolean bluetooth_client_stop_discovery(BluetoothClient *client);
gboolean bluetooth_client_set_discoverable (BluetoothClient *client,
gboolean discoverable,
guint timeout);
+char *bluetooth_client_get_name (BluetoothClient *client);
typedef void (*BluetoothClientCreateDeviceFunc) (BluetoothClient *client,
const char *path,
diff --git a/lib/bluetooth-client.c b/lib/bluetooth-client.c
index 301b868..702bdbc 100644
--- a/lib/bluetooth-client.c
+++ b/lib/bluetooth-client.c
@@ -1665,6 +1665,36 @@ bluetooth_client_get_discoverable (BluetoothClient *client)
}
/**
+ * bluetooth_client_get_name:
+ * @client: a #BluetoothClient
+ *
+ * Gets the default adapter's name, cached in the adapter model.
+ *
+ * Returns: the name of the adapter, or %NULL if no default adapter exists
+ */
+char *
+bluetooth_client_get_name (BluetoothClient *client)
+{
+ BluetoothClientPrivate *priv;
+ GtkTreePath *path;
+ GtkTreeIter iter;
+ char *ret;
+
+ g_return_val_if_fail (BLUETOOTH_IS_CLIENT (client), FALSE);
+
+ priv = BLUETOOTH_CLIENT_GET_PRIVATE (client);
+ if (priv->default_adapter == NULL)
+ return NULL;
+
+ 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_NAME, &ret, -1);
+
+ return ret;
+}
+
+/**
* bluetooth_client_set_discoverable:
* @client: a #BluetoothClient object
* @discoverable: whether the device should be discoverable
diff --git a/lib/gnome-bluetooth.symbols b/lib/gnome-bluetooth.symbols
index 1fca324..c26cdb9 100644
--- a/lib/gnome-bluetooth.symbols
+++ b/lib/gnome-bluetooth.symbols
@@ -14,6 +14,7 @@ bluetooth_chooser_get_scrolled_window
bluetooth_chooser_start_discovery
bluetooth_chooser_stop_discovery
bluetooth_client_set_discoverable
+bluetooth_client_get_name
bluetooth_chooser_remove_selected_device
bluetooth_chooser_button_get_type
bluetooth_chooser_button_new
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]