summaryrefslogtreecommitdiffstats
path: root/panels/wacom/test-wacom.c
blob: 5e4cf7e7a0f5f4a0f7c905384d0c27f824450a55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
#include "config.h"

#include <glib/gi18n.h>

#include "cc-wacom-page.h"

#define FIXED_WIDTH 675

void
cc_wacom_panel_switch_to_panel (CcWacomPanel *self, const char *panel)
{
	g_message ("Should launch %s preferences here", panel);
}

GDBusProxy *
cc_wacom_panel_get_gsd_wacom_bus_proxy (CcWacomPanel *self)
{
	g_message ("Should get the g-s-d wacom dbus proxy here");

	return NULL;
}

GDBusProxy *
cc_wacom_panel_get_input_mapping_bus_proxy (CcWacomPanel *self)
{
	g_message ("Should get the mutter input mapping dbus proxy here");

	return NULL;
}

static void
add_page (GList *devices,
	  GtkWidget *notebook)
{
	GtkWidget *widget;
	CcWacomDevice *stylus = NULL;
	GList *l;

	if (devices == NULL)
		return;

	for (l = devices; l ; l = l->next) {
		stylus = l->data;
	}
	g_list_free (devices);

	widget = cc_wacom_page_new (NULL, stylus);
	gtk_notebook_append_page (GTK_NOTEBOOK (notebook), widget, NULL);
	gtk_widget_show (widget);
}

static GList *
create_fake_cintiq (void)
{
	CcWacomDevice *device;
	GList *devices;

	device = cc_wacom_device_new_fake ("Wacom Cintiq 21UX2");
	devices = g_list_prepend (NULL, device);

	return devices;
}

static GList *
create_fake_bt (void)
{
	CcWacomDevice *device;
	GList *devices;

	device = cc_wacom_device_new_fake ("Wacom Graphire Wireless");
	devices = g_list_prepend (NULL, device);

	return devices;
}

static GList *
create_fake_x201 (void)
{
	CcWacomDevice *device;
	GList *devices;

	device = cc_wacom_device_new_fake ("Wacom Serial Tablet WACf004");
	devices = g_list_prepend (NULL, device);

	return devices;
}

static GList *
create_fake_intuos4 (void)
{
	CcWacomDevice *device;
	GList *devices;

	device = cc_wacom_device_new_fake ("Wacom Intuos4 6x9");
	devices = g_list_prepend (NULL, device);

	return devices;
}

static GList *
create_fake_h610pro (void)
{
	CcWacomDevice *device;
	GList *devices;

	device = cc_wacom_device_new_fake ("Huion H610 Pro");
	devices = g_list_prepend (NULL, device);

	return devices;
}

int main (int argc, char **argv)
{
	GtkWidget *window, *notebook;
	GList *devices;

	bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
	textdomain (GETTEXT_PACKAGE);

	gtk_init ();

	window = gtk_window_new ();
	gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
	gtk_window_set_default_size (GTK_WINDOW (window), FIXED_WIDTH, -1);
	notebook = gtk_notebook_new ();
	gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE);
	gtk_notebook_set_show_border (GTK_NOTEBOOK (notebook), FALSE);
	gtk_widget_set_vexpand (notebook, TRUE);
	gtk_window_set_child (GTK_WINDOW (window), notebook);
	gtk_widget_show (notebook);

	devices = create_fake_intuos4 ();
	add_page (devices, notebook);

	devices = create_fake_cintiq ();
	add_page (devices, notebook);

	devices = create_fake_bt ();
	add_page (devices, notebook);

	devices = create_fake_x201 ();
	add_page (devices, notebook);

	devices = create_fake_h610pro ();
	add_page (devices, notebook);

	gtk_widget_show (window);

  while (g_list_model_get_n_items (gtk_window_get_toplevels ()) > 0)
    g_main_context_iteration (NULL, TRUE);

	return 0;
}