[gnome-settings-daemon] wacom: Export more stylus metadata
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] wacom: Export more stylus metadata
- Date: Mon, 16 Jan 2012 16:10:52 +0000 (UTC)
commit bf2faa611cb4e8365fd11a361d7fcfe8525956f8
Author: Bastien Nocera <hadess hadess net>
Date: Mon Jan 16 16:01:01 2012 +0000
wacom: Export more stylus metadata
Whether a stylus tip has a corresponding eraser, and the
stylus type (Marker, Airbrush, etc.)
plugins/wacom/gsd-wacom-device.c | 37 +++++++++++++++++++++++++++++++++++++
plugins/wacom/gsd-wacom-device.h | 22 +++++++++++++++++-----
2 files changed, 54 insertions(+), 5 deletions(-)
---
diff --git a/plugins/wacom/gsd-wacom-device.c b/plugins/wacom/gsd-wacom-device.c
index 7eb46eb..3ab124d 100644
--- a/plugins/wacom/gsd-wacom-device.c
+++ b/plugins/wacom/gsd-wacom-device.c
@@ -54,6 +54,7 @@ struct GsdWacomStylusPrivate
char *name;
const char *icon_name;
GSettings *settings;
+ gboolean has_eraser;
};
static void gsd_wacom_stylus_class_init (GsdWacomStylusClass *klass);
@@ -135,6 +136,7 @@ gsd_wacom_stylus_new (GsdWacomDevice *device,
stylus->priv->settings = settings;
stylus->priv->type = libwacom_stylus_get_type (wstylus);
stylus->priv->icon_name = get_icon_name_from_type (stylus->priv->type);
+ stylus->priv->has_eraser = libwacom_stylus_has_eraser (wstylus);
return stylus;
}
@@ -171,6 +173,41 @@ gsd_wacom_stylus_get_device (GsdWacomStylus *stylus)
return stylus->priv->device;
}
+gboolean
+gsd_wacom_stylus_get_has_eraser (GsdWacomStylus *stylus)
+{
+ g_return_val_if_fail (GSD_IS_WACOM_STYLUS (stylus), FALSE);
+
+ return stylus->priv->has_eraser;
+}
+
+GsdWacomStylusType
+gsd_wacom_stylus_get_stylus_type (GsdWacomStylus *stylus)
+{
+ g_return_val_if_fail (GSD_IS_WACOM_STYLUS (stylus), WACOM_STYLUS_TYPE_UNKNOWN);
+
+ switch (stylus->priv->type) {
+ case WSTYLUS_UNKNOWN:
+ return WACOM_STYLUS_TYPE_UNKNOWN;
+ case WSTYLUS_GENERAL:
+ return WACOM_STYLUS_TYPE_GENERAL;
+ case WSTYLUS_INKING:
+ return WACOM_STYLUS_TYPE_INKING;
+ case WSTYLUS_AIRBRUSH:
+ return WACOM_STYLUS_TYPE_AIRBRUSH;
+ case WSTYLUS_CLASSIC:
+ return WACOM_STYLUS_TYPE_CLASSIC;
+ case WSTYLUS_MARKER:
+ return WACOM_STYLUS_TYPE_MARKER;
+ case WSTYLUS_STROKE:
+ return WACOM_STYLUS_TYPE_STROKE;
+ default:
+ g_assert_not_reached ();
+ }
+
+ return WACOM_STYLUS_TYPE_UNKNOWN;
+}
+
#define GSD_WACOM_DEVICE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_WACOM_DEVICE, GsdWacomDevicePrivate))
/* we support two types of settings:
diff --git a/plugins/wacom/gsd-wacom-device.h b/plugins/wacom/gsd-wacom-device.h
index 3435866..fe5ed1a 100644
--- a/plugins/wacom/gsd-wacom-device.h
+++ b/plugins/wacom/gsd-wacom-device.h
@@ -66,11 +66,23 @@ typedef struct
GObjectClass parent_class;
} GsdWacomStylusClass;
-GType gsd_wacom_stylus_get_type (void);
-GSettings * gsd_wacom_stylus_get_settings (GsdWacomStylus *stylus);
-const char * gsd_wacom_stylus_get_name (GsdWacomStylus *stylus);
-const char * gsd_wacom_stylus_get_icon_name(GsdWacomStylus *stylus);
-GsdWacomDevice * gsd_wacom_stylus_get_device (GsdWacomStylus *stylus);
+typedef enum {
+ WACOM_STYLUS_TYPE_UNKNOWN,
+ WACOM_STYLUS_TYPE_GENERAL,
+ WACOM_STYLUS_TYPE_INKING,
+ WACOM_STYLUS_TYPE_AIRBRUSH,
+ WACOM_STYLUS_TYPE_CLASSIC,
+ WACOM_STYLUS_TYPE_MARKER,
+ WACOM_STYLUS_TYPE_STROKE
+} GsdWacomStylusType;
+
+GType gsd_wacom_stylus_get_type (void);
+GSettings * gsd_wacom_stylus_get_settings (GsdWacomStylus *stylus);
+const char * gsd_wacom_stylus_get_name (GsdWacomStylus *stylus);
+const char * gsd_wacom_stylus_get_icon_name (GsdWacomStylus *stylus);
+GsdWacomDevice * gsd_wacom_stylus_get_device (GsdWacomStylus *stylus);
+gboolean gsd_wacom_stylus_get_has_eraser (GsdWacomStylus *stylus);
+GsdWacomStylusType gsd_wacom_stylus_get_stylus_type (GsdWacomStylus *stylus);
/* Device types to apply a setting to */
typedef enum {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]