summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2011-11-25 16:09:13 +0000
committerBastien Nocera <hadess@hadess.net>2011-11-25 17:04:01 +0000
commit86bb99ca4158ad38a8de52ebbeb1216c344c6e44 (patch)
treef5d86686bc2b8cde8a2f8cabdd0245d681c15da4
parent26ac989d0ff9132595fd988b60bbd80887c26c4b (diff)
downloadgnome-settings-daemon-86bb99ca4158ad38a8de52ebbeb1216c344c6e44.tar.gz
wacom: Add functions to create fake devices
-rw-r--r--plugins/wacom/gsd-wacom-device.c77
-rw-r--r--plugins/wacom/gsd-wacom-device.h11
2 files changed, 88 insertions, 0 deletions
diff --git a/plugins/wacom/gsd-wacom-device.c b/plugins/wacom/gsd-wacom-device.c
index 91e417f7..f5f8c9fd 100644
--- a/plugins/wacom/gsd-wacom-device.c
+++ b/plugins/wacom/gsd-wacom-device.c
@@ -509,3 +509,80 @@ gsd_wacom_device_type_to_string (GsdWacomDeviceType type)
return "Unknown type";
}
}
+
+GsdWacomDevice *
+gsd_wacom_device_create_fake (GsdWacomDeviceType type,
+ const char *name,
+ const char *tool_name,
+ gboolean reversible,
+ gboolean is_screen_tablet,
+ const char *icon_name,
+ guint num_styli)
+{
+ GsdWacomDevice *device;
+ GsdWacomDevicePrivate *priv;
+ guint i;
+
+ device = GSD_WACOM_DEVICE (g_object_new (GSD_TYPE_WACOM_DEVICE, NULL));
+
+ priv = device->priv;
+ priv->type = type;
+ priv->name = g_strdup (name);
+ priv->tool_name = g_strdup (tool_name);
+ priv->reversible = reversible;
+ priv->is_screen_tablet = is_screen_tablet;
+ priv->icon_name = g_strdup (icon_name);
+ priv->wacom_settings = g_settings_new (SETTINGS_WACOM_DIR);
+
+ for (i = 0; i < num_styli ; i++) {
+ GsdWacomStylus *stylus;
+ GSettings *settings;
+
+ if (device->priv->type == WACOM_TYPE_STYLUS) {
+ settings = g_settings_new (SETTINGS_WACOM_DIR "." SETTINGS_STYLUS_DIR);
+ stylus = gsd_wacom_stylus_new (device, settings, _("Stylus"), "wacom-stylus");
+ } else {
+ settings = g_settings_new (SETTINGS_WACOM_DIR "." SETTINGS_ERASER_DIR);
+ stylus = gsd_wacom_stylus_new (device, settings, "Eraser XXX", NULL);
+ }
+ device->priv->styli = g_list_append (device->priv->styli, stylus);
+ }
+
+ return device;
+}
+
+GList *
+gsd_wacom_device_create_fake_cintiq (void)
+{
+ GsdWacomDevice *device;
+ GList *devices;
+
+ device = gsd_wacom_device_create_fake (WACOM_TYPE_STYLUS,
+ "Wacom Cintiq 21UX2",
+ "Wacom Cintiq 21UX2 stylus",
+ TRUE,
+ TRUE,
+ "wacom-tablet-cintiq",
+ 1);
+ devices = g_list_prepend (NULL, device);
+
+ device = gsd_wacom_device_create_fake (WACOM_TYPE_ERASER,
+ "Wacom Cintiq 21UX2",
+ "Wacom Cintiq 21UX2 eraser",
+ TRUE,
+ TRUE,
+ "wacom-tablet-cintiq",
+ 1);
+ devices = g_list_prepend (devices, device);
+
+ device = gsd_wacom_device_create_fake (WACOM_TYPE_PAD,
+ "Wacom Cintiq 21UX2",
+ "Wacom Cintiq 21UX2 pad",
+ TRUE,
+ TRUE,
+ "wacom-tablet-cintiq",
+ 1);
+ devices = g_list_prepend (devices, device);
+
+ return devices;
+}
diff --git a/plugins/wacom/gsd-wacom-device.h b/plugins/wacom/gsd-wacom-device.h
index 420e7093..59ce70e0 100644
--- a/plugins/wacom/gsd-wacom-device.h
+++ b/plugins/wacom/gsd-wacom-device.h
@@ -96,6 +96,17 @@ GSettings * gsd_wacom_device_get_settings (GsdWacomDevice *device);
GsdWacomDeviceType gsd_wacom_device_get_device_type (GsdWacomDevice *device);
const char * gsd_wacom_device_type_to_string (GsdWacomDeviceType type);
+/* Helper and debug functions */
+GsdWacomDevice * gsd_wacom_device_create_fake (GsdWacomDeviceType type,
+ const char *name,
+ const char *tool_name,
+ gboolean reversible,
+ gboolean is_screen_tablet,
+ const char *icon_name,
+ guint num_styli);
+
+GList * gsd_wacom_device_create_fake_cintiq (void);
+
G_END_DECLS
#endif /* __GSD_WACOM_DEVICE_MANAGER_H */