[gnome-bluetooth] Add test case for _get_selected_device_info()
- From: Bastien Nocera <hadess src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-bluetooth] Add test case for _get_selected_device_info()
- Date: Thu, 28 May 2009 08:52:17 -0400 (EDT)
commit b0393546760ae5f841560758d199cc11eb6763ee
Author: Bastien Nocera <hadess hadess net>
Date: Thu May 28 13:50:41 2009 +0100
Add test case for _get_selected_device_info()
Print out a few of the fields we might be interested in.
---
common/test-deviceselection.c | 33 +++++++++++++++++++++++++++++++++
1 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/common/test-deviceselection.c b/common/test-deviceselection.c
index ae6f251..fa1c31b 100644
--- a/common/test-deviceselection.c
+++ b/common/test-deviceselection.c
@@ -32,6 +32,38 @@
#include "bluetooth-chooser-button.h"
#include "bluetooth-client.h"
+static void dump_selected_device(BluetoothChooser *sel)
+{
+ GValue value = { 0, };
+
+ g_print ("Info dumped\n");
+ if (bluetooth_chooser_get_selected_device_info (sel, "address", &value)) {
+ g_print ("\tAddress: '%s'\n", g_value_get_string (&value));
+ g_value_unset (&value);
+ }
+ if (bluetooth_chooser_get_selected_device_info (sel, "name", &value)) {
+ g_print ("\tName: '%s'\n", g_value_get_string (&value));
+ g_value_unset (&value);
+ }
+ if (bluetooth_chooser_get_selected_device_info (sel, "connected", &value)) {
+ g_print ("\tConnected: %s\n", g_value_get_boolean (&value) ? "True" : "False");
+ g_value_unset (&value);
+ }
+ if (bluetooth_chooser_get_selected_device_info (sel, "uuids", &value)) {
+ guint i;
+ const char **uuids;
+
+ uuids = (const char **) g_value_get_boxed (&value);
+ if (uuids != NULL) {
+ g_print ("\tUUIDs: ");
+ for (i = 0; uuids[i] != NULL; i++)
+ g_print ("%s, ", uuids[i]);
+ g_print ("\n");
+ }
+ g_value_unset (&value);
+ }
+}
+
static void select_device_changed(BluetoothChooser *sel,
gchar *address, gpointer user_data)
{
@@ -48,6 +80,7 @@ static void device_selected_cb(GObject *object,
GParamSpec *spec, gpointer user_data)
{
g_message ("Property \"device-selected\" changed");
+ dump_selected_device(BLUETOOTH_CHOOSER (object));
}
static void device_selected_name_cb(GObject *object,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]