[gnome-control-center] wacom: Add test program for the pages



commit da26a8e1cf1c478c57bd0bc38135e09ab3852736
Author: Bastien Nocera <hadess hadess net>
Date:   Fri Nov 25 17:03:19 2011 +0000

    wacom: Add test program for the pages
    
    No need to carry hardware around, cheers!

 panels/wacom/Makefile.am  |   12 +++++++++
 panels/wacom/test-wacom.c |   60 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 72 insertions(+), 0 deletions(-)
---
diff --git a/panels/wacom/Makefile.am b/panels/wacom/Makefile.am
index 8187963..67a6cce 100644
--- a/panels/wacom/Makefile.am
+++ b/panels/wacom/Makefile.am
@@ -26,6 +26,18 @@ libwacom_properties_la_SOURCES =	\
 libwacom_properties_la_LIBADD = $(PANEL_LIBS) $(WACOM_PANEL_LIBS)
 libwacom_properties_la_LDFLAGS = $(PANEL_LDFLAGS)
 
+noinst_PROGRAMS = test-wacom
+
+test_wacom_SOURCES =			\
+	test-wacom.c			\
+	cc-wacom-page.c			\
+	cc-wacom-page.h			\
+	gsd-wacom-device.c		\
+	gsd-wacom-device.h
+
+test_wacom_CPPFLAGS = $(INCLUDES)
+test_wacom_LDADD = $(PANEL_LIBS) $(WACOM_PANEL_LIBS)
+
 @INTLTOOL_DESKTOP_RULE@
 
 pixmapdir = $(pkgdatadir)/pixmaps
diff --git a/panels/wacom/test-wacom.c b/panels/wacom/test-wacom.c
new file mode 100644
index 0000000..fe76308
--- /dev/null
+++ b/panels/wacom/test-wacom.c
@@ -0,0 +1,60 @@
+#include "cc-wacom-page.h"
+#include "gsd-wacom-device.h"
+
+static void
+add_page (GList *devices,
+	  GtkWidget *notebook)
+{
+	GtkWidget *widget;
+	GsdWacomDevice *stylus, *eraser;
+	GList *l;
+
+	stylus = eraser = NULL;
+	for (l = devices; l ; l = l->next) {
+		switch (gsd_wacom_device_get_device_type (l->data)) {
+		case WACOM_TYPE_ERASER:
+			eraser = l->data;
+			break;
+		case WACOM_TYPE_STYLUS:
+			stylus = l->data;
+			break;
+		default:
+			/* Nothing */
+			;
+		}
+	}
+	g_list_free (devices);
+
+	widget = cc_wacom_page_new (stylus, eraser);
+	gtk_notebook_append_page (GTK_NOTEBOOK (notebook), widget, NULL);
+}
+
+int main (int argc, char **argv)
+{
+	GtkWidget *window, *notebook;
+	GList *devices;
+
+	gtk_init (&argc, &argv);
+
+	window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+	notebook = gtk_notebook_new ();
+//	gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE);
+	gtk_widget_set_vexpand (notebook, TRUE);
+	gtk_container_set_border_width (GTK_CONTAINER (notebook), 24);
+	gtk_container_add (GTK_CONTAINER (window), notebook);
+
+	devices = gsd_wacom_device_create_fake_cintiq ();
+	add_page (devices, notebook);
+
+	devices = gsd_wacom_device_create_fake_bt ();
+	add_page (devices, notebook);
+
+	devices = gsd_wacom_device_create_fake_x201 ();
+	add_page (devices, notebook);
+
+	gtk_widget_show_all (window);
+
+	gtk_main ();
+
+	return 0;
+}



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