[gnome-color-manager] trivial: Add the GcmSensor kind at construct time in case UDEV doesn't know
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] trivial: Add the GcmSensor kind at construct time in case UDEV doesn't know
- Date: Thu, 22 Jul 2010 17:01:12 +0000 (UTC)
commit 7244478f9020a27318fd459004720a36da2a3756
Author: Richard Hughes <richard hughsie com>
Date: Thu Jul 22 16:43:50 2010 +0100
trivial: Add the GcmSensor kind at construct time in case UDEV doesn't know
libcolor-glib/gcm-sensor-huey.c | 1 +
libcolor-glib/gcm-sensor.c | 12 ++++++++----
tools/gcm-sensor-colormunki.c | 1 +
3 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/libcolor-glib/gcm-sensor-huey.c b/libcolor-glib/gcm-sensor-huey.c
index 63ede01..e0feff2 100644
--- a/libcolor-glib/gcm-sensor-huey.c
+++ b/libcolor-glib/gcm-sensor-huey.c
@@ -894,6 +894,7 @@ gcm_sensor_huey_new (void)
GcmSensorHuey *sensor;
sensor = g_object_new (GCM_TYPE_SENSOR_HUEY,
"native", TRUE,
+ "kind", GCM_SENSOR_KIND_HUEY,
NULL);
return GCM_SENSOR (sensor);
}
diff --git a/libcolor-glib/gcm-sensor.c b/libcolor-glib/gcm-sensor.c
index c453106..81ab273 100644
--- a/libcolor-glib/gcm-sensor.c
+++ b/libcolor-glib/gcm-sensor.c
@@ -271,7 +271,8 @@ gcm_sensor_set_from_device (GcmSensor *sensor, GUdevDevice *device, GError **err
/* try to get type */
kind_str = g_udev_device_get_property (device, "GCM_KIND");
- priv->kind = gcm_sensor_kind_from_string (kind_str);
+ if (priv->kind == GCM_SENSOR_KIND_UNKNOWN)
+ priv->kind = gcm_sensor_kind_from_string (kind_str);
if (priv->kind == GCM_SENSOR_KIND_UNKNOWN)
egg_warning ("Failed to recognize color device: %s", priv->model);
@@ -591,7 +592,7 @@ gcm_sensor_get_property (GObject *object, guint prop_id, GValue *value, GParamSp
g_value_set_string (value, priv->model);
break;
case PROP_KIND:
- g_value_set_boolean (value, priv->kind);
+ g_value_set_uint (value, priv->kind);
break;
case PROP_SUPPORTS_DISPLAY:
g_value_set_boolean (value, priv->supports_display);
@@ -627,6 +628,9 @@ gcm_sensor_set_property (GObject *object, guint prop_id, const GValue *value, GP
case PROP_NATIVE:
priv->native = g_value_get_boolean (value);
break;
+ case PROP_KIND:
+ priv->kind = g_value_get_uint (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -650,7 +654,7 @@ gcm_sensor_class_init (GcmSensorClass *klass)
*/
pspec = g_param_spec_boolean ("native", NULL, NULL,
FALSE,
- G_PARAM_READWRITE);
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
g_object_class_install_property (object_class, PROP_NATIVE, pspec);
/**
@@ -674,7 +678,7 @@ gcm_sensor_class_init (GcmSensorClass *klass)
*/
pspec = g_param_spec_uint ("kind", NULL, NULL,
0, G_MAXUINT, GCM_SENSOR_KIND_UNKNOWN,
- G_PARAM_READABLE);
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
g_object_class_install_property (object_class, PROP_KIND, pspec);
/**
diff --git a/tools/gcm-sensor-colormunki.c b/tools/gcm-sensor-colormunki.c
index 93be2e6..2ed6446 100644
--- a/tools/gcm-sensor-colormunki.c
+++ b/tools/gcm-sensor-colormunki.c
@@ -596,6 +596,7 @@ gcm_sensor_colormunki_new (void)
GcmSensorColormunki *sensor;
sensor = g_object_new (GCM_TYPE_SENSOR_COLORMUNKI,
"native", TRUE,
+ "kind", GCM_SENSOR_KIND_COLOR_MUNKI,
NULL);
return GCM_SENSOR (sensor);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]