gnome-bluetooth r381 - trunk/common



Author: hadess
Date: Fri Feb 27 00:04:27 2009
New Revision: 381
URL: http://svn.gnome.org/viewvc/gnome-bluetooth?rev=381&view=rev

Log:
Add powered property testing

To check whether the initial values are correct.

Modified:
   trunk/common/test-client.c

Modified: trunk/common/test-client.c
==============================================================================
--- trunk/common/test-client.c	(original)
+++ trunk/common/test-client.c	Fri Feb 27 00:04:27 2009
@@ -213,11 +213,40 @@
 	gtk_widget_show_all(window);
 }
 
+static void
+default_adapter_changed (GObject    *gobject,
+			 GParamSpec *pspec,
+			 gpointer    user_data)
+{
+	char *adapter;
+
+	g_object_get (G_OBJECT (gobject), "default-adapter", &adapter, NULL);
+	g_message ("Default adapter changed: %s", adapter ? adapter : "(none)");
+}
+
+static void
+default_adapter_powered_changed (GObject    *gobject,
+				 GParamSpec *pspec,
+				 gpointer    user_data)
+{
+	gboolean powered;
+
+	g_object_get (G_OBJECT (gobject), "default-adapter-powered", &powered, NULL);
+	g_message ("Default adapter is %s", powered ? "powered" : "switched off");
+}
+
 int main(int argc, char *argv[])
 {
 	gtk_init(&argc, &argv);
 
 	client = bluetooth_client_new();
+	g_signal_connect (G_OBJECT (client), "notify::default-adapter",
+			  G_CALLBACK (default_adapter_changed), NULL);
+	g_signal_connect (G_OBJECT (client), "notify::default-adapter-powered",
+			  G_CALLBACK (default_adapter_powered_changed), NULL);
+
+	default_adapter_changed (G_OBJECT (client), NULL, NULL);
+	default_adapter_powered_changed (G_OBJECT (client), NULL, NULL);
 
 	create_window();
 



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