[mutter/wip/garnacho/virtual-input-device: 80/94] clutter: Make ClutterVirtualInputDevice::device-type an enum property



commit 4f79fa1da536d62a3b8e4ffedf681d46a0691291
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Jul 11 18:28:40 2016 +0200

    clutter: Make ClutterVirtualInputDevice::device-type an enum property
    
    And fix the missing break in get/set_property() implementations.

 clutter/clutter/clutter-virtual-input-device.c |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/clutter/clutter/clutter-virtual-input-device.c b/clutter/clutter/clutter-virtual-input-device.c
index 5ec73d2..ab19e65 100644
--- a/clutter/clutter/clutter-virtual-input-device.c
+++ b/clutter/clutter/clutter-virtual-input-device.c
@@ -31,6 +31,7 @@
 
 #include "clutter-device-manager.h"
 #include "clutter-private.h"
+#include "clutter-enum-types.h"
 
 enum
 {
@@ -137,7 +138,8 @@ clutter_virtual_input_device_get_property (GObject    *object,
       g_value_set_object (value, priv->manager);
       break;
     case PROP_DEVICE_TYPE:
-      g_value_set_int (value, priv->device_type);
+      g_value_set_enum (value, priv->device_type);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -161,7 +163,8 @@ clutter_virtual_input_device_set_property (GObject      *object,
       priv->manager = g_value_get_object (value);
       break;
     case PROP_DEVICE_TYPE:
-      priv->device_type = g_value_get_int (value);
+      priv->device_type = g_value_get_enum (value);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -188,11 +191,12 @@ clutter_virtual_input_device_class_init (ClutterVirtualInputDeviceClass *klass)
                          CLUTTER_TYPE_DEVICE_MANAGER,
                          CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
   obj_props[PROP_DEVICE_TYPE] =
-    g_param_spec_int ("device-type",
-                      P_("Device type"),
-                      P_("Device type"),
-                      -1, G_MAXINT, -1,
-                      CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
+    g_param_spec_enum ("device-type",
+                       P_("Device type"),
+                       P_("Device type"),
+                       CLUTTER_TYPE_INPUT_DEVICE_TYPE,
+                       CLUTTER_POINTER_DEVICE,
+                       CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
 
   g_object_class_install_properties (object_class, PROP_LAST, obj_props);
 }


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