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
|
/*
* Copyright (C) 2011 Red Hat, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Author: Bastien Nocera <hadess@hadess.net>
*
*/
#include "config.h"
#include <gtk/gtk.h>
#include "gsd-wacom-device.h"
static char *
get_loc (GSettings *settings)
{
char *path, *schema, *ret;
g_return_val_if_fail (G_IS_SETTINGS (settings), NULL);
g_object_get (G_OBJECT (settings),
"path", &path,
"schema", &schema,
NULL);
ret = g_strdup_printf ("schema: %s (path: %s)", schema, path);
g_free (schema);
g_free (path);
return ret;
}
#define BOOL_AS_STR(x) (x ? "yes" : "no")
static void
list_actual_devices (void)
{
GdkDeviceManager *mgr;
GList *list, *l;
mgr = gdk_display_get_device_manager (gdk_display_get_default ());
list = gdk_device_manager_list_devices (mgr, GDK_DEVICE_TYPE_SLAVE);
for (l = list; l ; l = l->next) {
GsdWacomDevice *device;
char *loc;
device = gsd_wacom_device_new (l->data);
if (gsd_wacom_device_get_device_type (device) == WACOM_TYPE_INVALID) {
g_object_unref (device);
continue;
}
g_message ("*** Device '%s' (type: %s)",
gsd_wacom_device_get_name (device),
gsd_wacom_device_type_to_string (gsd_wacom_device_get_device_type (device)));
g_message ("\tReversible: %s", BOOL_AS_STR (gsd_wacom_device_reversible (device)));
g_message ("\tScreen Tablet: %s", BOOL_AS_STR (gsd_wacom_device_is_screen_tablet (device)));
loc = get_loc (gsd_wacom_device_get_settings (device));
g_message ("\tGeneric settings: %s", loc);
g_free (loc);
if (gsd_wacom_device_get_device_type (device) == WACOM_TYPE_STYLUS) {
GList *styli, *j;
styli = gsd_wacom_device_list_styli (device);
for (j = styli; j; j = j->next) {
GsdWacomStylus *stylus;
char *loc;
stylus = j->data;
g_message ("\tStylus: '%s'", gsd_wacom_stylus_get_name (stylus));
loc = get_loc (gsd_wacom_stylus_get_settings (stylus));
g_message ("\t\tSettings: %s", loc);
g_free (loc);
}
g_list_free (styli);
}
g_object_unref (device);
}
g_list_free (list);
}
int main (int argc, char **argv)
{
gtk_init (&argc, &argv);
list_actual_devices ();
return 0;
}
|