[gnome-bluetooth] lib: Add killswitch test



commit d92256edbf6b4b2a99ae6b11e9aacd26cb2870a4
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Jul 23 17:57:20 2012 +0100

    lib: Add killswitch test

 lib/Makefile.am       |    4 +++-
 lib/test-killswitch.c |   30 ++++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+), 1 deletions(-)
---
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 70bac1e..a9f5d10 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -100,7 +100,7 @@ BUILT_SOURCES = bluetooth-client-glue.h \
 
 CLEANFILES += $(BUILT_SOURCES)
 
-noinst_PROGRAMS = test-client test-agent test-deviceselection test-plugins test-class
+noinst_PROGRAMS = test-client test-agent test-deviceselection test-plugins test-class test-killswitch
 
 test_client_LDADD = libgnome-bluetooth.la $(LIBGNOMEBT_LIBS)
 
@@ -112,6 +112,8 @@ test_plugins_LDADD = libgnome-bluetooth.la $(LIBGNOMEBT_LIBS)
 
 test_class_LDADD = libgnome-bluetooth.la $(LIBGNOMEBT_LIBS)
 
+test_killswitch_LDADD = libgnome-bluetooth.la $(LIBGNOMEBT_LIBS)
+
 EXTRA_DIST += bluetooth-client.xml gnome-bluetooth.symbols
 
 MAINTAINERCLEANFILES = Makefile.in
diff --git a/lib/test-killswitch.c b/lib/test-killswitch.c
new file mode 100644
index 0000000..5ae5652
--- /dev/null
+++ b/lib/test-killswitch.c
@@ -0,0 +1,30 @@
+#include <glib-object.h>
+#include "bluetooth-killswitch.h"
+
+static void
+state_changed_cb (BluetoothKillswitch *killswitch,
+		  BluetoothKillswitchState state,
+		  gpointer user_data)
+{
+	g_message ("killswitch changed to state '%s'",
+		   bluetooth_killswitch_state_to_string (state));
+}
+
+int main (int argc, char **argv)
+{
+	GMainLoop *mainloop;
+	BluetoothKillswitch *ks;
+
+	g_setenv ("G_MESSAGES_DEBUG", "all", TRUE);
+	g_type_init ();
+
+	mainloop = g_main_loop_new (NULL, FALSE);
+
+	ks = bluetooth_killswitch_new ();
+	g_signal_connect (G_OBJECT (ks), "state-changed",
+			  G_CALLBACK (state_changed_cb), NULL);
+
+	g_main_loop_run (mainloop);
+
+	return 0;
+}



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