[gnome-color-manager] Add a list of colorimeters as we'll need this if argyllcms is not installed. Fixes rh#566414
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] Add a list of colorimeters as we'll need this if argyllcms is not installed. Fixes rh#566414
- Date: Fri, 19 Feb 2010 09:00:24 +0000 (UTC)
commit 959f24efd34eaca9e69ce16297ac2e9347f03723
Author: Richard Hughes <richard hughsie com>
Date: Fri Feb 19 08:56:38 2010 +0000
Add a list of colorimeters as we'll need this if argyllcms is not installed. Fixes rh#566414
rules/95-gcm-devices.rules | 12 ++++--
rules/Makefile.am | 1 +
src/gcm-calibrate.c | 22 ++++++++++++
src/gcm-colorimeter.c | 79 ++++++++++++++++++++++++++++++++++++++++++-
src/gcm-colorimeter.h | 3 ++
src/gcm-prefs.c | 23 +++++++++++++
6 files changed, 134 insertions(+), 6 deletions(-)
---
diff --git a/rules/95-gcm-devices.rules b/rules/95-gcm-devices.rules
index 32bcf7e..e1ee7fd 100644
--- a/rules/95-gcm-devices.rules
+++ b/rules/95-gcm-devices.rules
@@ -1,4 +1,5 @@
-# Copyright (C) 2009 Richard Hughes <richard hughsie com>
+##############################################################################################################
+# Copyright (C) 2009-2010 Richard Hughes <richard hughsie com>
#
# Licensed under the GNU General Public License Version 2
#
@@ -6,6 +7,12 @@
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
+#
+# Colorimeter devices used for profiling
+#
+# These are properties defining the behavior:
+# GCM_DEVICE (Can be assinged a profile)
+# GCM_TYPE (The type of device)
# USB SANE scanners
SUBSYSTEM=="usb", ENV{libsane_matched}!="", ENV{GCM_DEVICE}="1", ENV{GCM_TYPE}="scanner"
@@ -16,6 +23,3 @@ SUBSYSTEM=="usb", ENV{ID_GPHOTO2}!="", ENV{GCM_DEVICE}="1", ENV{GCM_TYPE}="camer
# video cameras
SUBSYSTEM=="video4linux", ENV{ID_V4L_PRODUCT}!="", ENV{GCM_DEVICE}="1", ENV{GCM_TYPE}="camera"
-# ensure we set ID_MODEL_FROM_DATABASE and ID_VENDOR_FROM_DATABASE
-SUBSYSTEM=="usb", ENV{COLOR_MEASUREMENT_DEVICE}=="*?", IMPORT{program}="usb-db %p"
-
diff --git a/rules/Makefile.am b/rules/Makefile.am
index d954a15..e2fea9a 100644
--- a/rules/Makefile.am
+++ b/rules/Makefile.am
@@ -1,5 +1,6 @@
udevrulesdir = $(slashlibdir)/udev/rules.d
udevrules_DATA = \
+ 95-gcm-colorimeters.rules \
95-gcm-devices.rules
EXTRA_DIST = \
diff --git a/src/gcm-calibrate.c b/src/gcm-calibrate.c
index a8a3fd6..aedfb37 100644
--- a/src/gcm-calibrate.c
+++ b/src/gcm-calibrate.c
@@ -333,6 +333,28 @@ gcm_calibrate_get_display_type (GcmCalibrate *calibrate, GtkWindow *window, GErr
/* copy */
g_object_get (priv->calibrate_dialog, "device-kind", &priv->device_kind, NULL);
+
+ /* can this device support projectors? */
+ if (priv->device_kind == GCM_CALIBRATE_DEVICE_KIND_PROJECTOR &&
+ !gcm_colorimeter_supports_projector (priv->colorimeter)) {
+ /* TRANSLATORS: title, the hardware calibration device does not support projectors */
+ title = _("Could not calibrate using this colorimeter device");
+
+ /* TRANSLATORS: dialog message */
+ message = _("This colorimeter device is not designed to support profiling projectors.");
+
+ /* ask the user again */
+ gcm_calibrate_dialog_show (priv->calibrate_dialog, GCM_CALIBRATE_DIALOG_TAB_GENERIC, title, message);
+ gcm_calibrate_dialog_set_show_button_ok (priv->calibrate_dialog, FALSE);
+ gcm_calibrate_dialog_set_show_expander (priv->calibrate_dialog, FALSE);
+ response = gcm_calibrate_dialog_run (priv->calibrate_dialog);
+ if (response != GTK_RESPONSE_OK) {
+ gcm_calibrate_dialog_hide (priv->calibrate_dialog);
+ g_set_error_literal (error, 1, 0, "hardware not capable of profiling a projector");
+ ret = FALSE;
+ goto out;
+ }
+ }
out:
return ret;
}
diff --git a/src/gcm-colorimeter.c b/src/gcm-colorimeter.c
index 7c86db4..bc2cb62 100644
--- a/src/gcm-colorimeter.c
+++ b/src/gcm-colorimeter.c
@@ -48,6 +48,9 @@ static void gcm_colorimeter_finalize (GObject *object);
struct _GcmColorimeterPrivate
{
gboolean present;
+ gboolean supports_display;
+ gboolean supports_projector;
+ gboolean supports_printer;
gchar *vendor;
gchar *model;
GUdevClient *client;
@@ -60,6 +63,9 @@ enum {
PROP_VENDOR,
PROP_MODEL,
PROP_COLORIMETER_KIND,
+ PROP_SUPPORTS_DISPLAY,
+ PROP_SUPPORTS_PROJECTOR,
+ PROP_SUPPORTS_PRINTER,
PROP_LAST
};
@@ -100,6 +106,33 @@ gcm_colorimeter_get_present (GcmColorimeter *colorimeter)
}
/**
+ * gcm_colorimeter_supports_display:
+ **/
+gboolean
+gcm_colorimeter_supports_display (GcmColorimeter *colorimeter)
+{
+ return colorimeter->priv->supports_display;
+}
+
+/**
+ * gcm_colorimeter_supports_projector:
+ **/
+gboolean
+gcm_colorimeter_supports_projector (GcmColorimeter *colorimeter)
+{
+ return colorimeter->priv->supports_projector;
+}
+
+/**
+ * gcm_colorimeter_supports_printer:
+ **/
+gboolean
+gcm_colorimeter_supports_printer (GcmColorimeter *colorimeter)
+{
+ return colorimeter->priv->supports_printer;
+}
+
+/**
* gcm_colorimeter_get_kind:
**/
GcmColorimeterKind
@@ -130,6 +163,15 @@ gcm_colorimeter_get_property (GObject *object, guint prop_id, GValue *value, GPa
case PROP_COLORIMETER_KIND:
g_value_set_uint (value, priv->colorimeter_kind);
break;
+ case PROP_SUPPORTS_DISPLAY:
+ g_value_set_uint (value, priv->supports_display);
+ break;
+ case PROP_SUPPORTS_PROJECTOR:
+ g_value_set_uint (value, priv->supports_projector);
+ break;
+ case PROP_SUPPORTS_PRINTER:
+ g_value_set_uint (value, priv->supports_printer);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -194,6 +236,31 @@ gcm_colorimeter_class_init (GcmColorimeterClass *klass)
g_object_class_install_property (object_class, PROP_COLORIMETER_KIND, pspec);
/**
+ * GcmColorimeter:supports-display:
+ */
+ pspec = g_param_spec_boolean ("supports-display", NULL, NULL,
+ FALSE,
+ G_PARAM_READABLE);
+ g_object_class_install_property (object_class, PROP_SUPPORTS_DISPLAY, pspec);
+
+ /**
+ * GcmColorimeter:supports-projector:
+ */
+ pspec = g_param_spec_boolean ("supports-projector", NULL, NULL,
+ FALSE,
+ G_PARAM_READABLE);
+ g_object_class_install_property (object_class, PROP_SUPPORTS_PROJECTOR, pspec);
+
+
+ /**
+ * GcmColorimeter:supports-printer:
+ */
+ pspec = g_param_spec_boolean ("supports-printer", NULL, NULL,
+ FALSE,
+ G_PARAM_READABLE);
+ g_object_class_install_property (object_class, PROP_SUPPORTS_PRINTER, pspec);
+
+ /**
* GcmColorimeter::added:
**/
signals[SIGNAL_CHANGED] =
@@ -218,7 +285,7 @@ gcm_colorimeter_device_add (GcmColorimeter *colorimeter, GUdevDevice *device)
GcmColorimeterPrivate *priv = colorimeter->priv;
/* interesting device? */
- ret = g_udev_device_get_property_as_boolean (device, "COLOR_MEASUREMENT_DEVICE");
+ ret = g_udev_device_get_property_as_boolean (device, "GCM_COLORIMETER");
if (!ret)
goto out;
@@ -234,6 +301,11 @@ gcm_colorimeter_device_add (GcmColorimeter *colorimeter, GUdevDevice *device)
g_free (priv->model);
priv->model = g_strdup (g_udev_device_get_property (device, "ID_MODEL_FROM_DATABASE"));
+ /* device support */
+ priv->supports_display = g_udev_device_get_property_as_boolean (device, "GCM_TYPE_DISPLAY");
+ priv->supports_projector = g_udev_device_get_property_as_boolean (device, "GCM_TYPE_PROJECTOR");
+ priv->supports_printer = g_udev_device_get_property_as_boolean (device, "GCM_TYPE_PRINTER");
+
/* try to get type */
if (g_strcmp0 (priv->model, "Huey") == 0) {
priv->colorimeter_kind = GCM_COLORIMETER_KIND_HUEY;
@@ -278,13 +350,16 @@ gcm_colorimeter_device_remove (GcmColorimeter *colorimeter, GUdevDevice *device)
GcmColorimeterPrivate *priv = colorimeter->priv;
/* interesting device? */
- ret = g_udev_device_get_property_as_boolean (device, "COLOR_MEASUREMENT_DEVICE");
+ ret = g_udev_device_get_property_as_boolean (device, "GCM_COLORIMETER");
if (!ret)
goto out;
/* get data */
egg_debug ("removing color management device: %s", g_udev_device_get_sysfs_path (device));
priv->present = FALSE;
+ priv->supports_display = FALSE;
+ priv->supports_projector = FALSE;
+ priv->supports_printer = FALSE;
/* vendor */
g_free (priv->vendor);
diff --git a/src/gcm-colorimeter.h b/src/gcm-colorimeter.h
index c22983a..f8e8241 100644
--- a/src/gcm-colorimeter.h
+++ b/src/gcm-colorimeter.h
@@ -70,6 +70,9 @@ const gchar *gcm_colorimeter_get_model (GcmColorimeter *colorimeter);
const gchar *gcm_colorimeter_get_vendor (GcmColorimeter *colorimeter);
gboolean gcm_colorimeter_get_present (GcmColorimeter *colorimeter);
GcmColorimeterKind gcm_colorimeter_get_kind (GcmColorimeter *colorimeter);
+gboolean gcm_colorimeter_supports_display (GcmColorimeter *colorimeter);
+gboolean gcm_colorimeter_supports_projector (GcmColorimeter *colorimeter);
+gboolean gcm_colorimeter_supports_printer (GcmColorimeter *colorimeter);
G_END_DECLS
diff --git a/src/gcm-prefs.c b/src/gcm-prefs.c
index 34ffd55..4b441e4 100644
--- a/src/gcm-prefs.c
+++ b/src/gcm-prefs.c
@@ -966,12 +966,35 @@ gcm_prefs_set_calibrate_button_sensitivity (void)
if (!ret) {
/* TRANSLATORS: this is when the button is insensitive */
tooltip = _("Cannot calibrate: The colorimeter is not plugged in");
+ goto out;
}
} else if (type == GCM_DEVICE_TYPE_ENUM_SCANNER ||
type == GCM_DEVICE_TYPE_ENUM_CAMERA) {
/* TODO: find out if we can scan using gnome-scan */
ret = TRUE;
+
+ } else if (type == GCM_DEVICE_TYPE_ENUM_PRINTER) {
+
+ /* find whether we have hardware installed */
+ ret = gcm_colorimeter_get_present (colorimeter);
+ if (!ret) {
+ /* TRANSLATORS: this is when the button is insensitive */
+ tooltip = _("Cannot calibrate: The colorimeter is not plugged in");
+ goto out;
+ }
+
+ /* find whether we have hardware installed */
+ ret = gcm_colorimeter_supports_printer (colorimeter);
+ if (!ret) {
+ /* TRANSLATORS: this is when the button is insensitive */
+ tooltip = _("Cannot calibrate: The colorimeter does not support printer profiling");
+ goto out;
+ }
+
+ /* TRANSLATORS: this is when the button is insensitive */
+ tooltip = _("Cannot calibrate this type of device (although support is planned)");
+
} else {
/* TRANSLATORS: this is when the button is insensitive */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]