[gnome-settings-daemon] wacom: Add function to get the associated device
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] wacom: Add function to get the associated device
- Date: Tue, 22 Nov 2011 18:17:14 +0000 (UTC)
commit 86f769873eb443097d3d5103f0b5771074fbb1ce
Author: Bastien Nocera <hadess hadess net>
Date: Mon Nov 21 19:08:03 2011 +0000
wacom: Add function to get the associated device
From a stylus.
plugins/wacom/gsd-wacom-device.c | 16 +++++++++++-
plugins/wacom/gsd-wacom-device.h | 47 +++++++++++++++++++------------------
2 files changed, 38 insertions(+), 25 deletions(-)
---
diff --git a/plugins/wacom/gsd-wacom-device.c b/plugins/wacom/gsd-wacom-device.c
index eee309a..84a1e31 100644
--- a/plugins/wacom/gsd-wacom-device.c
+++ b/plugins/wacom/gsd-wacom-device.c
@@ -38,6 +38,7 @@
struct GsdWacomStylusPrivate
{
+ GsdWacomDevice *device;
char *name;
GSettings *settings;
};
@@ -91,7 +92,8 @@ gsd_wacom_stylus_finalize (GObject *object)
}
static GsdWacomStylus *
-gsd_wacom_stylus_new (GSettings *settings,
+gsd_wacom_stylus_new (GsdWacomDevice *device,
+ GSettings *settings,
const char *name)
{
GsdWacomStylus *stylus;
@@ -101,6 +103,7 @@ gsd_wacom_stylus_new (GSettings *settings,
stylus = GSD_WACOM_STYLUS (g_object_new (GSD_TYPE_WACOM_STYLUS,
NULL));
+ stylus->priv->device = device;
stylus->priv->name = g_strdup (name);
stylus->priv->settings = settings;
@@ -123,6 +126,14 @@ gsd_wacom_stylus_get_name (GsdWacomStylus *stylus)
return stylus->priv->name;
}
+GsdWacomDevice *
+gsd_wacom_stylus_get_device (GsdWacomStylus *stylus)
+{
+ g_return_val_if_fail (GSD_IS_WACOM_STYLUS (stylus), NULL);
+
+ return stylus->priv->device;
+}
+
#define GSD_WACOM_DEVICE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_WACOM_DEVICE, GsdWacomDevicePrivate))
/* we support two types of settings:
@@ -313,7 +324,8 @@ gsd_wacom_device_constructor (GType type,
if (device->priv->type == WACOM_TYPE_STYLUS) {
GsdWacomStylus *stylus;
- stylus = gsd_wacom_stylus_new (g_settings_new (SETTINGS_WACOM_DIR "." SETTINGS_STYLUS_DIR),
+ stylus = gsd_wacom_stylus_new (device,
+ g_settings_new (SETTINGS_WACOM_DIR "." SETTINGS_STYLUS_DIR),
_("Stylus"));
device->priv->styli = g_list_append (NULL, stylus);
}
diff --git a/plugins/wacom/gsd-wacom-device.h b/plugins/wacom/gsd-wacom-device.h
index d21067f..35d82d2 100644
--- a/plugins/wacom/gsd-wacom-device.h
+++ b/plugins/wacom/gsd-wacom-device.h
@@ -26,6 +26,26 @@
G_BEGIN_DECLS
+#define GSD_TYPE_WACOM_DEVICE (gsd_wacom_device_get_type ())
+#define GSD_WACOM_DEVICE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_WACOM_DEVICE, GsdWacomDevice))
+#define GSD_WACOM_DEVICE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_WACOM_DEVICE, GsdWacomDeviceClass))
+#define GSD_IS_WACOM_DEVICE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_WACOM_DEVICE))
+#define GSD_IS_WACOM_DEVICE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_WACOM_DEVICE))
+#define GSD_WACOM_DEVICE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_WACOM_DEVICE, GsdWacomDeviceClass))
+
+typedef struct GsdWacomDevicePrivate GsdWacomDevicePrivate;
+
+typedef struct
+{
+ GObject parent;
+ GsdWacomDevicePrivate *priv;
+} GsdWacomDevice;
+
+typedef struct
+{
+ GObjectClass parent_class;
+} GsdWacomDeviceClass;
+
#define GSD_TYPE_WACOM_STYLUS (gsd_wacom_stylus_get_type ())
#define GSD_WACOM_STYLUS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_WACOM_STYLUS, GsdWacomStylus))
#define GSD_WACOM_STYLUS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_WACOM_STYLUS, GsdWacomStylusClass))
@@ -46,16 +66,10 @@ 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);
-
-#define GSD_TYPE_WACOM_DEVICE (gsd_wacom_device_get_type ())
-#define GSD_WACOM_DEVICE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_WACOM_DEVICE, GsdWacomDevice))
-#define GSD_WACOM_DEVICE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_WACOM_DEVICE, GsdWacomDeviceClass))
-#define GSD_IS_WACOM_DEVICE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_WACOM_DEVICE))
-#define GSD_IS_WACOM_DEVICE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_WACOM_DEVICE))
-#define GSD_WACOM_DEVICE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_WACOM_DEVICE, GsdWacomDeviceClass))
+GType gsd_wacom_stylus_get_type (void);
+GSettings * gsd_wacom_stylus_get_settings (GsdWacomStylus *stylus);
+const char * gsd_wacom_stylus_get_name (GsdWacomStylus *stylus);
+GsdWacomDevice * gsd_wacom_stylus_get_device (GsdWacomStylus *stylus);
/* Device types to apply a setting to */
typedef enum {
@@ -67,19 +81,6 @@ typedef enum {
WACOM_TYPE_ALL = WACOM_TYPE_STYLUS | WACOM_TYPE_ERASER | WACOM_TYPE_CURSOR | WACOM_TYPE_PAD
} GsdWacomDeviceType;
-typedef struct GsdWacomDevicePrivate GsdWacomDevicePrivate;
-
-typedef struct
-{
- GObject parent;
- GsdWacomDevicePrivate *priv;
-} GsdWacomDevice;
-
-typedef struct
-{
- GObjectClass parent_class;
-} GsdWacomDeviceClass;
-
GType gsd_wacom_device_get_type (void);
GsdWacomDevice * gsd_wacom_device_new (GdkDevice *device);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]