[gnome-bluetooth] Add test program for the plugins



commit 99dceba8be49c130135bcb90cfb674c20bc60c8a
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Jun 18 18:10:04 2009 +0100

    Add test program for the plugins

 lib/Makefile.am    |    4 +++-
 lib/test-plugins.c |   38 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+), 1 deletions(-)
---
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 1b806fb..28b17b4 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -55,7 +55,7 @@ nodist_libcommon_la_SOURCES = $(BUILT_SOURCES)
 
 CLEANFILES = $(BUILT_SOURCES)
 
-noinst_PROGRAMS = test-client test-agent test-deviceselection
+noinst_PROGRAMS = test-client test-agent test-deviceselection test-plugins
 
 test_client_LDADD = libcommon.la $(GTK_LIBS) $(DBUS_LIBS)
 
@@ -63,6 +63,8 @@ test_agent_LDADD = libcommon.la $(DBUS_LIBS)
 
 test_deviceselection_LDADD = libgnome-bluetooth.la
 
+test_plugins_LDADD = libcommon.la
+
 EXTRA_DIST = marshal.list \
 		bluetooth-client.xml \
 		bluetooth-agent.xml \
diff --git a/lib/test-plugins.c b/lib/test-plugins.c
new file mode 100644
index 0000000..b3b4f4f
--- /dev/null
+++ b/lib/test-plugins.c
@@ -0,0 +1,38 @@
+#include <gtk/gtk.h>
+#include "bluetooth-plugin-manager.h"
+
+int main (int argc, char **argv)
+{
+	GtkWidget *window, *vbox;
+	GList *list, *l;
+	const char *uuids[] = { "PANU", NULL};
+
+	gtk_init (&argc, &argv);
+
+	bluetooth_plugin_manager_init ();
+
+	window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+	vbox = gtk_vbox_new (FALSE, 6);
+	gtk_container_add (GTK_CONTAINER (window), vbox);
+
+	list = bluetooth_plugin_manager_get_widgets ("11:22:33:44:55:66", uuids);
+	if (list == NULL) {
+		g_message ("no plugins");
+		return 1;
+	}
+
+	for (l = list; l != NULL; l = l->next) {
+		GtkWidget *widget = l->data;
+		gtk_container_add (GTK_CONTAINER (vbox), widget);
+	}
+
+	gtk_widget_show_all (window);
+
+	gtk_main ();
+
+	gtk_widget_destroy (window);
+
+	bluetooth_plugin_manager_cleanup ();
+
+	return 0;
+}



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