[gnome-control-center/wip/garnacho/wayland-tablet: 28/31] wacom: Add constructor for fake CcWacomDevice objects



commit 663f4bd4e01392c26cde1fa28b728eb69c6669c0
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Jun 24 19:46:14 2016 +0200

    wacom: Add constructor for fake CcWacomDevice objects
    
    So it can be used in test-wacom

 panels/wacom/cc-wacom-device.c |   19 +++++++++++++++++++
 panels/wacom/cc-wacom-device.h |    1 +
 2 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/panels/wacom/cc-wacom-device.c b/panels/wacom/cc-wacom-device.c
index c97c8bd..eecc023 100644
--- a/panels/wacom/cc-wacom-device.c
+++ b/panels/wacom/cc-wacom-device.c
@@ -165,6 +165,25 @@ cc_wacom_device_new (GsdDevice *device)
                               NULL);
 }
 
+CcWacomDevice *
+cc_wacom_device_new_fake (const gchar *name)
+{
+       CcWacomDevice *device;
+       WacomDevice *wacom_device;
+
+       device = g_object_new (CC_TYPE_WACOM_DEVICE,
+                              NULL);
+
+       wacom_device = libwacom_new_from_name (cc_wacom_device_database_get(),
+                                              name, NULL);
+       if (wacom_device == NULL)
+               return NULL;
+
+       device->wdevice = wacom_device;
+
+       return device;
+}
+
 const gchar *
 cc_wacom_device_get_name (CcWacomDevice *device)
 {
diff --git a/panels/wacom/cc-wacom-device.h b/panels/wacom/cc-wacom-device.h
index 756f746..856065b 100644
--- a/panels/wacom/cc-wacom-device.h
+++ b/panels/wacom/cc-wacom-device.h
@@ -37,6 +37,7 @@ WacomDeviceDatabase *
                 cc_wacom_device_database_get    (void);
 
 CcWacomDevice * cc_wacom_device_new             (GsdDevice *device);
+CcWacomDevice * cc_wacom_device_new_fake        (const gchar *name);
 
 const gchar   * cc_wacom_device_get_name        (CcWacomDevice *device);
 const gchar   * cc_wacom_device_get_icon_name   (CcWacomDevice *device);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]