[gnome-color-manager] Remove all the sensor code as it's been moved to colord
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] Remove all the sensor code as it's been moved to colord
- Date: Tue, 5 Apr 2011 10:46:14 +0000 (UTC)
commit 98e21f221fbadc68f803e1afd2dcdc5364a2e068
Author: Richard Hughes <richard hughsie com>
Date: Mon Apr 4 16:15:08 2011 +0100
Remove all the sensor code as it's been moved to colord
Makefile.am | 2 -
configure.ac | 25 +-
docs/.gitignore | 7 -
docs/Makefile.am | 24 -
docs/colormunki/lsusb-vvv | 68 --
docs/gcm-parse-beagle.c | 351 ------
docs/huey/.gitignore | 9 -
...t-usb-traffic-and-add-hex-output-pretty-p.patch | 53 -
docs/huey/Makefile.am | 32 -
docs/huey/gcm-calculate-fudge.c | 194 ----
docs/huey/gcm-dump-to-values.c | 119 --
docs/huey/gcm-parse-huey.c | 250 -----
docs/huey/lsusb-vvv | 97 --
docs/huey/register-dump.txt | 576 ----------
po/POTFILES.in | 1 -
rules/.gitignore | 3 -
rules/95-gcm-colorimeters.rules | 67 --
rules/Makefile.am | 10 -
src/Makefile.am | 109 +-
src/gcm-buffer.c | 157 ---
src/gcm-buffer.h | 44 -
src/gcm-calibrate-argyll.c | 66 +-
src/gcm-calibrate-manual.c | 2 +-
src/gcm-calibrate-native.c | 86 +-
src/gcm-calibrate.c | 84 +-
src/gcm-calibrate.h | 5 +
src/gcm-cie-widget.c | 65 +-
src/gcm-color.c | 402 -------
src/gcm-color.h | 109 --
src/gcm-compat.h | 31 -
src/gcm-edid.c | 57 +-
src/gcm-edid.h | 11 +-
src/gcm-hull.c | 18 +-
src/gcm-hull.h | 7 +-
src/gcm-import.c | 1 -
src/gcm-list-store-profiles.c | 4 +-
src/gcm-math.c | 305 ------
src/gcm-math.h | 72 --
src/gcm-picker.c | 108 ++-
src/gcm-prefs.c | 91 +-
src/gcm-profile.c | 131 ++--
src/gcm-profile.h | 25 +-
src/gcm-sample-window.c | 2 +-
src/gcm-sample-window.h | 4 +-
src/gcm-self-test.c | 275 +-----
src/gcm-sensor-client.c | 318 ------
src/gcm-sensor-client.h | 72 --
src/gcm-sensor-colormunki-private.c | 86 --
src/gcm-sensor-colormunki-private.h | 128 ---
src/gcm-sensor-colormunki.c | 556 ----------
src/gcm-sensor-colormunki.h | 59 -
src/gcm-sensor-dummy.c | 272 -----
src/gcm-sensor-dummy.h | 57 -
src/gcm-sensor-huey-private.c | 94 --
src/gcm-sensor-huey-private.h | 303 -----
src/gcm-sensor-huey.c | 1153 --------------------
src/gcm-sensor-huey.h | 59 -
src/gcm-sensor.c | 1026 -----------------
src/gcm-sensor.h | 208 ----
src/gcm-session.c | 54 +-
src/gcm-usb.c | 536 ---------
src/gcm-usb.h | 81 --
src/gcm-viewer.c | 1 -
src/gsd-color-manager.c | 10 +-
tools/Makefile.am | 31 +-
tools/gcm-dump-profile.c | 2 +-
tools/gcm-dump-sensor.c | 102 --
tools/gcm-sensor-example.c | 2 +-
68 files changed, 533 insertions(+), 8836 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 6f9f013..cb774eb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,11 +1,9 @@
SUBDIRS = \
src \
- docs \
data \
help \
man \
po \
- rules \
tools
snapshot:
diff --git a/configure.ac b/configure.ac
index f24928e..eb7bf2f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,13 +1,7 @@
-# Copyright (C) 2010 Richard Hughes <richard hughsie com>
+# Copyright (C) 2010-2011 Richard Hughes <richard hughsie com>
AC_PREREQ(2.63)
-m4_define([gcm_major_version], [3])
-m4_define([gcm_minor_version], [1])
-m4_define([gcm_micro_version], [1])
-m4_define([gcm_version],
- [gcm_major_version.gcm_minor_version.gcm_micro_version])
-
-AC_INIT([gnome-color-manager],[gcm_version],[http://bugzilla.gnome.org/enter_bug.cgi?product=gnome-color-manager])
+AC_INIT([gnome-color-manager],[3.1.1],[http://bugzilla.gnome.org/enter_bug.cgi?product=gnome-color-manager])
AC_CONFIG_SRCDIR(src)
AM_INIT_AUTOMAKE([1.9 tar-ustar dist-bzip2])
AC_CONFIG_HEADERS([config.h])
@@ -47,14 +41,6 @@ if test x$enable_strict != xno; then
fi
fi
-# udev rules go in /lib, not /usr/lib
-if test "$prefix" = "/usr" -o "$prefix" = "/usr/local" ; then
- slashlibdir=/lib
-else
- slashlibdir=$prefix/lib
-fi
-AC_SUBST(slashlibdir)
-
dnl ---------------------------------------------------------------------------
dnl - Extra verbose warning switches
dnl ---------------------------------------------------------------------------
@@ -107,11 +93,9 @@ dnl ---------------------------------------------------------------------------
PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.14.0 gobject-2.0 gthread-2.0 gio-2.0 >= 2.25.9)
PKG_CHECK_MODULES(XORG, xrandr)
PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 2.91.0)
-PKG_CHECK_MODULES(GUDEV, gudev-1.0)
PKG_CHECK_MODULES(LCMS, lcms2)
PKG_CHECK_MODULES(X11, x11)
-PKG_CHECK_MODULES(COLORD, colord >= 0.1.2)
-PKG_CHECK_MODULES(SETTINGS_DAEMON, gnome-settings-daemon)
+PKG_CHECK_MODULES(COLORD, colord >= 0.1.6)
PKG_CHECK_MODULES(USB, libusb-1.0 >= 1.0.9, has_new_libusb=yes, has_new_libusb=no)
if test x$has_new_libusb = xyes; then
AC_DEFINE(HAVE_NEW_USB,1,[Got new libusb])
@@ -245,11 +229,8 @@ data/figures/Makefile
help/Makefile
man/Makefile
po/Makefile.in
-rules/Makefile
src/Makefile
tools/Makefile
-docs/Makefile
-docs/huey/Makefile
])
AC_OUTPUT
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 84efb5a..c26cb71 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -7,7 +7,6 @@ data/org.gnome.color-manager.gschema.xml
data/org.gnome.settings-daemon.plugins.color.gschema.xml
src/gcm-debug.c
src/gcm-profile.c
-src/gcm-sensor-client.c
src/gcm-prefs.c
src/gcm-calibrate-argyll.c
src/gcm-calibrate.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 6bbf8cb..51e869c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -11,9 +11,6 @@ INCLUDES = \
$(NOTIFY_CFLAGS) \
$(CANBERRA_CFLAGS) \
$(CLUTTER_CFLAGS) \
- $(SETTINGS_DAEMON_CFLAGS) \
- -DG_UDEV_API_IS_SUBJECT_TO_CHANGE \
- $(GUDEV_CFLAGS) \
-DG_LOG_DOMAIN=\"Gcm\" \
-DBINDIR=\"$(bindir)\" \
-DLIBEXECDIR=\"$(libexecdir)\" \
@@ -31,29 +28,12 @@ dist_introspection_DATA = org.gnome.ColorManager.xml
noinst_LIBRARIES = libgcmshared.a
libgcmshared_a_SOURCES = \
- gcm-brightness.c \
- gcm-brightness.h \
- gcm-buffer.c \
- gcm-buffer.h \
gcm-hull.c \
gcm-hull.h \
- gcm-compat.h \
- gcm-calibrate-argyll.c \
- gcm-calibrate-argyll.h \
- gcm-calibrate.c \
- gcm-calibrate-dialog.c \
- gcm-calibrate-dialog.h \
- gcm-calibrate.h \
- gcm-calibrate-manual.c \
- gcm-calibrate-manual.h \
- gcm-calibrate-native.c \
- gcm-calibrate-native.h \
gcm-cie-widget.c \
gcm-cie-widget.h \
gcm-clut.c \
gcm-clut.h \
- gcm-color.c \
- gcm-color.h \
gcm-debug.c \
gcm-debug.h \
gcm-dmi.c \
@@ -62,40 +42,16 @@ libgcmshared_a_SOURCES = \
gcm-edid.h \
gcm-exif.c \
gcm-exif.h \
- gcm-gamma-widget.c \
- gcm-gamma-widget.h \
gcm-image.c \
gcm-image.h \
- gcm-math.c \
- gcm-math.h \
gcm-print.c \
gcm-print.h \
gcm-profile.c \
gcm-profile.h \
- gcm-profile-store.c \
- gcm-profile-store.h \
- gcm-sample-window.c \
- gcm-sample-window.h \
- gcm-sensor.c \
- gcm-sensor-client.c \
- gcm-sensor-client.h \
- gcm-sensor-colormunki.c \
- gcm-sensor-colormunki.h \
- gcm-sensor-colormunki-private.c \
- gcm-sensor-colormunki-private.h \
- gcm-sensor-dummy.c \
- gcm-sensor-dummy.h \
- gcm-sensor.h \
- gcm-sensor-huey.c \
- gcm-sensor-huey.h \
- gcm-sensor-huey-private.c \
- gcm-sensor-huey-private.h \
gcm-tables.c \
gcm-tables.h \
gcm-trc-widget.c \
gcm-trc-widget.h \
- gcm-usb.c \
- gcm-usb.h \
gcm-utils.c \
gcm-utils.h \
gcm-x11-output.c \
@@ -128,12 +84,28 @@ gcm_helper_exiv_CXXFLAGS = -Wall
endif
gcm_prefs_SOURCES = \
- gcm-list-store-profiles.c \
- gcm-list-store-profiles.h \
- gcm-cell-renderer-profile-text.c \
- gcm-cell-renderer-profile-text.h \
+ gcm-brightness.c \
+ gcm-brightness.h \
+ gcm-calibrate-argyll.c \
+ gcm-calibrate-argyll.h \
+ gcm-calibrate.c \
+ gcm-calibrate-dialog.c \
+ gcm-calibrate-dialog.h \
+ gcm-calibrate.h \
+ gcm-calibrate-manual.c \
+ gcm-calibrate-manual.h \
+ gcm-calibrate-native.c \
+ gcm-calibrate-native.h \
gcm-cell-renderer-profile-icon.c \
gcm-cell-renderer-profile-icon.h \
+ gcm-cell-renderer-profile-text.c \
+ gcm-cell-renderer-profile-text.h \
+ gcm-gamma-widget.c \
+ gcm-gamma-widget.h \
+ gcm-list-store-profiles.c \
+ gcm-list-store-profiles.h \
+ gcm-sample-window.c \
+ gcm-sample-window.h \
gcm-prefs.c
gcm_prefs_LDADD = \
@@ -143,7 +115,6 @@ gcm_prefs_LDADD = \
$(EXIF_LIBS) \
$(GLIB_LIBS) \
$(GTK_LIBS) \
- $(GUDEV_LIBS) \
$(LCMS_LIBS) \
$(TIFF_LIBS) \
$(USB_LIBS) \
@@ -162,7 +133,6 @@ gcm_inspect_LDADD = \
libgcmshared.a \
$(GLIB_LIBS) \
$(X11_LIBS) \
- $(GUDEV_LIBS) \
$(XORG_LIBS) \
$(GTK_LIBS) \
$(LCMS_LIBS) \
@@ -179,7 +149,6 @@ gcm_import_LDADD = \
libgcmshared.a \
$(GLIB_LIBS) \
$(X11_LIBS) \
- $(GUDEV_LIBS) \
$(XORG_LIBS) \
$(GTK_LIBS) \
$(LCMS_LIBS) \
@@ -199,7 +168,6 @@ gcm_viewer_LDADD = \
$(GLIB_LIBS) \
$(X11_LIBS) \
$(VTE_LIBS) \
- $(GUDEV_LIBS) \
$(XORG_LIBS) \
$(GTK_LIBS) \
$(TIFF_LIBS) \
@@ -213,6 +181,14 @@ gcm_viewer_CFLAGS = \
$(WARNINGFLAGS_C)
gcm_picker_SOURCES = \
+ gcm-brightness.c \
+ gcm-brightness.h \
+ gcm-calibrate-argyll.c \
+ gcm-calibrate-argyll.h \
+ gcm-calibrate.c \
+ gcm-calibrate-dialog.c \
+ gcm-calibrate-dialog.h \
+ gcm-calibrate.h \
gcm-picker.c
gcm_picker_LDADD = \
@@ -220,7 +196,6 @@ gcm_picker_LDADD = \
$(GLIB_LIBS) \
$(X11_LIBS) \
$(VTE_LIBS) \
- $(GUDEV_LIBS) \
$(XORG_LIBS) \
$(GTK_LIBS) \
$(TIFF_LIBS) \
@@ -235,13 +210,14 @@ gcm_picker_CFLAGS = \
$(WARNINGFLAGS_C)
gcm_session_SOURCES = \
+ gcm-profile-store.c \
+ gcm-profile-store.h \
gcm-session.c
gcm_session_LDADD = \
libgcmshared.a \
$(GLIB_LIBS) \
$(X11_LIBS) \
- $(GUDEV_LIBS) \
$(XORG_LIBS) \
$(GTK_LIBS) \
$(TIFF_LIBS) \
@@ -249,6 +225,7 @@ gcm_session_LDADD = \
$(NOTIFY_LIBS) \
$(LCMS_LIBS) \
$(COLORD_LIBS) \
+ $(CANBERRA_LIBS) \
-lm
gcm_session_CFLAGS = \
@@ -260,14 +237,30 @@ check_PROGRAMS = \
gcm-self-test
gcm_self_test_SOURCES = \
- gcm-self-test.c \
- $(NULL)
+ gcm-brightness.c \
+ gcm-brightness.h \
+ gcm-calibrate-argyll.c \
+ gcm-calibrate-argyll.h \
+ gcm-calibrate.c \
+ gcm-calibrate-dialog.c \
+ gcm-calibrate-dialog.h \
+ gcm-calibrate.h \
+ gcm-calibrate-manual.c \
+ gcm-calibrate-manual.h \
+ gcm-calibrate-native.c \
+ gcm-calibrate-native.h \
+ gcm-gamma-widget.c \
+ gcm-gamma-widget.h \
+ gcm-sample-window.c \
+ gcm-sample-window.h \
+ gcm-profile-store.c \
+ gcm-profile-store.h \
+ gcm-self-test.c
gcm_self_test_LDADD = \
libgcmshared.a \
$(GLIB_LIBS) \
$(X11_LIBS) \
- $(GUDEV_LIBS) \
$(LCMS_LIBS) \
$(XORG_LIBS) \
$(GTK_LIBS) \
@@ -275,6 +268,8 @@ gcm_self_test_LDADD = \
$(TIFF_LIBS) \
$(COLORD_LIBS) \
$(EXIF_LIBS) \
+ $(VTE_LIBS) \
+ $(CANBERRA_LIBS) \
-lm
gcm_self_test_CFLAGS = $(AM_CFLAGS) $(WARNINGFLAGS_C)
diff --git a/src/gcm-calibrate-argyll.c b/src/gcm-calibrate-argyll.c
index dbc8093..3e27554 100644
--- a/src/gcm-calibrate-argyll.c
+++ b/src/gcm-calibrate-argyll.c
@@ -42,11 +42,9 @@
#include <canberra-gtk.h>
#include "gcm-calibrate-argyll.h"
-#include "gcm-sensor-client.h"
#include "gcm-utils.h"
#include "gcm-x11-screen.h"
#include "gcm-print.h"
-#include "gcm-color.h"
#include "gcm-calibrate-dialog.h"
#define FIXED_ARGYLL
@@ -152,7 +150,7 @@ static guint
gcm_calibrate_argyll_printer_get_patches (GcmCalibrateArgyll *calibrate_argyll)
{
guint patches = 180;
- GcmSensorKind sensor_kind;
+ CdSensorKind sensor_kind;
GcmCalibratePrecision precision;
/* we care about the kind */
@@ -170,8 +168,8 @@ gcm_calibrate_argyll_printer_get_patches (GcmCalibrateArgyll *calibrate_argyll)
#ifdef USE_DOUBLE_DENSITY
/* using double density, so we can double the patch count */
- if (sensor_kind == GCM_SENSOR_KIND_COLOR_MUNKI ||
- sensor_kind == GCM_SENSOR_KIND_SPECTRO_SCAN) {
+ if (sensor_kind == CD_SENSOR_KIND_COLOR_MUNKI ||
+ sensor_kind == CD_SENSOR_KIND_SPECTRO_SCAN) {
patches *= 2;
}
#endif
@@ -186,20 +184,20 @@ gcm_calibrate_argyll_printer_get_patches (GcmCalibrateArgyll *calibrate_argyll)
static const gchar *
gcm_calibrate_argyll_get_sensor_image_attach (GcmCalibrateArgyll *calibrate_argyll)
{
- GcmSensorKind sensor_kind;
+ CdSensorKind sensor_kind;
g_object_get (calibrate_argyll, "sensor-kind", &sensor_kind, NULL);
- if (sensor_kind == GCM_SENSOR_KIND_HUEY)
+ if (sensor_kind == CD_SENSOR_KIND_HUEY)
return "huey-attach.svg";
- if (sensor_kind == GCM_SENSOR_KIND_COLOR_MUNKI)
+ if (sensor_kind == CD_SENSOR_KIND_COLOR_MUNKI)
return "munki-attach.svg";
- if (sensor_kind == GCM_SENSOR_KIND_SPYDER)
+ if (sensor_kind == CD_SENSOR_KIND_SPYDER)
return "spyder-attach.svg";
- if (sensor_kind == GCM_SENSOR_KIND_COLORIMTRE_HCFR)
+ if (sensor_kind == CD_SENSOR_KIND_COLORIMTRE_HCFR)
return "hcfr-attach.svg";
- if (sensor_kind == GCM_SENSOR_KIND_I1_PRO)
+ if (sensor_kind == CD_SENSOR_KIND_I1_PRO)
return "i1-attach.svg";
- if (sensor_kind == GCM_SENSOR_KIND_DTP94)
+ if (sensor_kind == CD_SENSOR_KIND_DTP94)
return "dtp94-attach.svg";
return NULL;
}
@@ -210,10 +208,10 @@ gcm_calibrate_argyll_get_sensor_image_attach (GcmCalibrateArgyll *calibrate_argy
static const gchar *
gcm_calibrate_argyll_get_sensor_image_calibrate (GcmCalibrateArgyll *calibrate_argyll)
{
- GcmSensorKind sensor_kind;
+ CdSensorKind sensor_kind;
g_object_get (calibrate_argyll, "sensor-kind", &sensor_kind, NULL);
- if (sensor_kind == GCM_SENSOR_KIND_COLOR_MUNKI)
+ if (sensor_kind == CD_SENSOR_KIND_COLOR_MUNKI)
return "munki-calibrate.svg";
return NULL;
}
@@ -224,10 +222,10 @@ gcm_calibrate_argyll_get_sensor_image_calibrate (GcmCalibrateArgyll *calibrate_a
static const gchar *
gcm_calibrate_argyll_get_sensor_image_screen (GcmCalibrateArgyll *calibrate_argyll)
{
- GcmSensorKind sensor_kind;
+ CdSensorKind sensor_kind;
g_object_get (calibrate_argyll, "sensor-kind", &sensor_kind, NULL);
- if (sensor_kind == GCM_SENSOR_KIND_COLOR_MUNKI)
+ if (sensor_kind == CD_SENSOR_KIND_COLOR_MUNKI)
return "munki-screen.svg";
return NULL;
}
@@ -1357,7 +1355,7 @@ gcm_calibrate_argyll_remove_temp_files (GcmCalibrateArgyll *calibrate_argyll, GE
* gcm_calibrate_argyll_display:
**/
static gboolean
-gcm_calibrate_argyll_display (GcmCalibrate *calibrate, GtkWindow *window, GError **error)
+gcm_calibrate_argyll_display (GcmCalibrate *calibrate, CdSensor *sensor, GtkWindow *window, GError **error)
{
GcmCalibrateArgyll *calibrate_argyll = GCM_CALIBRATE_ARGYLL(calibrate);
GcmCalibrateArgyllPrivate *priv = calibrate_argyll->priv;
@@ -1502,7 +1500,7 @@ out:
* gcm_calibrate_argyll_spotread:
**/
static gboolean
-gcm_calibrate_argyll_spotread (GcmCalibrate *calibrate, GtkWindow *window, GError **error)
+gcm_calibrate_argyll_spotread (GcmCalibrate *calibrate, CdSensor *sensor, GtkWindow *window, GError **error)
{
GcmCalibrateArgyll *calibrate_argyll = GCM_CALIBRATE_ARGYLL(calibrate);
GcmCalibrateArgyllPrivate *priv = calibrate_argyll->priv;
@@ -1531,25 +1529,25 @@ out:
static const gchar *
gcm_calibrate_argyll_get_sensor_target (GcmCalibrateArgyll *calibrate_argyll)
{
- GcmSensorKind sensor_kind;
+ CdSensorKind sensor_kind;
g_object_get (calibrate_argyll,
"sensor-kind", &sensor_kind,
NULL);
- if (sensor_kind == GCM_SENSOR_KIND_DTP20)
+ if (sensor_kind == CD_SENSOR_KIND_DTP20)
return "20";
- if (sensor_kind == GCM_SENSOR_KIND_DTP22)
+ if (sensor_kind == CD_SENSOR_KIND_DTP22)
return "22";
- if (sensor_kind == GCM_SENSOR_KIND_DTP41)
+ if (sensor_kind == CD_SENSOR_KIND_DTP41)
return "41";
- if (sensor_kind == GCM_SENSOR_KIND_DTP51)
+ if (sensor_kind == CD_SENSOR_KIND_DTP51)
return "51";
- if (sensor_kind == GCM_SENSOR_KIND_SPECTRO_SCAN)
+ if (sensor_kind == CD_SENSOR_KIND_SPECTRO_SCAN)
return "SS";
- if (sensor_kind == GCM_SENSOR_KIND_I1_PRO)
+ if (sensor_kind == CD_SENSOR_KIND_I1_PRO)
return "i1";
- if (sensor_kind == GCM_SENSOR_KIND_COLOR_MUNKI)
+ if (sensor_kind == CD_SENSOR_KIND_COLOR_MUNKI)
return "CM";
return NULL;
}
@@ -1568,7 +1566,7 @@ gcm_calibrate_argyll_display_generate_targets (GcmCalibrateArgyll *calibrate_arg
gchar *basename = NULL;
const gchar *title;
const gchar *message;
- GcmSensorKind sensor_kind;
+ CdSensorKind sensor_kind;
/* get shared data */
g_object_get (calibrate_argyll,
@@ -1608,8 +1606,8 @@ gcm_calibrate_argyll_display_generate_targets (GcmCalibrateArgyll *calibrate_arg
#ifdef USE_DOUBLE_DENSITY
/* use double density */
- if (sensor_kind == GCM_SENSOR_KIND_COLOR_MUNKI ||
- sensor_kind == GCM_SENSOR_KIND_SPECTRO_SCAN) {
+ if (sensor_kind == CD_SENSOR_KIND_COLOR_MUNKI ||
+ sensor_kind == CD_SENSOR_KIND_SPECTRO_SCAN) {
g_ptr_array_add (array, g_strdup ("-h"));
}
#endif
@@ -1859,7 +1857,7 @@ out:
* gcm_calibrate_argyll_printer:
**/
static gboolean
-gcm_calibrate_argyll_printer (GcmCalibrate *calibrate, GtkWindow *window, GError **error)
+gcm_calibrate_argyll_printer (GcmCalibrate *calibrate, CdSensor *sensor, GtkWindow *window, GError **error)
{
gboolean ret;
gchar *cmdline = NULL;
@@ -2100,7 +2098,7 @@ out:
* gcm_calibrate_argyll_device:
**/
static gboolean
-gcm_calibrate_argyll_device (GcmCalibrate *calibrate, GtkWindow *window, GError **error)
+gcm_calibrate_argyll_device (GcmCalibrate *calibrate, CdSensor *sensor, GtkWindow *window, GError **error)
{
GcmCalibrateArgyll *calibrate_argyll = GCM_CALIBRATE_ARGYLL(calibrate);
GcmCalibrateArgyllPrivate *priv = calibrate_argyll->priv;
@@ -2455,10 +2453,10 @@ gcm_calibrate_argyll_process_output_cmd (GcmCalibrateArgyll *calibrate_argyll, c
/* spot read result */
found = g_strstr_len (line, -1, "Result is XYZ");
if (found != NULL) {
- GcmColorXYZ *xyz;
+ CdColorXYZ *xyz;
g_warning ("line=%s", line);
split = g_strsplit (line, " ", -1);
- xyz = gcm_color_new_XYZ ();
+ xyz = cd_color_xyz_new ();
g_object_set (xyz,
"cie-x", g_ascii_strtod (split[4], NULL),
"cie-y", g_ascii_strtod (split[5], NULL),
@@ -2469,7 +2467,7 @@ gcm_calibrate_argyll_process_output_cmd (GcmCalibrateArgyll *calibrate_argyll, c
NULL);
priv->done_spot_read = TRUE;
gcm_calibrate_dialog_response (priv->calibrate_dialog, GTK_RESPONSE_CANCEL);
- gcm_color_free_XYZ (xyz);
+ cd_color_xyz_free (xyz);
goto out;
}
diff --git a/src/gcm-calibrate-manual.c b/src/gcm-calibrate-manual.c
index 09dfb37..f749665 100644
--- a/src/gcm-calibrate-manual.c
+++ b/src/gcm-calibrate-manual.c
@@ -471,7 +471,7 @@ gcm_calibrate_manual_apply_cb (GtkWidget *widget, GcmCalibrateManual *calibrate)
* gcm_calibrate_manual_display:
**/
static gboolean
-gcm_calibrate_manual_display (GcmCalibrate *calibrate_, GtkWindow *window, GError **error)
+gcm_calibrate_manual_display (GcmCalibrate *calibrate_, CdSensor *sensor, GtkWindow *window, GError **error)
{
GtkWidget *widget;
guint i;
diff --git a/src/gcm-calibrate-native.c b/src/gcm-calibrate-native.c
index f8dfcff..3615895 100644
--- a/src/gcm-calibrate-native.c
+++ b/src/gcm-calibrate-native.c
@@ -36,7 +36,6 @@
#include <colord.h>
#include "gcm-calibrate-native.h"
-#include "gcm-sensor-client.h"
#include "gcm-calibrate-dialog.h"
#include "gcm-sample-window.h"
#include "gcm-profile.h"
@@ -62,8 +61,8 @@ G_DEFINE_TYPE (GcmCalibrateNative, gcm_calibrate_native, GCM_TYPE_CALIBRATE)
typedef struct {
gchar *patch_name;
- GcmColorRGB *source;
- GcmColorXYZ *result;
+ CdColorRGB *source;
+ CdColorXYZ *result;
} GcmColorSample;
/**
@@ -82,12 +81,17 @@ gcm_calibrate_native_sample_free_cb (GcmColorSample *sample)
* gcm_calibrate_native_sample_measure:
**/
static void
-gcm_calibrate_native_sample_measure (GcmSensor *sensor, GCancellable *cancellable, GcmColorSample *sample)
+gcm_calibrate_native_sample_measure (CdSensor *sensor, GCancellable *cancellable, GcmColorSample *sample)
{
GError *error = NULL;
gboolean ret;
- ret = gcm_sensor_sample (sensor, cancellable, sample->result, &error);
+ ret = cd_sensor_get_sample_sync (sensor,
+ CD_SENSOR_CAP_LCD,
+ sample->result,
+ NULL,
+ cancellable,
+ &error);
g_assert_no_error (error);
g_assert (ret);
}
@@ -96,15 +100,15 @@ gcm_calibrate_native_sample_measure (GcmSensor *sensor, GCancellable *cancellabl
* gcm_calibrate_native_sample_add:
**/
static void
-gcm_calibrate_native_sample_add (GPtrArray *array, const gchar *patch_name, const GcmColorRGB *source)
+gcm_calibrate_native_sample_add (GPtrArray *array, const gchar *patch_name, const CdColorRGB *source)
{
GcmColorSample *sample;
sample = g_new0 (GcmColorSample, 1);
sample->patch_name = g_strdup (patch_name);
- sample->source = g_new0 (GcmColorRGB, 1);
- sample->result = g_new0 (GcmColorXYZ, 1);
- gcm_color_copy_RGB (source, sample->source);
+ sample->source = g_new0 (CdColorRGB, 1);
+ sample->result = g_new0 (CdColorXYZ, 1);
+ cd_color_copy_rgb (source, sample->source);
g_ptr_array_add (array, sample);
}
@@ -154,21 +158,18 @@ gcm_calibrate_native_sample_write (GPtrArray *array, const gchar *filename)
cmsIT8Free (it8);
}
-//FIXME
-#include "gcm-sensor-huey.h"
-
/**
* gcm_calibrate_native_create_it8_file:
**/
static void
-gcm_calibrate_native_create_it8_file (GcmCalibrateNative *calibrate_native, GcmSensor *sensor, const gchar *filename, guint steps)
+gcm_calibrate_native_create_it8_file (GcmCalibrateNative *calibrate_native, CdSensor *sensor, const gchar *filename, guint steps)
{
GcmCalibrateNativePrivate *priv = calibrate_native->priv;
guint i;
gchar *patch_name;
GcmColorSample *sample;
GPtrArray *array;
- GcmColorRGB source;
+ CdColorRGB source;
gdouble divisions;
/* step size */
@@ -265,7 +266,7 @@ out:
* gcm_calibrate_native_get_it8_patch_rgb_xyz:
**/
static void
-gcm_calibrate_native_get_it8_patch_rgb_xyz (cmsHANDLE it8_handle, const gchar *patch, GcmColorRGB *rgb, GcmColorXYZ *xyz)
+gcm_calibrate_native_get_it8_patch_rgb_xyz (cmsHANDLE it8_handle, const gchar *patch, CdColorRGB *rgb, CdColorXYZ *xyz)
{
if (rgb != NULL) {
rgb->R = cmsIT8GetDataDbl (it8_handle, patch, "RGB_R");
@@ -285,7 +286,7 @@ gcm_calibrate_native_get_it8_patch_rgb_xyz (cmsHANDLE it8_handle, const gchar *p
static void
gcm_calibrate_native_get_it8_patch_xyY (cmsHANDLE it8_handle, const gchar *patch, cmsCIExyY *result)
{
- GcmColorXYZ sample;
+ CdColorXYZ sample;
gcm_calibrate_native_get_it8_patch_rgb_xyz (it8_handle, patch, NULL, &sample);
cmsXYZ2xyY (result, (cmsCIEXYZ*) &sample);
}
@@ -320,12 +321,12 @@ gcm_calibrate_native_interpolate_array (gdouble *data, guint data_size, gdouble
#if 0
/**
- * _gcm_color_normalize_XYZ:
+ * _cd_color_normalize_XYZ:
*
* Return value: the Y value that was normalised
**/
static gdouble
-_gcm_color_normalize_XYZ (GcmColorXYZ *xyz)
+_cd_color_normalize_XYZ (CdColorXYZ *xyz)
{
gdouble Y;
@@ -343,10 +344,10 @@ _gcm_color_normalize_XYZ (GcmColorXYZ *xyz)
#endif
/**
- * _gcm_color_scale_XYZ:
+ * _cd_color_scale_XYZ:
**/
static void
-_gcm_color_scale_XYZ (GcmColorXYZ *xyz, gdouble scale)
+_cd_color_scale_XYZ (CdColorXYZ *xyz, gdouble scale)
{
g_return_if_fail (xyz != NULL);
@@ -367,9 +368,9 @@ gcm_calibrate_native_create_profile_from_it8 (GcmProfile *profile, const gchar *
cmsHANDLE it8_handle;
cmsCIExyYTRIPLE primaries;
cmsCIExyY whitepoint;
- GcmColorXYZ primary_red;
- GcmColorXYZ primary_green;
- GcmColorXYZ primary_blue;
+ CdColorXYZ primary_red;
+ CdColorXYZ primary_green;
+ CdColorXYZ primary_blue;
guint i, j;
const gdouble gamma22 = 2.2f;
const gchar *patch_data;
@@ -377,12 +378,12 @@ gcm_calibrate_native_create_profile_from_it8 (GcmProfile *profile, const gchar *
gdouble div;
gdouble temperature;
gdouble whitepointY;
- GcmColorXYZ patch_xyz;
- GcmColorRGB patch_rgb;
- GcmColorRGB actual_rgb;
- GcmColorXYZ actual_xyz;
- GcmColorRGB scale;
- GcmColorRGB leakage;
+ CdColorXYZ patch_xyz;
+ CdColorRGB patch_rgb;
+ CdColorRGB actual_rgb;
+ CdColorXYZ actual_xyz;
+ CdColorRGB scale;
+ CdColorRGB leakage;
cmsHPROFILE conversion_profile = NULL;
cmsHPROFILE xyz_profile = NULL;
cmsToneCurve *transfer_curve[3] = { NULL, NULL, NULL };
@@ -403,7 +404,7 @@ gcm_calibrate_native_create_profile_from_it8 (GcmProfile *profile, const gchar *
/* we need to scale each reading by this value */
whitepointY = whitepoint.Y;
-// _gcm_color_normalize_XYZ (&whitepoint);
+// _cd_color_normalize_XYZ (&whitepoint);
/* optionally use a D50 target */
// cmsWhitePointFromTemp (&whitepoint, 5000);
@@ -433,9 +434,9 @@ gcm_calibrate_native_create_profile_from_it8 (GcmProfile *profile, const gchar *
gcm_calibrate_native_get_it8_patch_rgb_xyz (it8_handle, "CBL", NULL, &primary_blue);
/* scale the values */
- _gcm_color_scale_XYZ (&primary_red, whitepointY);
- _gcm_color_scale_XYZ (&primary_green, whitepointY);
- _gcm_color_scale_XYZ (&primary_blue, whitepointY);
+ _cd_color_scale_XYZ (&primary_red, whitepointY);
+ _cd_color_scale_XYZ (&primary_green, whitepointY);
+ _cd_color_scale_XYZ (&primary_blue, whitepointY);
/* set the primaries */
ret = gcm_profile_set_primaries (profile, &primary_red, &primary_green, &primary_blue, error);
@@ -478,7 +479,7 @@ gcm_calibrate_native_create_profile_from_it8 (GcmProfile *profile, const gchar *
gcm_calibrate_native_get_it8_patch_rgb_xyz (it8_handle, patch_name, &patch_rgb, &patch_xyz);
/* scale the values */
- _gcm_color_scale_XYZ (&patch_xyz, whitepointY);
+ _cd_color_scale_XYZ (&patch_xyz, whitepointY);
cmsDoTransform (conversion_transform, &patch_xyz, &actual_rgb, 1);
g_debug ("%s = %f,%f,%f -> %f,%f,%f", patch_name,
@@ -507,7 +508,7 @@ gcm_calibrate_native_create_profile_from_it8 (GcmProfile *profile, const gchar *
}
/* remove the backlight leakage */
- gcm_color_set_RGB (&leakage, G_MAXDOUBLE, G_MAXDOUBLE, G_MAXDOUBLE);
+ cd_color_set_rgb (&leakage, G_MAXDOUBLE, G_MAXDOUBLE, G_MAXDOUBLE);
for (i=0; i<rampsize; i++) {
if (data_sampled[0][i] < leakage.R)
leakage.R = data_sampled[0][i];
@@ -524,7 +525,7 @@ gcm_calibrate_native_create_profile_from_it8 (GcmProfile *profile, const gchar *
g_debug ("removed backlight leakage = %f,%f,%f", leakage.R, leakage.G, leakage.B);
/* scale all values to 1.0 */
- gcm_color_set_RGB (&scale, 0.0, 0.0, 0.0);
+ cd_color_set_rgb (&scale, 0.0, 0.0, 0.0);
for (i=0; i<rampsize; i++) {
if (data_sampled[0][i] > scale.R)
scale.R = data_sampled[0][i];
@@ -590,21 +591,20 @@ out:
* gcm_calibrate_native_display:
**/
static gboolean
-gcm_calibrate_native_display (GcmCalibrate *calibrate, GtkWindow *window, GError **error)
+gcm_calibrate_native_display (GcmCalibrate *calibrate, CdSensor *sensor, GtkWindow *window, GError **error)
{
GcmCalibrateNative *calibrate_native = GCM_CALIBRATE_NATIVE(calibrate);
GcmCalibrateNativePrivate *priv = calibrate_native->priv;
gboolean ret = TRUE;
GcmCalibratePrecision precision;
guint steps = 0;
- GcmSensor *sensor;
gchar *copyright = NULL;
gchar *description = NULL;
gchar *manufacturer = NULL;
gchar *model = NULL;
const gchar *title;
const gchar *message;
- const gchar *filename;
+ const gchar *filename = NULL;
const gchar *basename;
gchar *filename_it8 = NULL;
gchar *filename_icc = NULL;
@@ -642,9 +642,6 @@ gcm_calibrate_native_display (GcmCalibrate *calibrate, GtkWindow *window, GError
cmsSaveProfileToFile (profile, "dave.icc");
#endif
- /* TODO: get from GcmCalibrate */
- sensor = gcm_sensor_huey_new ();
-
/* show window */
gtk_window_present (priv->sample_window);
@@ -652,7 +649,7 @@ gcm_calibrate_native_display (GcmCalibrate *calibrate, GtkWindow *window, GError
title = _("Please attach instrument");
/* get the image, if we have one */
- filename = gcm_sensor_get_image_display (sensor);
+// filename = cd_sensor_get_image_display (sensor);
/* different messages with or without image */
if (filename != NULL) {
@@ -745,7 +742,6 @@ gcm_calibrate_native_display (GcmCalibrate *calibrate, GtkWindow *window, GError
goto out;
out:
- g_object_unref (sensor);
g_free (filename_it8);
g_free (filename_icc);
g_free (copyright);
@@ -759,7 +755,7 @@ out:
* gcm_calibrate_native_spotread:
**/
static gboolean
-gcm_calibrate_native_spotread (GcmCalibrate *calibrate, GtkWindow *window, GError **error)
+gcm_calibrate_native_spotread (GcmCalibrate *calibrate, CdSensor *sensor, GtkWindow *window, GError **error)
{
GcmCalibrateNative *calibrate_native = GCM_CALIBRATE_NATIVE(calibrate);
GcmCalibrateNativePrivate *priv = calibrate_native->priv;
diff --git a/src/gcm-calibrate.c b/src/gcm-calibrate.c
index 71f8ab5..fb179f3 100644
--- a/src/gcm-calibrate.c
+++ b/src/gcm-calibrate.c
@@ -33,10 +33,8 @@
#include <colord.h>
#include "gcm-calibrate.h"
-#include "gcm-color.h"
#include "gcm-utils.h"
#include "gcm-brightness.h"
-#include "gcm-sensor-client.h"
#include "gcm-calibrate-dialog.h"
#include "gcm-exif.h"
@@ -51,15 +49,15 @@ static void gcm_calibrate_finalize (GObject *object);
**/
struct _GcmCalibratePrivate
{
- GcmSensorClient *sensor_client;
GcmCalibrateReferenceKind reference_kind;
GcmCalibrateDeviceKind calibrate_device_kind;
GcmCalibratePrintKind print_kind;
GcmCalibratePrecision precision;
- GcmSensorKind sensor_kind;
+ CdSensor *sensor;
+ CdSensorKind sensor_kind;
GcmCalibrateDialog *calibrate_dialog;
CdDeviceKind device_kind;
- GcmColorXYZ *xyz;
+ CdColorXYZ *xyz;
gchar *output_name;
gchar *filename_source;
gchar *filename_reference;
@@ -302,7 +300,10 @@ gcm_calibrate_set_basename (GcmCalibrate *calibrate)
* gcm_calibrate_set_from_device:
**/
gboolean
-gcm_calibrate_set_from_device (GcmCalibrate *calibrate, CdDevice *device, GError **error)
+gcm_calibrate_set_from_device (GcmCalibrate *calibrate,
+ CdDevice *device,
+ CdSensor *sensor,
+ GError **error)
{
gboolean ret = TRUE;
const gchar *native_device = NULL;
@@ -319,6 +320,11 @@ gcm_calibrate_set_from_device (GcmCalibrate *calibrate, CdDevice *device, GError
description = cd_device_get_model (device);
manufacturer = cd_device_get_vendor (device);
+ /* do not refcount */
+ calibrate->priv->sensor = sensor;
+ calibrate->priv->sensor_kind = cd_sensor_get_kind (sensor);
+ g_object_notify (G_OBJECT (calibrate), "sensor-kind");
+
/* set the proper values */
g_object_set (calibrate,
"device-kind", kind,
@@ -333,9 +339,7 @@ gcm_calibrate_set_from_device (GcmCalibrate *calibrate, CdDevice *device, GError
/* display specific properties */
if (kind == CD_DEVICE_KIND_DISPLAY) {
-#if CD_CHECK_VERSION(0,1,5)
native_device = cd_device_get_metadata_item (device, "XRANDR_name");
-#endif
if (native_device == NULL) {
g_set_error (error,
GCM_CALIBRATE_ERROR,
@@ -438,7 +442,7 @@ gcm_calibrate_get_display_kind (GcmCalibrate *calibrate, GtkWindow *window, GErr
/* can this device support projectors? */
if (priv->calibrate_device_kind == GCM_CALIBRATE_DEVICE_KIND_PROJECTOR &&
- !gcm_sensor_supports_projector (gcm_sensor_client_get_sensor (priv->sensor_client))) {
+ !cd_sensor_has_cap (priv->sensor, CD_SENSOR_CAP_PROJECTOR)) {
/* TRANSLATORS: title, the hardware calibration device does not support projectors */
title = _("Could not calibrate and profile using this color measuring instrument");
@@ -546,6 +550,7 @@ gboolean
gcm_calibrate_spotread (GcmCalibrate *calibrate, GtkWindow *window, GError **error)
{
GcmCalibrateClass *klass = GCM_CALIBRATE_GET_CLASS (calibrate);
+ GcmCalibratePrivate *priv = calibrate->priv;
gboolean ret;
/* set the per-profile filename */
@@ -564,7 +569,7 @@ gcm_calibrate_spotread (GcmCalibrate *calibrate, GtkWindow *window, GError **err
}
/* proxy */
- ret = klass->calibrate_spotread (calibrate, window, error);
+ ret = klass->calibrate_spotread (calibrate, priv->sensor, window, error);
out:
return ret;
}
@@ -586,7 +591,6 @@ gcm_calibrate_display (GcmCalibrate *calibrate, GtkWindow *window, GError **erro
GError *error_tmp = NULL;
gchar *precision = NULL;
GcmCalibratePrivate *priv = calibrate->priv;
- GcmSensor *sensor;
/* coldplug source */
if (priv->output_name == NULL) {
@@ -613,19 +617,8 @@ gcm_calibrate_display (GcmCalibrate *calibrate, GtkWindow *window, GError **erro
goto out;
}
- /* get calibration device model */
- sensor = gcm_sensor_client_get_sensor (priv->sensor_client);
- if (sensor == NULL) {
- ret = FALSE;
- g_set_error_literal (error,
- GCM_CALIBRATE_ERROR,
- GCM_CALIBRATE_ERROR_INTERNAL,
- "no sensor found");
- goto out;
- }
- hardware_device = gcm_sensor_get_model (sensor);
-
/* get device, harder */
+ hardware_device = cd_sensor_get_model (priv->sensor);
if (hardware_device == NULL) {
/* TRANSLATORS: this is the formattted custom profile description.
* "Custom" refers to the fact that it's user generated */
@@ -726,7 +719,7 @@ gcm_calibrate_display (GcmCalibrate *calibrate, GtkWindow *window, GError **erro
}
/* proxy */
- ret = klass->calibrate_display (calibrate, window, error);
+ ret = klass->calibrate_display (calibrate, priv->sensor, window, error);
out:
/* restore brightness */
if (percentage != G_MAXUINT) {
@@ -1016,7 +1009,7 @@ gcm_calibrate_printer (GcmCalibrate *calibrate, GtkWindow *window, GError **erro
}
/* proxy */
- ret = klass->calibrate_printer (calibrate, window, error);
+ ret = klass->calibrate_printer (calibrate, priv->sensor, window, error);
out:
g_free (precision);
return ret;
@@ -1196,7 +1189,7 @@ gcm_calibrate_device (GcmCalibrate *calibrate, GtkWindow *window, GError **error
}
/* proxy */
- ret = klass->calibrate_device (calibrate, window, error);
+ ret = klass->calibrate_device (calibrate, priv->sensor, window, error);
out:
if (string != NULL)
g_string_free (string, TRUE);
@@ -1269,7 +1262,7 @@ gcm_calibrate_get_property (GObject *object, guint prop_id, GValue *value, GPara
g_value_set_uint (value, priv->precision);
break;
case PROP_XYZ:
- g_value_set_boxed (value, g_boxed_copy (GCM_TYPE_COLOR_XYZ, priv->xyz));
+ g_value_set_boxed (value, g_boxed_copy (CD_TYPE_COLOR_XYZ, priv->xyz));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -1293,20 +1286,6 @@ gcm_calibrate_guess_kind (GcmCalibrate *calibrate)
}
/**
- * gcm_prefs_sensor_client_changed_cb:
- **/
-static void
-gcm_prefs_sensor_client_changed_cb (GcmSensorClient *_sensor_client, GcmCalibrate *calibrate)
-{
- GcmSensor *sensor;
- calibrate->priv->sensor_kind = GCM_SENSOR_KIND_UNKNOWN;
- sensor = gcm_sensor_client_get_sensor (_sensor_client);
- if (sensor != NULL)
- calibrate->priv->sensor_kind = gcm_sensor_get_kind (sensor);
- g_object_notify (G_OBJECT (calibrate), "sensor-kind");
-}
-
-/**
* gcm_calibrate_set_property:
**/
static void
@@ -1367,8 +1346,8 @@ gcm_calibrate_set_property (GObject *object, guint prop_id, const GValue *value,
break;
case PROP_XYZ:
if (priv->xyz != NULL)
- gcm_color_free_XYZ (priv->xyz);
- priv->xyz = g_boxed_copy (GCM_TYPE_COLOR_XYZ, value);
+ cd_color_xyz_free (priv->xyz);
+ priv->xyz = g_boxed_copy (CD_TYPE_COLOR_XYZ, value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -1528,7 +1507,7 @@ gcm_calibrate_class_init (GcmCalibrateClass *klass)
* GcmCalibrate:xyz:
*/
pspec = g_param_spec_boxed ("xyz", NULL, NULL,
- GCM_TYPE_COLOR_XYZ,
+ CD_TYPE_COLOR_XYZ,
G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_XYZ, pspec);
@@ -1541,8 +1520,6 @@ gcm_calibrate_class_init (GcmCalibrateClass *klass)
static void
gcm_calibrate_init (GcmCalibrate *calibrate)
{
- GcmSensor *sensor;
-
calibrate->priv = GCM_CALIBRATE_GET_PRIVATE (calibrate);
calibrate->priv->output_name = NULL;
calibrate->priv->filename_source = NULL;
@@ -1554,13 +1531,12 @@ gcm_calibrate_init (GcmCalibrate *calibrate)
calibrate->priv->description = NULL;
calibrate->priv->device = NULL;
calibrate->priv->serial = NULL;
- calibrate->priv->xyz = gcm_color_new_XYZ ();
+ calibrate->priv->xyz = cd_color_xyz_new ();
calibrate->priv->working_path = NULL;
calibrate->priv->calibrate_device_kind = GCM_CALIBRATE_DEVICE_KIND_UNKNOWN;
calibrate->priv->print_kind = GCM_CALIBRATE_PRINT_KIND_UNKNOWN;
calibrate->priv->reference_kind = GCM_CALIBRATE_REFERENCE_KIND_UNKNOWN;
calibrate->priv->precision = GCM_CALIBRATE_PRECISION_UNKNOWN;
- calibrate->priv->sensor_client = gcm_sensor_client_new ();
calibrate->priv->calibrate_dialog = gcm_calibrate_dialog_new ();
// FIXME: this has to be per-run specific
@@ -1568,14 +1544,6 @@ gcm_calibrate_init (GcmCalibrate *calibrate)
/* use GSettings to get defaults */
calibrate->priv->settings = g_settings_new (GCM_SETTINGS_SCHEMA);
-
- /* coldplug, and watch for changes */
- calibrate->priv->sensor_kind = GCM_SENSOR_KIND_UNKNOWN;
- sensor = gcm_sensor_client_get_sensor (calibrate->priv->sensor_client);
- if (sensor != NULL)
- calibrate->priv->sensor_kind = gcm_sensor_get_kind (sensor);
-
- g_signal_connect (calibrate->priv->sensor_client, "changed", G_CALLBACK (gcm_prefs_sensor_client_changed_cb), calibrate);
}
/**
@@ -1598,9 +1566,7 @@ gcm_calibrate_finalize (GObject *object)
g_free (priv->device);
g_free (priv->serial);
g_free (priv->working_path);
- g_signal_handlers_disconnect_by_func (calibrate->priv->sensor_client, G_CALLBACK (gcm_prefs_sensor_client_changed_cb), calibrate);
- gcm_color_free_XYZ (priv->xyz);
- g_object_unref (priv->sensor_client);
+ cd_color_xyz_free (priv->xyz);
g_object_unref (priv->calibrate_dialog);
g_object_unref (priv->settings);
diff --git a/src/gcm-calibrate.h b/src/gcm-calibrate.h
index 2adb979..2904814 100644
--- a/src/gcm-calibrate.h
+++ b/src/gcm-calibrate.h
@@ -50,15 +50,19 @@ struct _GcmCalibrateClass
GObjectClass parent_class;
/* vtable */
gboolean (*calibrate_display) (GcmCalibrate *calibrate,
+ CdSensor *sensor,
GtkWindow *window,
GError **error);
gboolean (*calibrate_device) (GcmCalibrate *calibrate,
+ CdSensor *sensor,
GtkWindow *window,
GError **error);
gboolean (*calibrate_printer) (GcmCalibrate *calibrate,
+ CdSensor *sensor,
GtkWindow *window,
GError **error);
gboolean (*calibrate_spotread) (GcmCalibrate *calibrate,
+ CdSensor *sensor,
GtkWindow *window,
GError **error);
/* padding for future expansion */
@@ -130,6 +134,7 @@ gboolean gcm_calibrate_spotread (GcmCalibrate *calibrate,
GError **error);
gboolean gcm_calibrate_set_from_device (GcmCalibrate *calibrate,
CdDevice *device,
+ CdSensor *sensor,
GError **error);
gboolean gcm_calibrate_set_from_exif (GcmCalibrate *calibrate,
const gchar *filename,
diff --git a/src/gcm-cie-widget.c b/src/gcm-cie-widget.c
index 2fe5c1a..4bdeb4c 100644
--- a/src/gcm-cie-widget.c
+++ b/src/gcm-cie-widget.c
@@ -29,7 +29,6 @@
#include <stdlib.h>
#include <math.h>
-#include "gcm-color.h"
#include "gcm-cie-widget.h"
G_DEFINE_TYPE (GcmCieWidget, gcm_cie_widget, GTK_TYPE_DRAWING_AREA);
@@ -49,10 +48,10 @@ struct GcmCieWidgetPrivate
/* CIE x and y coordinates of its three primary illuminants and the
* x and y coordinates of the white point. */
- GcmColorYxy *red; /* red primary illuminant */
- GcmColorYxy *green; /* green primary illuminant */
- GcmColorYxy *blue; /* blue primary illuminant */
- GcmColorYxy *white; /* white point */
+ CdColorYxy *red; /* red primary illuminant */
+ CdColorYxy *green; /* green primary illuminant */
+ CdColorYxy *blue; /* blue primary illuminant */
+ CdColorYxy *white; /* white point */
gdouble gamma; /* gamma of nonlinear correction */
};
@@ -440,16 +439,16 @@ gcm_cie_set_property (GObject *object, guint prop_id, const GValue *value, GPara
cie->priv->use_whitepoint = g_value_get_boolean (value);
break;
case PROP_RED:
- gcm_color_copy_Yxy (g_value_get_boxed (value), priv->red);
+ cd_color_copy_yxy (g_value_get_boxed (value), priv->red);
break;
case PROP_GREEN:
- gcm_color_copy_Yxy (g_value_get_boxed (value), priv->green);
+ cd_color_copy_yxy (g_value_get_boxed (value), priv->green);
break;
case PROP_BLUE:
- gcm_color_copy_Yxy (g_value_get_boxed (value), priv->blue);
+ cd_color_copy_yxy (g_value_get_boxed (value), priv->blue);
break;
case PROP_WHITE:
- gcm_color_copy_Yxy (g_value_get_boxed (value), priv->white);
+ cd_color_copy_yxy (g_value_get_boxed (value), priv->white);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -491,22 +490,22 @@ gcm_cie_widget_class_init (GcmCieWidgetClass *class)
g_object_class_install_property (object_class,
PROP_RED,
g_param_spec_boxed ("red", NULL, NULL,
- GCM_TYPE_COLOR_YXY,
+ CD_TYPE_COLOR_YXY,
G_PARAM_WRITABLE));
g_object_class_install_property (object_class,
PROP_GREEN,
g_param_spec_boxed ("green", NULL, NULL,
- GCM_TYPE_COLOR_YXY,
+ CD_TYPE_COLOR_YXY,
G_PARAM_WRITABLE));
g_object_class_install_property (object_class,
PROP_BLUE,
g_param_spec_boxed ("blue", NULL, NULL,
- GCM_TYPE_COLOR_YXY,
+ CD_TYPE_COLOR_YXY,
G_PARAM_WRITABLE));
g_object_class_install_property (object_class,
PROP_WHITE,
g_param_spec_boxed ("white", NULL, NULL,
- GCM_TYPE_COLOR_YXY,
+ CD_TYPE_COLOR_YXY,
G_PARAM_WRITABLE));
}
@@ -517,10 +516,10 @@ void
gcm_cie_widget_set_from_profile (GtkWidget *widget, GcmProfile *profile)
{
GcmCieWidget *cie = GCM_CIE_WIDGET (widget);
- GcmColorXYZ *white;
- GcmColorXYZ *red;
- GcmColorXYZ *green;
- GcmColorXYZ *blue;
+ CdColorXYZ *white;
+ CdColorXYZ *red;
+ CdColorXYZ *green;
+ CdColorXYZ *blue;
/* get the new details from the profile */
g_object_get (profile,
@@ -531,10 +530,10 @@ gcm_cie_widget_set_from_profile (GtkWidget *widget, GcmProfile *profile)
NULL);
/* copy into this widget */
- gcm_color_convert_XYZ_to_Yxy (white, cie->priv->white);
- gcm_color_convert_XYZ_to_Yxy (red, cie->priv->red);
- gcm_color_convert_XYZ_to_Yxy (green, cie->priv->green);
- gcm_color_convert_XYZ_to_Yxy (blue, cie->priv->blue);
+ cd_color_convert_xyz_to_yxy (white, cie->priv->white);
+ cd_color_convert_xyz_to_yxy (red, cie->priv->red);
+ cd_color_convert_xyz_to_yxy (green, cie->priv->green);
+ cd_color_convert_xyz_to_yxy (blue, cie->priv->blue);
/* hide if we have no data */
if (cie->priv->white->x > 0.001) {
@@ -545,10 +544,10 @@ gcm_cie_widget_set_from_profile (GtkWidget *widget, GcmProfile *profile)
}
/* free */
- gcm_color_free_XYZ (white);
- gcm_color_free_XYZ (red);
- gcm_color_free_XYZ (green);
- gcm_color_free_XYZ (blue);
+ cd_color_xyz_free (white);
+ cd_color_xyz_free (red);
+ cd_color_xyz_free (green);
+ cd_color_xyz_free (blue);
}
/**
@@ -567,10 +566,10 @@ gcm_cie_widget_init (GcmCieWidget *cie)
cie->priv->tongue_buffer = g_ptr_array_new_with_free_func (g_free);
/* default is CIE REC 709 */
- cie->priv->red = gcm_color_new_Yxy ();
- cie->priv->green = gcm_color_new_Yxy ();
- cie->priv->blue = gcm_color_new_Yxy ();
- cie->priv->white = gcm_color_new_Yxy ();
+ cie->priv->red = cd_color_yxy_new ();
+ cie->priv->green = cd_color_yxy_new ();
+ cie->priv->blue = cd_color_yxy_new ();
+ cie->priv->white = cd_color_yxy_new ();
cie->priv->red->x = 0.64;
cie->priv->red->y = 0.33;
cie->priv->green->x = 0.30;
@@ -603,10 +602,10 @@ gcm_cie_widget_finalize (GObject *object)
context = pango_layout_get_context (cie->priv->layout);
g_object_unref (cie->priv->layout);
- gcm_color_free_Yxy (cie->priv->white);
- gcm_color_free_Yxy (cie->priv->red);
- gcm_color_free_Yxy (cie->priv->green);
- gcm_color_free_Yxy (cie->priv->blue);
+ cd_color_yxy_free (cie->priv->white);
+ cd_color_yxy_free (cie->priv->red);
+ cd_color_yxy_free (cie->priv->green);
+ cd_color_yxy_free (cie->priv->blue);
g_object_unref (context);
g_ptr_array_unref (cie->priv->tongue_buffer);
G_OBJECT_CLASS (gcm_cie_widget_parent_class)->finalize (object);
diff --git a/src/gcm-edid.c b/src/gcm-edid.c
index 1f4e759..db6592f 100644
--- a/src/gcm-edid.c
+++ b/src/gcm-edid.c
@@ -34,7 +34,6 @@
#include <gio/gio.h>
#include <stdlib.h>
-#include "gcm-color.h"
#include "gcm-edid.h"
#include "gcm-tables.h"
@@ -58,10 +57,10 @@ struct _GcmEdidPrivate
guint width;
guint height;
gfloat gamma;
- GcmColorYxy *red;
- GcmColorYxy *green;
- GcmColorYxy *blue;
- GcmColorYxy *white;
+ CdColorYxy *red;
+ CdColorYxy *green;
+ CdColorYxy *blue;
+ CdColorYxy *white;
GcmTables *tables;
};
@@ -245,9 +244,9 @@ gcm_edid_get_gamma (GcmEdid *edid)
*
* Gets the monitor red chromaticity value.
*
- * Return value: the #GcmColorYxy value
+ * Return value: the #CdColorYxy value
**/
-const GcmColorYxy *
+const CdColorYxy *
gcm_edid_get_red (GcmEdid *edid)
{
g_return_val_if_fail (GCM_IS_EDID (edid), NULL);
@@ -260,9 +259,9 @@ gcm_edid_get_red (GcmEdid *edid)
*
* Gets the monitor green chromaticity value.
*
- * Return value: the #GcmColorYxy value
+ * Return value: the #CdColorYxy value
**/
-const GcmColorYxy *
+const CdColorYxy *
gcm_edid_get_green (GcmEdid *edid)
{
g_return_val_if_fail (GCM_IS_EDID (edid), NULL);
@@ -275,9 +274,9 @@ gcm_edid_get_green (GcmEdid *edid)
*
* Gets the monitor red chromaticity value.
*
- * Return value: the #GcmColorYxy value
+ * Return value: the #CdColorYxy value
**/
-const GcmColorYxy *
+const CdColorYxy *
gcm_edid_get_blue (GcmEdid *edid)
{
g_return_val_if_fail (GCM_IS_EDID (edid), NULL);
@@ -290,9 +289,9 @@ gcm_edid_get_blue (GcmEdid *edid)
*
* Gets the monitor white chromaticity value.
*
- * Return value: the #GcmColorYxy value
+ * Return value: the #CdColorYxy value
**/
-const GcmColorYxy *
+const CdColorYxy *
gcm_edid_get_white (GcmEdid *edid)
{
g_return_val_if_fail (GCM_IS_EDID (edid), NULL);
@@ -612,16 +611,16 @@ gcm_edid_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec
g_value_set_uint (value, priv->height);
break;
case PROP_WHITE:
- g_value_set_boxed (value, g_boxed_copy (GCM_TYPE_COLOR_XYZ, priv->white));
+ g_value_set_boxed (value, g_boxed_copy (CD_TYPE_COLOR_XYZ, priv->white));
break;
case PROP_RED:
- g_value_set_boxed (value, g_boxed_copy (GCM_TYPE_COLOR_XYZ, priv->red));
+ g_value_set_boxed (value, g_boxed_copy (CD_TYPE_COLOR_XYZ, priv->red));
break;
case PROP_GREEN:
- g_value_set_boxed (value, g_boxed_copy (GCM_TYPE_COLOR_XYZ, priv->green));
+ g_value_set_boxed (value, g_boxed_copy (CD_TYPE_COLOR_XYZ, priv->green));
break;
case PROP_BLUE:
- g_value_set_boxed (value, g_boxed_copy (GCM_TYPE_COLOR_XYZ, priv->blue));
+ g_value_set_boxed (value, g_boxed_copy (CD_TYPE_COLOR_XYZ, priv->blue));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -732,7 +731,7 @@ gcm_edid_class_init (GcmEdidClass *klass)
g_object_class_install_property (object_class,
PROP_RED,
g_param_spec_boxed ("red", NULL, NULL,
- GCM_TYPE_COLOR_YXY,
+ CD_TYPE_COLOR_YXY,
G_PARAM_READABLE));
/**
* GcmEdid:green:
@@ -740,7 +739,7 @@ gcm_edid_class_init (GcmEdidClass *klass)
g_object_class_install_property (object_class,
PROP_GREEN,
g_param_spec_boxed ("green", NULL, NULL,
- GCM_TYPE_COLOR_YXY,
+ CD_TYPE_COLOR_YXY,
G_PARAM_READABLE));
/**
* GcmEdid:blue:
@@ -748,7 +747,7 @@ gcm_edid_class_init (GcmEdidClass *klass)
g_object_class_install_property (object_class,
PROP_BLUE,
g_param_spec_boxed ("blue", NULL, NULL,
- GCM_TYPE_COLOR_YXY,
+ CD_TYPE_COLOR_YXY,
G_PARAM_READABLE));
/**
* GcmEdid:white:
@@ -756,7 +755,7 @@ gcm_edid_class_init (GcmEdidClass *klass)
g_object_class_install_property (object_class,
PROP_WHITE,
g_param_spec_boxed ("white", NULL, NULL,
- GCM_TYPE_COLOR_YXY,
+ CD_TYPE_COLOR_YXY,
G_PARAM_READABLE));
g_type_class_add_private (klass, sizeof (GcmEdidPrivate));
@@ -776,10 +775,10 @@ gcm_edid_init (GcmEdid *edid)
edid->priv->checksum = NULL;
edid->priv->tables = gcm_tables_new ();
edid->priv->pnp_id = g_new0 (gchar, 4);
- edid->priv->red = gcm_color_new_Yxy ();
- edid->priv->green = gcm_color_new_Yxy ();
- edid->priv->blue = gcm_color_new_Yxy ();
- edid->priv->white = gcm_color_new_Yxy ();
+ edid->priv->red = cd_color_yxy_new ();
+ edid->priv->green = cd_color_yxy_new ();
+ edid->priv->blue = cd_color_yxy_new ();
+ edid->priv->white = cd_color_yxy_new ();
}
/**
@@ -797,10 +796,10 @@ gcm_edid_finalize (GObject *object)
g_free (priv->eisa_id);
g_free (priv->checksum);
g_free (priv->pnp_id);
- gcm_color_free_Yxy (priv->white);
- gcm_color_free_Yxy (priv->red);
- gcm_color_free_Yxy (priv->green);
- gcm_color_free_Yxy (priv->blue);
+ cd_color_yxy_free (priv->white);
+ cd_color_yxy_free (priv->red);
+ cd_color_yxy_free (priv->green);
+ cd_color_yxy_free (priv->blue);
g_object_unref (priv->tables);
G_OBJECT_CLASS (gcm_edid_parent_class)->finalize (object);
diff --git a/src/gcm-edid.h b/src/gcm-edid.h
index f511ae9..afdaf9b 100644
--- a/src/gcm-edid.h
+++ b/src/gcm-edid.h
@@ -23,8 +23,7 @@
#define __GCM_EDID_H
#include <glib-object.h>
-
-#include "gcm-color.h"
+#include <colord.h>
G_BEGIN_DECLS
@@ -72,10 +71,10 @@ const gchar *gcm_edid_get_pnp_id (GcmEdid *edid);
guint gcm_edid_get_width (GcmEdid *edid);
guint gcm_edid_get_height (GcmEdid *edid);
gfloat gcm_edid_get_gamma (GcmEdid *edid);
-const GcmColorYxy *gcm_edid_get_red (GcmEdid *edid);
-const GcmColorYxy *gcm_edid_get_green (GcmEdid *edid);
-const GcmColorYxy *gcm_edid_get_blue (GcmEdid *edid);
-const GcmColorYxy *gcm_edid_get_white (GcmEdid *edid);
+const CdColorYxy *gcm_edid_get_red (GcmEdid *edid);
+const CdColorYxy *gcm_edid_get_green (GcmEdid *edid);
+const CdColorYxy *gcm_edid_get_blue (GcmEdid *edid);
+const CdColorYxy *gcm_edid_get_white (GcmEdid *edid);
G_END_DECLS
diff --git a/src/gcm-hull.c b/src/gcm-hull.c
index 1745c05..14257ac 100644
--- a/src/gcm-hull.c
+++ b/src/gcm-hull.c
@@ -23,8 +23,8 @@
#include <glib-object.h>
#include <math.h>
+#include <colord.h>
-#include "gcm-color.h"
#include "gcm-hull.h"
static void gcm_hull_finalize (GObject *object);
@@ -44,8 +44,8 @@ struct _GcmHullPrivate
};
typedef struct {
- GcmColorXYZ xyz;
- GcmColorRGB color;
+ CdColorXYZ xyz;
+ CdColorRGB color;
} GcmHullVertex;
typedef struct {
@@ -85,13 +85,13 @@ g_hull_face_free (GcmHullFace *face)
**/
void
gcm_hull_add_vertex (GcmHull *hull,
- GcmColorXYZ *xyz,
- GcmColorRGB *color)
+ CdColorXYZ *xyz,
+ CdColorRGB *color)
{
GcmHullVertex *new;
new = g_slice_new (GcmHullVertex);
- gcm_color_copy_XYZ (xyz, &new->xyz);
- gcm_color_copy_RGB (color, &new->color);
+ cd_color_copy_xyz (xyz, &new->xyz);
+ cd_color_copy_rgb (color, &new->color);
g_ptr_array_add (hull->priv->vertices, new);
}
@@ -120,7 +120,7 @@ gcm_hull_export_to_ply (GcmHull *hull)
guint i;
GcmHullFace *face;
GcmHullVertex *vertex;
- GcmColorRGBint tmp;
+ CdColorRGB8 tmp;
string = g_string_new ("ply\nformat ascii 1.0\n");
g_string_append_printf (string, "element vertex %i\n",
@@ -138,7 +138,7 @@ gcm_hull_export_to_ply (GcmHull *hull)
for (i=0; i<hull->priv->vertices->len; i++) {
vertex = g_ptr_array_index (hull->priv->vertices, i);
- gcm_color_convert_RGB_to_RGBint (&vertex->color, &tmp);
+ cd_color_convert_rgb_to_rgb8 (&vertex->color, &tmp);
g_string_append_printf (string, "%lf %lf %lf %i %i %i\n",
vertex->xyz.X,
vertex->xyz.Y,
diff --git a/src/gcm-hull.h b/src/gcm-hull.h
index 20d28da..82d6b40 100644
--- a/src/gcm-hull.h
+++ b/src/gcm-hull.h
@@ -23,8 +23,7 @@
#define __GCM_HULL_H
#include <glib-object.h>
-
-#include "gcm-color.h"
+#include <colord.h>
G_BEGIN_DECLS
@@ -53,8 +52,8 @@ struct _GcmHullClass
GType gcm_hull_get_type (void);
GcmHull *gcm_hull_new (void);
void gcm_hull_add_vertex (GcmHull *hull,
- GcmColorXYZ *xyz,
- GcmColorRGB *color);
+ CdColorXYZ *xyz,
+ CdColorRGB *color);
void gcm_hull_add_face (GcmHull *hull,
const guint *data,
gsize size);
diff --git a/src/gcm-import.c b/src/gcm-import.c
index d56d0c8..a64606e 100644
--- a/src/gcm-import.c
+++ b/src/gcm-import.c
@@ -29,7 +29,6 @@
#include "gcm-profile.h"
#include "gcm-utils.h"
-#include "gcm-color.h"
#include "gcm-cie-widget.h"
#include "gcm-debug.h"
diff --git a/src/gcm-list-store-profiles.c b/src/gcm-list-store-profiles.c
index a8b2f3b..04d9787 100644
--- a/src/gcm-list-store-profiles.c
+++ b/src/gcm-list-store-profiles.c
@@ -66,7 +66,7 @@ gcm_list_store_refresh_profiles (GtkListStore *list_store)
CdProfile *profile;
guint i;
GcmListStoreProfilesPrivate *priv = GCM_LIST_STORE_PROFILES(list_store)->priv;
- CdDeviceRelation relation = CD_DEVICE_RELATION_UNKNOWN;
+ CdDeviceRelation relation;
/* clear existing list */
gtk_list_store_clear (list_store);
@@ -76,12 +76,10 @@ gcm_list_store_refresh_profiles (GtkListStore *list_store)
for (i=0; i<profiles->len; i++) {
profile = g_ptr_array_index (profiles, i);
-#if CD_CHECK_VERSION(0,1,4)
/* find the profile relationship */
relation = cd_device_get_profile_relation (priv->device,
profile,
NULL, NULL);
-#endif
gtk_list_store_append (list_store, &iter);
gtk_list_store_set (list_store, &iter,
diff --git a/src/gcm-picker.c b/src/gcm-picker.c
index f8e8476..7ba6c4c 100644
--- a/src/gcm-picker.c
+++ b/src/gcm-picker.c
@@ -33,18 +33,15 @@
#include <colord.h>
#include "gcm-calibrate-argyll.h"
-#include "gcm-sensor-client.h"
#include "gcm-utils.h"
-#include "gcm-color.h"
#include "gcm-debug.h"
static CdClient *client = NULL;
static const gchar *profile_filename = NULL;
static gboolean done_measure = FALSE;
static GcmCalibrate *calibrate = NULL;
-static GcmColorXYZ last_sample;
-static GcmSensorClient *sensor_client = NULL;
-static GcmSensor *sensor = NULL;
+static CdColorXYZ last_sample;
+static CdSensor *sensor = NULL;
static gdouble last_ambient = -1.0f;
static GtkBuilder *builder = NULL;
static GtkWidget *info_bar_hardware_label = NULL;
@@ -105,17 +102,17 @@ gcm_picker_refresh_results (void)
gchar *text_temperature = NULL;
gchar *text_whitepoint = NULL;
gchar *text_xyz = NULL;
- GcmColorLab color_lab;
- GcmColorRGBint color_rgb;
- GcmColorXYZ color_error;
- GcmColorXYZ color_xyz;
+ CdColorLab color_lab;
+ CdColorRGB8 color_rgb;
+ CdColorXYZ color_error;
+ CdColorXYZ color_xyz;
GdkPixbuf *pixbuf = NULL;
gdouble temperature = 0.0f;
GtkImage *image;
GtkLabel *label;
/* copy as we're modifying the value */
- gcm_color_copy_XYZ (&last_sample, &color_xyz);
+ cd_color_copy_xyz (&last_sample, &color_xyz);
/* create new pixbuf of the right size */
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, 200, 200);
@@ -258,26 +255,54 @@ gcm_picker_measure_cb (GtkWidget *widget, gpointer data)
widget = GTK_WIDGET (gtk_builder_get_object (builder, "image_preview"));
gtk_image_set_from_file (GTK_IMAGE (widget), DATADIR "/icons/hicolor/64x64/apps/gnome-color-manager.png");
- if (gcm_sensor_is_native (sensor)) {
+ if (cd_sensor_get_native (sensor)) {
- /* set mode */
- gcm_sensor_set_output_type (sensor, GCM_SENSOR_OUTPUT_TYPE_LCD);
+ /* lock */
+ ret = cd_sensor_lock_sync (sensor,
+ NULL,
+ &error);
+ if (!ret) {
+ g_warning ("failed to lock: %s", error->message);
+ g_error_free (error);
+ goto out;
+ }
+
+ /* get color */
+ ret = cd_sensor_get_sample_sync (sensor,
+ CD_SENSOR_CAP_LCD,
+ &last_sample,
+ NULL,
+ NULL,
+ &error);
+ if (!ret) {
+ g_warning ("failed to get ambient: %s", error->message);
+ g_error_free (error);
+ goto out;
+ }
/* get ambient */
- ret = gcm_sensor_get_ambient (sensor, NULL, &last_ambient, &error);
+ ret = cd_sensor_get_sample_sync (sensor,
+ CD_SENSOR_CAP_AMBIENT,
+ NULL,
+ &last_ambient,
+ NULL,
+ &error);
if (!ret) {
g_warning ("failed to get ambient: %s", error->message);
g_error_free (error);
goto out;
}
- /* sample color */
- ret = gcm_sensor_sample (sensor, NULL, &last_sample, &error);
+ /* unlock */
+ ret = cd_sensor_unlock_sync (sensor,
+ NULL,
+ &error);
if (!ret) {
- g_warning ("failed to measure: %s", error->message);
+ g_warning ("failed to lock: %s", error->message);
g_error_free (error);
goto out;
}
+
gcm_picker_refresh_results ();
gcm_picker_got_results ();
} else {
@@ -302,7 +327,7 @@ gcm_picker_xyz_notify_cb (GcmCalibrate *calibrate_,
GParamSpec *pspec,
gpointer user_data)
{
- GcmColorXYZ *xyz;
+ CdColorXYZ *xyz;
/* get new value */
g_object_get (calibrate, "xyz", &xyz, NULL);
@@ -315,7 +340,7 @@ gcm_picker_xyz_notify_cb (GcmCalibrate *calibrate_,
gcm_picker_refresh_results ();
gcm_picker_got_results ();
- gcm_color_free_XYZ (xyz);
+ cd_color_xyz_free (xyz);
}
/**
@@ -351,22 +376,30 @@ gcm_picker_delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data)
* gcm_picker_sensor_client_setup_ui:
**/
static void
-gcm_picker_sensor_client_setup_ui (GcmSensorClient *_sensor_client)
+gcm_picker_sensor_client_setup_ui (void)
{
gboolean ret = FALSE;
GtkWidget *widget;
+ GPtrArray *sensors;
+ GError *error = NULL;
/* no present */
- sensor = gcm_sensor_client_get_sensor (sensor_client);
- if (sensor == NULL) {
+ sensors = cd_client_get_sensors_sync (client, NULL, &error);
+ if (sensors == NULL) {
+ g_warning ("%s", error->message);
+ g_error_free (error);
+ goto out;
+ }
+ if (sensors->len == 0) {
/* TRANSLATORS: this is displayed the user has not got suitable hardware */
gtk_label_set_label (GTK_LABEL (info_bar_hardware_label),
_("No colorimeter is attached."));
goto out;
}
+ sensor = g_object_ref (g_ptr_array_index (sensors, 0));
#ifndef HAVE_VTE
- if (!gcm_sensor_is_native (sensor)) {
+ if (!cd_sensor_get_native (sensor)) {
/* TRANSLATORS: this is displayed if VTE support is not enabled */
gtk_label_set_label (GTK_LABEL (info_bar_hardware_label),
_("This application was compiled without VTE support."));
@@ -376,7 +409,7 @@ gcm_picker_sensor_client_setup_ui (GcmSensorClient *_sensor_client)
#if 0
/* no support */
- ret = gcm_sensor_supports_spot (sensor);
+ ret = cd_sensor_supports_spot (sensor);
if (!ret) {
/* TRANSLATORS: this is displayed the user has not got suitable hardware */
gtk_label_set_label (GTK_LABEL (info_bar_hardware_label), _("The attached colorimeter is not capable of reading a spot color."));
@@ -387,6 +420,8 @@ gcm_picker_sensor_client_setup_ui (GcmSensorClient *_sensor_client)
#endif
out:
+ if (sensors != NULL)
+ g_ptr_array_unref (sensors);
widget = GTK_WIDGET (gtk_builder_get_object (builder, "button_measure"));
gtk_widget_set_sensitive (widget, ret);
widget = GTK_WIDGET (gtk_builder_get_object (builder, "expander_results"));
@@ -398,9 +433,11 @@ out:
* gcm_picker_sensor_client_changed_cb:
**/
static void
-gcm_picker_sensor_client_changed_cb (GcmSensorClient *_sensor_client, gpointer user_data)
+gcm_picker_sensor_client_changed_cb (CdClient *_client,
+ CdSensor *_sensor,
+ gpointer user_data)
{
- gcm_picker_sensor_client_setup_ui (sensor_client);
+ gcm_picker_sensor_client_setup_ui ();
}
/**
@@ -643,12 +680,7 @@ gcm_picker_startup_cb (GApplication *application, gpointer user_data)
GCM_DATA G_DIR_SEPARATOR_S "icons");
/* create a last sample */
- //gcm_color_xyz_clear (&last_sample);
-
- /* use the color device */
- sensor_client = gcm_sensor_client_new ();
- g_signal_connect (sensor_client, "changed",
- G_CALLBACK (gcm_picker_sensor_client_changed_cb), NULL);
+ //cd_color_xyz_clear (&last_sample);
/* set the parent window if it is specified */
if (xid != 0) {
@@ -673,9 +705,6 @@ gcm_picker_startup_cb (GApplication *application, gpointer user_data)
widget = GTK_WIDGET (gtk_builder_get_object (builder, "vbox1"));
gtk_box_pack_start (GTK_BOX(widget), info_bar_hardware, FALSE, FALSE, 0);
- /* disable some ui if no hardware */
- gcm_picker_sensor_client_setup_ui (sensor_client);
-
/* maintain a list of profiles */
client = cd_client_new ();
ret = cd_client_connect_sync (client,
@@ -687,6 +716,13 @@ gcm_picker_startup_cb (GApplication *application, gpointer user_data)
g_error_free (error);
goto out;
}
+ g_signal_connect (client, "sensor-added",
+ G_CALLBACK (gcm_picker_sensor_client_changed_cb), NULL);
+ g_signal_connect (client, "sensor-removed",
+ G_CALLBACK (gcm_picker_sensor_client_changed_cb), NULL);
+
+ /* disable some ui if no hardware */
+ gcm_picker_sensor_client_setup_ui ();
/* default to AdobeRGB */
profile_filename = "/usr/share/color/icc/Argyll/ClayRGB1998.icm";
@@ -761,8 +797,6 @@ main (int argc, char *argv[])
g_object_unref (application);
if (client != NULL)
g_object_unref (client);
- if (sensor_client != NULL)
- g_object_unref (sensor_client);
if (calibrate != NULL)
g_object_unref (calibrate);
if (builder != NULL)
diff --git a/src/gcm-prefs.c b/src/gcm-prefs.c
index 2b4a90b..6d05852 100644
--- a/src/gcm-prefs.c
+++ b/src/gcm-prefs.c
@@ -33,19 +33,17 @@
#include "gcm-cell-renderer-profile-text.h"
#include "gcm-cell-renderer-profile-icon.h"
#include "gcm-calibrate-argyll.h"
-#include "gcm-sensor-client.h"
#include "gcm-debug.h"
#include "gcm-exif.h"
#include "gcm-utils.h"
-#include "gcm-color.h"
#include "gcm-list-store-profiles.h"
typedef struct {
CdClient *client;
CdDevice *current_device;
+ CdSensor *sensor;
gboolean setting_up_device;
GCancellable *cancellable;
- GcmSensorClient *sensor_client;
GSettings *settings;
GtkApplication *application;
GtkBuilder *builder;
@@ -614,6 +612,7 @@ gcm_prefs_calibrate_cb (GtkWidget *widget, GcmPrefsPriv *prefs)
/* set defaults from device */
ret = gcm_calibrate_set_from_device (calibrate,
prefs->current_device,
+ prefs->sensor,
&error);
if (!ret) {
g_warning ("failed to calibrate: %s", error->message);
@@ -1342,12 +1341,15 @@ gcm_prefs_set_calibrate_button_sensitivity (GcmPrefsPriv *prefs)
if (kind == CD_DEVICE_KIND_DISPLAY) {
/* find whether we have hardware installed */
- ret = gcm_sensor_client_get_present (prefs->sensor_client);
- if (!ret) {
+ if (prefs->sensor == NULL) {
/* TRANSLATORS: this is when the button is insensitive */
tooltip = _("Cannot create profile: The measuring instrument is not plugged in");
goto out;
}
+
+ /* success */
+ ret = TRUE;
+
} else if (kind == CD_DEVICE_KIND_SCANNER ||
kind == CD_DEVICE_KIND_CAMERA) {
@@ -1357,21 +1359,23 @@ gcm_prefs_set_calibrate_button_sensitivity (GcmPrefsPriv *prefs)
} else if (kind == CD_DEVICE_KIND_PRINTER) {
/* find whether we have hardware installed */
- ret = gcm_sensor_client_get_present (prefs->sensor_client);
- if (!ret) {
+ if (prefs->sensor == NULL) {
/* TRANSLATORS: this is when the button is insensitive */
tooltip = _("Cannot create profile: The measuring instrument is not plugged in");
goto out;
}
/* find whether we have hardware installed */
- ret = gcm_sensor_supports_printer (gcm_sensor_client_get_sensor (prefs->sensor_client));
+ ret = cd_sensor_has_cap (prefs->sensor, CD_SENSOR_CAP_PRINTER);
if (!ret) {
/* TRANSLATORS: this is when the button is insensitive */
tooltip = _("Cannot create profile: The measuring instrument does not support printer profiling");
goto out;
}
+ /* success */
+ ret = TRUE;
+
} else {
/* TRANSLATORS: this is when the button is insensitive */
@@ -1728,36 +1732,49 @@ out:
g_object_unref (profile);
}
+
+
/**
- * gcm_prefs_sensor_client_changed_cb:
+ * gcm_prefs_sensor_coldplug:
**/
static void
-gcm_prefs_sensor_client_changed_cb (GcmSensorClient *sensor_client,
- GcmPrefsPriv *prefs)
+gcm_prefs_sensor_coldplug (GcmPrefsPriv *prefs)
{
- gboolean present;
- const gchar *event_id;
- const gchar *message;
+ GPtrArray *sensors;
+ GError *error = NULL;
- present = gcm_sensor_client_get_present (sensor_client);
+ /* unref old */
+ if (prefs->sensor != NULL) {
+ g_object_unref (prefs->sensor);
+ prefs->sensor = NULL;
+ }
- if (present) {
- /* TRANSLATORS: this is a sound description */
- message = _("Device added");
- event_id = "device-added";
- } else {
- /* TRANSLATORS: this is a sound description */
- message = _("Device removed");
- event_id = "device-removed";
+ /* no present */
+ sensors = cd_client_get_sensors_sync (prefs->client, NULL, &error);
+ if (sensors == NULL) {
+ g_warning ("%s", error->message);
+ g_error_free (error);
+ goto out;
}
+ if (sensors->len == 0)
+ goto out;
- /* play sound from the naming spec */
- ca_context_play (ca_gtk_context_get (), 0,
- CA_PROP_EVENT_ID, event_id,
- /* TRANSLATORS: this is the application name for libcanberra */
- CA_PROP_APPLICATION_NAME, _("GNOME Color Manager"),
- CA_PROP_EVENT_DESCRIPTION, message, NULL);
+ /* save a copy of the sensor */
+ prefs->sensor = g_object_ref (g_ptr_array_index (sensors, 0));
+out:
+ if (sensors != NULL)
+ g_ptr_array_unref (sensors);
+}
+/**
+ * gcm_prefs_client_sensor_changed_cb:
+ **/
+static void
+gcm_prefs_client_sensor_changed_cb (CdClient *client,
+ CdSensor *sensor,
+ GcmPrefsPriv *prefs)
+{
+ gcm_prefs_sensor_coldplug (prefs);
gcm_prefs_set_calibrate_button_sensitivity (prefs);
}
@@ -1778,7 +1795,6 @@ gcm_prefs_device_kind_to_icon_name (CdDeviceKind kind)
return "image-missing";
}
-
/**
* gcm_prefs_add_device:
**/
@@ -2234,6 +2250,7 @@ gcm_prefs_startup_idle_cb (GcmPrefsPriv *prefs)
G_CALLBACK (gcm_prefs_renderer_combo_changed_cb), prefs);
/* set calibrate button sensitivity */
+ gcm_prefs_sensor_coldplug (prefs);
gcm_prefs_set_calibrate_button_sensitivity (prefs);
/* we're probably showing now */
@@ -2721,10 +2738,12 @@ gcm_viewer_startup_cb (GApplication *application, GcmPrefsPriv *prefs)
gcm_prefs_get_devices_cb,
prefs);
- /* use the color device */
- prefs->sensor_client = gcm_sensor_client_new ();
- g_signal_connect (prefs->sensor_client, "changed",
- G_CALLBACK (gcm_prefs_sensor_client_changed_cb),
+ /* use the color sensor */
+ g_signal_connect (prefs->client, "sensor-added",
+ G_CALLBACK (gcm_prefs_client_sensor_changed_cb),
+ prefs);
+ g_signal_connect (prefs->client, "sensor-removed",
+ G_CALLBACK (gcm_prefs_client_sensor_changed_cb),
prefs);
/* use infobar */
@@ -2832,8 +2851,8 @@ main (int argc, char **argv)
g_object_unref (prefs->cancellable);
if (prefs->current_device != NULL)
g_object_unref (prefs->current_device);
- if (prefs->sensor_client != NULL)
- g_object_unref (prefs->sensor_client);
+ if (prefs->sensor != NULL)
+ g_object_unref (prefs->sensor);
if (prefs->settings != NULL)
g_object_unref (prefs->settings);
if (prefs->builder != NULL)
diff --git a/src/gcm-profile.c b/src/gcm-profile.c
index e3813af..664e156 100644
--- a/src/gcm-profile.c
+++ b/src/gcm-profile.c
@@ -37,7 +37,6 @@
#include <math.h>
#include "gcm-profile.h"
-#include "gcm-color.h"
#include "gcm-hull.h"
static void gcm_profile_finalize (GObject *object);
@@ -65,11 +64,11 @@ struct _GcmProfilePrivate
gchar *checksum;
guint temperature;
GHashTable *dict;
- GcmColorXYZ *white;
- GcmColorXYZ *black;
- GcmColorXYZ *red;
- GcmColorXYZ *green;
- GcmColorXYZ *blue;
+ CdColorXYZ *white;
+ CdColorXYZ *black;
+ CdColorXYZ *red;
+ CdColorXYZ *green;
+ CdColorXYZ *blue;
GFile *file;
GFileMonitor *monitor;
gboolean has_mlut;
@@ -195,9 +194,9 @@ gcm_profile_get_temperature (GcmProfile *profile)
*
* Gets the monitor red chromaticity value.
*
- * Return value: the #GcmColorXYZ value
+ * Return value: the #CdColorXYZ value
**/
-const GcmColorXYZ *
+const CdColorXYZ *
gcm_profile_get_red (GcmProfile *profile)
{
g_return_val_if_fail (GCM_IS_PROFILE (profile), NULL);
@@ -210,9 +209,9 @@ gcm_profile_get_red (GcmProfile *profile)
*
* Gets the monitor green chromaticity value.
*
- * Return value: the #GcmColorXYZ value
+ * Return value: the #CdColorXYZ value
**/
-const GcmColorXYZ *
+const CdColorXYZ *
gcm_profile_get_green (GcmProfile *profile)
{
g_return_val_if_fail (GCM_IS_PROFILE (profile), NULL);
@@ -225,9 +224,9 @@ gcm_profile_get_green (GcmProfile *profile)
*
* Gets the monitor red chromaticity value.
*
- * Return value: the #GcmColorXYZ value
+ * Return value: the #CdColorXYZ value
**/
-const GcmColorXYZ *
+const CdColorXYZ *
gcm_profile_get_blue (GcmProfile *profile)
{
g_return_val_if_fail (GCM_IS_PROFILE (profile), NULL);
@@ -240,9 +239,9 @@ gcm_profile_get_blue (GcmProfile *profile)
*
* Gets the monitor white chromaticity value.
*
- * Return value: the #GcmColorXYZ value
+ * Return value: the #CdColorXYZ value
**/
-const GcmColorXYZ *
+const CdColorXYZ *
gcm_profile_get_white (GcmProfile *profile)
{
g_return_val_if_fail (GCM_IS_PROFILE (profile), NULL);
@@ -639,7 +638,7 @@ gcm_profile_parse_data (GcmProfile *profile, const guint8 *data, gsize length, G
if (cie_xyz != NULL) {
cmsCIExyY xyY;
gdouble temp_float;
- gcm_color_set_XYZ (priv->white,
+ cd_color_set_xyz (priv->white,
cie_xyz->X, cie_xyz->Y, cie_xyz->Z);
/* convert to lcms xyY values */
@@ -658,18 +657,18 @@ gcm_profile_parse_data (GcmProfile *profile, const guint8 *data, gsize length, G
}
} else {
/* this is no big suprise, some profiles don't have these */
- gcm_color_clear_XYZ (priv->white);
+ cd_color_clear_xyz (priv->white);
g_debug ("failed to get white point");
}
/* get black point */
cie_xyz = cmsReadTag (priv->lcms_profile, cmsSigMediaBlackPointTag);
if (cie_xyz != NULL) {
- gcm_color_set_XYZ (priv->black,
+ cd_color_set_xyz (priv->black,
cie_xyz->X, cie_xyz->Y, cie_xyz->Z);
} else {
/* this is no big suprise, most profiles don't have these */
- gcm_color_clear_XYZ (priv->black);
+ cd_color_clear_xyz (priv->black);
}
/* get the profile kind */
@@ -744,11 +743,11 @@ gcm_profile_parse_data (GcmProfile *profile, const guint8 *data, gsize length, G
cie_xyz = cmsReadTag (priv->lcms_profile, cmsSigRedMatrixColumnTag);
if (cie_xyz != NULL) {
/* assume that if red is present, the green and blue are too */
- gcm_color_copy_XYZ ((GcmColorXYZ *) cie_xyz, (GcmColorXYZ *) &cie_illum.Red);
+ cd_color_copy_xyz ((CdColorXYZ *) cie_xyz, (CdColorXYZ *) &cie_illum.Red);
cie_xyz = cmsReadTag (priv->lcms_profile, cmsSigGreenMatrixColumnTag);
- gcm_color_copy_XYZ ((GcmColorXYZ *) cie_xyz, (GcmColorXYZ *) &cie_illum.Green);
+ cd_color_copy_xyz ((CdColorXYZ *) cie_xyz, (CdColorXYZ *) &cie_illum.Green);
cie_xyz = cmsReadTag (priv->lcms_profile, cmsSigBlueMatrixColumnTag);
- gcm_color_copy_XYZ ((GcmColorXYZ *) cie_xyz, (GcmColorXYZ *) &cie_illum.Blue);
+ cd_color_copy_xyz ((CdColorXYZ *) cie_xyz, (CdColorXYZ *) &cie_illum.Blue);
got_illuminants = TRUE;
} else {
g_debug ("failed to get illuminants");
@@ -795,17 +794,17 @@ gcm_profile_parse_data (GcmProfile *profile, const guint8 *data, gsize length, G
/* we've got valid values */
if (got_illuminants) {
- gcm_color_set_XYZ (priv->red,
+ cd_color_set_xyz (priv->red,
cie_illum.Red.X, cie_illum.Red.Y, cie_illum.Red.Z);
- gcm_color_set_XYZ (priv->green,
+ cd_color_set_xyz (priv->green,
cie_illum.Green.X, cie_illum.Green.Y, cie_illum.Green.Z);
- gcm_color_set_XYZ (priv->blue,
+ cd_color_set_xyz (priv->blue,
cie_illum.Blue.X, cie_illum.Blue.Y, cie_illum.Blue.Z);
} else {
g_debug ("failed to get luminance values");
- gcm_color_clear_XYZ (priv->red);
- gcm_color_clear_XYZ (priv->green);
- gcm_color_clear_XYZ (priv->blue);
+ cd_color_clear_xyz (priv->red);
+ cd_color_clear_xyz (priv->green);
+ cd_color_clear_xyz (priv->blue);
}
/* get the profile created time and date */
@@ -927,7 +926,7 @@ _cmsWriteTagTextAscii (cmsHPROFILE lcms_profile, cmsTagSignature sig, const gcha
* Return value: %TRUE for success
**/
gboolean
-gcm_profile_set_whitepoint (GcmProfile *profile, const GcmColorXYZ *whitepoint, GError **error)
+gcm_profile_set_whitepoint (GcmProfile *profile, const CdColorXYZ *whitepoint, GError **error)
{
gboolean ret;
GcmProfilePrivate *priv = profile->priv;
@@ -937,7 +936,7 @@ gcm_profile_set_whitepoint (GcmProfile *profile, const GcmColorXYZ *whitepoint,
priv->lcms_profile = cmsCreateProfilePlaceholder (NULL);
/* copy */
- gcm_color_copy_XYZ (whitepoint, priv->white);
+ cd_color_copy_xyz (whitepoint, priv->white);
/* write tag */
ret = cmsWriteTag (priv->lcms_profile, cmsSigMediaWhitePointTag, priv->white);
@@ -963,9 +962,9 @@ out:
**/
gboolean
gcm_profile_set_primaries (GcmProfile *profile,
- const GcmColorXYZ *red,
- const GcmColorXYZ *green,
- const GcmColorXYZ *blue,
+ const CdColorXYZ *red,
+ const CdColorXYZ *green,
+ const CdColorXYZ *blue,
GError **error)
{
gboolean ret;
@@ -976,9 +975,9 @@ gcm_profile_set_primaries (GcmProfile *profile,
priv->lcms_profile = cmsCreateProfilePlaceholder (NULL);
/* copy */
- gcm_color_copy_XYZ (red, priv->red);
- gcm_color_copy_XYZ (green, priv->green);
- gcm_color_copy_XYZ (blue, priv->blue);
+ cd_color_copy_xyz (red, priv->red);
+ cd_color_copy_xyz (green, priv->green);
+ cd_color_copy_xyz (blue, priv->blue);
/* write tags */
ret = cmsWriteTag (priv->lcms_profile, cmsSigRedMatrixColumnTag, priv->red);
@@ -1142,10 +1141,10 @@ gcm_profile_set_data (GcmProfile *profile, const gchar *key, const gchar *data)
gboolean
gcm_profile_create_from_chroma (GcmProfile *profile,
gdouble localgamma,
- const GcmColorYxy *red,
- const GcmColorYxy *green,
- const GcmColorYxy *blue,
- const GcmColorYxy *white,
+ const CdColorYxy *red,
+ const CdColorYxy *green,
+ const CdColorYxy *blue,
+ const CdColorYxy *white,
GError **error)
{
gboolean ret = FALSE;
@@ -1560,8 +1559,8 @@ out:
static GcmHull *
gcm_profile_create_hull_for_data (guint res, gdouble *lab, gdouble *rgb)
{
- GcmColorRGB color;
- GcmColorXYZ xyz;
+ CdColorRGB color;
+ CdColorXYZ xyz;
GcmHull *hull = NULL;
gint channels_n = 3;
gint off;
@@ -1976,19 +1975,19 @@ gcm_profile_get_property (GObject *object, guint prop_id, GValue *value, GParamS
g_value_set_boolean (value, priv->can_delete);
break;
case PROP_WHITE:
- g_value_set_boxed (value, g_boxed_copy (GCM_TYPE_COLOR_XYZ, priv->white));
+ g_value_set_boxed (value, g_boxed_copy (CD_TYPE_COLOR_XYZ, priv->white));
break;
case PROP_BLACK:
- g_value_set_boxed (value, g_boxed_copy (GCM_TYPE_COLOR_XYZ, priv->black));
+ g_value_set_boxed (value, g_boxed_copy (CD_TYPE_COLOR_XYZ, priv->black));
break;
case PROP_RED:
- g_value_set_boxed (value, g_boxed_copy (GCM_TYPE_COLOR_XYZ, priv->red));
+ g_value_set_boxed (value, g_boxed_copy (CD_TYPE_COLOR_XYZ, priv->red));
break;
case PROP_GREEN:
- g_value_set_boxed (value, g_boxed_copy (GCM_TYPE_COLOR_XYZ, priv->green));
+ g_value_set_boxed (value, g_boxed_copy (CD_TYPE_COLOR_XYZ, priv->green));
break;
case PROP_BLUE:
- g_value_set_boxed (value, g_boxed_copy (GCM_TYPE_COLOR_XYZ, priv->blue));
+ g_value_set_boxed (value, g_boxed_copy (CD_TYPE_COLOR_XYZ, priv->blue));
break;
case PROP_TEMPERATURE:
g_value_set_uint (value, priv->temperature);
@@ -2037,19 +2036,19 @@ gcm_profile_set_property (GObject *object, guint prop_id, const GValue *value, G
gcm_profile_set_size (profile, g_value_get_uint (value));
break;
case PROP_WHITE:
- gcm_color_copy_XYZ (g_value_get_boxed (value), priv->white);
+ cd_color_copy_xyz (g_value_get_boxed (value), priv->white);
break;
case PROP_BLACK:
- gcm_color_copy_XYZ (g_value_get_boxed (value), priv->black);
+ cd_color_copy_xyz (g_value_get_boxed (value), priv->black);
break;
case PROP_RED:
- gcm_color_copy_XYZ (g_value_get_boxed (value), priv->red);
+ cd_color_copy_xyz (g_value_get_boxed (value), priv->red);
break;
case PROP_GREEN:
- gcm_color_copy_XYZ (g_value_get_boxed (value), priv->green);
+ cd_color_copy_xyz (g_value_get_boxed (value), priv->green);
break;
case PROP_BLUE:
- gcm_color_copy_XYZ (g_value_get_boxed (value), priv->blue);
+ cd_color_copy_xyz (g_value_get_boxed (value), priv->blue);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -2161,7 +2160,7 @@ gcm_profile_class_init (GcmProfileClass *klass)
* GcmProfile:white:
*/
pspec = g_param_spec_boxed ("white", NULL, NULL,
- GCM_TYPE_COLOR_XYZ,
+ CD_TYPE_COLOR_XYZ,
G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_WHITE, pspec);
@@ -2169,7 +2168,7 @@ gcm_profile_class_init (GcmProfileClass *klass)
* GcmProfile:black:
*/
pspec = g_param_spec_boxed ("black", NULL, NULL,
- GCM_TYPE_COLOR_XYZ,
+ CD_TYPE_COLOR_XYZ,
G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_BLACK, pspec);
@@ -2177,7 +2176,7 @@ gcm_profile_class_init (GcmProfileClass *klass)
* GcmProfile:red:
*/
pspec = g_param_spec_boxed ("red", NULL, NULL,
- GCM_TYPE_COLOR_XYZ,
+ CD_TYPE_COLOR_XYZ,
G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_RED, pspec);
@@ -2185,7 +2184,7 @@ gcm_profile_class_init (GcmProfileClass *klass)
* GcmProfile:green:
*/
pspec = g_param_spec_boxed ("green", NULL, NULL,
- GCM_TYPE_COLOR_XYZ,
+ CD_TYPE_COLOR_XYZ,
G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_GREEN, pspec);
@@ -2193,7 +2192,7 @@ gcm_profile_class_init (GcmProfileClass *klass)
* GcmProfile:blue:
*/
pspec = g_param_spec_boxed ("blue", NULL, NULL,
- GCM_TYPE_COLOR_XYZ,
+ CD_TYPE_COLOR_XYZ,
G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_BLUE, pspec);
@@ -2220,11 +2219,11 @@ gcm_profile_init (GcmProfile *profile)
profile->priv->dict = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
profile->priv->kind = CD_PROFILE_KIND_UNKNOWN;
profile->priv->colorspace = CD_COLORSPACE_UNKNOWN;
- profile->priv->white = gcm_color_new_XYZ ();
- profile->priv->black = gcm_color_new_XYZ ();
- profile->priv->red = gcm_color_new_XYZ ();
- profile->priv->green = gcm_color_new_XYZ ();
- profile->priv->blue = gcm_color_new_XYZ ();
+ profile->priv->white = cd_color_xyz_new ();
+ profile->priv->black = cd_color_xyz_new ();
+ profile->priv->red = cd_color_xyz_new ();
+ profile->priv->green = cd_color_xyz_new ();
+ profile->priv->blue = cd_color_xyz_new ();
/* setup LCMS */
cmsSetLogErrorHandler (gcm_profile_error_cb);
@@ -2246,11 +2245,11 @@ gcm_profile_finalize (GObject *object)
g_free (priv->model);
g_free (priv->datetime);
g_free (priv->checksum);
- gcm_color_free_XYZ (priv->white);
- gcm_color_free_XYZ (priv->black);
- gcm_color_free_XYZ (priv->red);
- gcm_color_free_XYZ (priv->green);
- gcm_color_free_XYZ (priv->blue);
+ cd_color_xyz_free (priv->white);
+ cd_color_xyz_free (priv->black);
+ cd_color_xyz_free (priv->red);
+ cd_color_xyz_free (priv->green);
+ cd_color_xyz_free (priv->blue);
g_hash_table_destroy (profile->priv->dict);
if (priv->file != NULL)
g_object_unref (priv->file);
diff --git a/src/gcm-profile.h b/src/gcm-profile.h
index d01073e..da2bf90 100644
--- a/src/gcm-profile.h
+++ b/src/gcm-profile.h
@@ -27,7 +27,6 @@
#include <colord.h>
#include "gcm-clut.h"
-#include "gcm-color.h"
#include "gcm-hull.h"
G_BEGIN_DECLS
@@ -89,19 +88,19 @@ gboolean gcm_profile_set_vcgt_from_data (GcmProfile *profile,
guint size,
GError **error);
gboolean gcm_profile_set_whitepoint (GcmProfile *profile,
- const GcmColorXYZ *whitepoint,
+ const CdColorXYZ *whitepoint,
GError **error);
gboolean gcm_profile_set_primaries (GcmProfile *profile,
- const GcmColorXYZ *red,
- const GcmColorXYZ *green,
- const GcmColorXYZ *blue,
+ const CdColorXYZ *red,
+ const CdColorXYZ *green,
+ const CdColorXYZ *blue,
GError **error);
gboolean gcm_profile_create_from_chroma (GcmProfile *profile,
gdouble gamma,
- const GcmColorYxy *red,
- const GcmColorYxy *green,
- const GcmColorYxy *blue,
- const GcmColorYxy *white,
+ const CdColorYxy *red,
+ const CdColorYxy *green,
+ const CdColorYxy *blue,
+ const CdColorYxy *white,
GError **error);
gboolean gcm_profile_guess_and_add_vcgt (GcmProfile *profile,
GError **error);
@@ -132,10 +131,10 @@ CdColorspace gcm_profile_get_colorspace (GcmProfile *profile);
void gcm_profile_set_colorspace (GcmProfile *profile,
CdColorspace colorspace);
guint gcm_profile_get_temperature (GcmProfile *profile);
-const GcmColorXYZ *gcm_profile_get_red (GcmProfile *profile);
-const GcmColorXYZ *gcm_profile_get_green (GcmProfile *profile);
-const GcmColorXYZ *gcm_profile_get_blue (GcmProfile *profile);
-const GcmColorXYZ *gcm_profile_get_white (GcmProfile *profile);
+const CdColorXYZ *gcm_profile_get_red (GcmProfile *profile);
+const CdColorXYZ *gcm_profile_get_green (GcmProfile *profile);
+const CdColorXYZ *gcm_profile_get_blue (GcmProfile *profile);
+const CdColorXYZ *gcm_profile_get_white (GcmProfile *profile);
const gchar *gcm_profile_get_data (GcmProfile *profile,
const gchar *key);
void gcm_profile_set_data (GcmProfile *profile,
diff --git a/src/gcm-sample-window.c b/src/gcm-sample-window.c
index d928120..8197a0f 100644
--- a/src/gcm-sample-window.c
+++ b/src/gcm-sample-window.c
@@ -104,7 +104,7 @@ gcm_sample_window_set_percentage (GcmSampleWindow *sample_window, guint percenta
* Sets the window to a specific color.
**/
void
-gcm_sample_window_set_color (GcmSampleWindow *sample_window, const GcmColorRGB *color)
+gcm_sample_window_set_color (GcmSampleWindow *sample_window, const CdColorRGB *color)
{
GdkPixbuf *pixbuf;
gint width;
diff --git a/src/gcm-sample-window.h b/src/gcm-sample-window.h
index 021e470..e50e6e2 100644
--- a/src/gcm-sample-window.h
+++ b/src/gcm-sample-window.h
@@ -24,7 +24,7 @@
#include <glib-object.h>
#include <gtk/gtk.h>
-#include <gcm-color.h>
+#include <colord.h>
G_BEGIN_DECLS
@@ -52,7 +52,7 @@ struct _GcmSampleWindowClass
GType gcm_sample_window_get_type (void);
GtkWindow *gcm_sample_window_new (void);
void gcm_sample_window_set_color (GcmSampleWindow *sample_window,
- const GcmColorRGB *color);
+ const CdColorRGB *color);
void gcm_sample_window_set_percentage (GcmSampleWindow *sample_window,
guint percentage);
diff --git a/src/gcm-self-test.c b/src/gcm-self-test.c
index b153eea..0a7ebd5 100644
--- a/src/gcm-self-test.c
+++ b/src/gcm-self-test.c
@@ -26,14 +26,12 @@
#include <glib/gstdio.h>
#include "gcm-brightness.h"
-#include "gcm-buffer.h"
#include "gcm-calibrate-dialog.h"
#include "gcm-calibrate.h"
#include "gcm-calibrate-manual.h"
#include "gcm-calibrate-native.h"
#include "gcm-cie-widget.h"
#include "gcm-clut.h"
-#include "gcm-color.h"
#include "gcm-debug.h"
#include "gcm-dmi.h"
#include "gcm-edid.h"
@@ -41,156 +39,18 @@
#include "gcm-gamma-widget.h"
#include "gcm-hull.h"
#include "gcm-image.h"
-#include "gcm-math.h"
#include "gcm-print.h"
#include "gcm-profile.h"
#include "gcm-profile-store.h"
#include "gcm-sample-window.h"
-#include "gcm-sensor-dummy.h"
#include "gcm-tables.h"
#include "gcm-trc-widget.h"
-#include "gcm-usb.h"
#include "gcm-utils.h"
#include "gcm-x11-output.h"
#include "gcm-x11-screen.h"
#define TEST_MAIN_OUTPUT "LVDS1"
-static void
-gcm_test_math_func (void)
-{
- GcmColorRGBint rgb_int;
- GcmColorRGB rgb;
- GcmColorYxy Yxy;
- GcmColorXYZ XYZ;
- GcmMat3x3 mat;
- GcmMat3x3 matsrc;
-
- /* black */
- rgb_int.R = 0x00; rgb_int.G = 0x00; rgb_int.B = 0x00;
- gcm_color_convert_RGBint_to_RGB (&rgb_int, &rgb);
- g_assert_cmpfloat (rgb.R, <, 0.01);
- g_assert_cmpfloat (rgb.G, <, 0.01);
- g_assert_cmpfloat (rgb.B, <, 0.01);
- g_assert_cmpfloat (rgb.R, >, -0.01);
- g_assert_cmpfloat (rgb.G, >, -0.01);
- g_assert_cmpfloat (rgb.B, >, -0.01);
-
- /* white */
- rgb_int.R = 0xff; rgb_int.G = 0xff; rgb_int.B = 0xff;
- gcm_color_convert_RGBint_to_RGB (&rgb_int, &rgb);
- g_assert_cmpfloat (rgb.R, <, 1.01);
- g_assert_cmpfloat (rgb.G, <, 1.01);
- g_assert_cmpfloat (rgb.B, <, 1.01);
- g_assert_cmpfloat (rgb.R, >, 0.99);
- g_assert_cmpfloat (rgb.G, >, 0.99);
- g_assert_cmpfloat (rgb.B, >, 0.99);
-
- /* and back */
- gcm_color_convert_RGB_to_RGBint (&rgb, &rgb_int);
- g_assert_cmpint (rgb_int.R, ==, 0xff);
- g_assert_cmpint (rgb_int.G, ==, 0xff);
- g_assert_cmpint (rgb_int.B, ==, 0xff);
-
- /* black */
- rgb.R = 0.0f; rgb.G = 0.0f; rgb.B = 0.0f;
- gcm_color_convert_RGB_to_RGBint (&rgb, &rgb_int);
- g_assert_cmpint (rgb_int.R, ==, 0x00);
- g_assert_cmpint (rgb_int.G, ==, 0x00);
- g_assert_cmpint (rgb_int.B, ==, 0x00);
-
- /* Yxy -> XYZ */
- Yxy.Y = 21.5;
- Yxy.x = 0.31;
- Yxy.y = 0.32;
- gcm_color_convert_Yxy_to_XYZ (&Yxy, &XYZ);
- g_assert_cmpfloat (XYZ.X, <, 21.0);
- g_assert_cmpfloat (XYZ.X, >, 20.5);
- g_assert_cmpfloat (XYZ.Y, <, 22.0);
- g_assert_cmpfloat (XYZ.Y, >, 21.0);
- g_assert_cmpfloat (XYZ.Z, <, 25.0);
- g_assert_cmpfloat (XYZ.Z, >, 24.5);
-
- /* and back */
- gcm_color_convert_XYZ_to_Yxy (&XYZ, &Yxy);
- g_assert_cmpfloat (Yxy.Y, <, 22.0);
- g_assert_cmpfloat (Yxy.Y, >, 21.0);
- g_assert_cmpfloat (Yxy.x, <, 0.35);
- g_assert_cmpfloat (Yxy.x, >, 0.25);
- g_assert_cmpfloat (Yxy.y, <, 0.35);
- g_assert_cmpfloat (Yxy.y, >, 0.25);
-
- /* matrix */
- mat.m00 = 1.00f;
- gcm_mat33_clear (&mat);
- g_assert_cmpfloat (mat.m00, <, 0.001f);
- g_assert_cmpfloat (mat.m00, >, -0.001f);
- g_assert_cmpfloat (mat.m22, <, 0.001f);
- g_assert_cmpfloat (mat.m22, >, -0.001f);
-
- /* multiply two matrices */
- gcm_mat33_clear (&matsrc);
- matsrc.m01 = matsrc.m10 = 2.0f;
- gcm_mat33_matrix_multiply (&matsrc, &matsrc, &mat);
- g_assert_cmpfloat (mat.m00, <, 4.1f);
- g_assert_cmpfloat (mat.m00, >, 3.9f);
- g_assert_cmpfloat (mat.m11, <, 4.1f);
- g_assert_cmpfloat (mat.m11, >, 3.9f);
- g_assert_cmpfloat (mat.m22, <, 0.001f);
- g_assert_cmpfloat (mat.m22, >, -0.001f);
-}
-
-static void
-gcm_test_sensor_button_pressed_cb (GcmSensor *sensor, gint *signal_count)
-{
- (*signal_count)++;
-}
-
-static void
-gcm_test_sensor_func (void)
-{
- gboolean ret;
- GError *error = NULL;
- GcmSensor *sensor;
- gdouble value;
- GcmColorXYZ values;
- gboolean signal_count = 0;
-
- /* start sensor */
- sensor = gcm_sensor_dummy_new ();
- g_signal_connect (sensor, "button-pressed", G_CALLBACK (gcm_test_sensor_button_pressed_cb), &signal_count);
-
- /* set LEDs */
- ret = gcm_sensor_set_leds (sensor, 0x0f, &error);
- g_assert_no_error (error);
- g_assert (ret);
-
- /* set mode */
- gcm_sensor_set_output_type (sensor, GCM_SENSOR_OUTPUT_TYPE_LCD);
- g_assert_cmpint (gcm_sensor_get_output_type (sensor), ==, GCM_SENSOR_OUTPUT_TYPE_LCD);
-
- /* get ambient */
- ret = gcm_sensor_get_ambient (sensor, NULL, &value, &error);
- g_assert_cmpint (signal_count, ==, 0);
- g_assert_no_error (error);
- g_assert (ret);
- g_debug ("ambient = %.1lf Lux", value);
-
- /* sample color */
- ret = gcm_sensor_sample (sensor, NULL, &values, &error);
- g_assert_cmpint (signal_count, ==, 1);
- g_assert_no_error (error);
- g_assert (ret);
- g_debug ("X=%0.4lf, Y=%0.4lf, Z=%0.4lf", values.X, values.Y, values.Z);
-
- /* set LEDs */
- ret = gcm_sensor_set_leds (sensor, 0x00, &error);
- g_assert_no_error (error);
- g_assert (ret);
-
- g_object_unref (sensor);
-}
-
typedef struct {
const gchar *monitor_name;
const gchar *vendor_name;
@@ -305,8 +165,8 @@ static void
gcm_test_hull_func (void)
{
GcmHull *hull;
- GcmColorXYZ xyz;
- GcmColorRGB color;
+ CdColorXYZ xyz;
+ CdColorRGB color;
guint faces[3];
gchar *data;
@@ -368,12 +228,12 @@ gcm_test_profile_func (void)
GcmClut *clut;
gboolean ret;
GError *error = NULL;
- GcmColorXYZ *xyz;
- GcmColorYxy yxy;
- GcmColorYxy red;
- GcmColorYxy green;
- GcmColorYxy blue;
- GcmColorYxy white;
+ CdColorXYZ *xyz;
+ CdColorYxy yxy;
+ CdColorYxy red;
+ CdColorYxy green;
+ CdColorYxy blue;
+ CdColorYxy white;
GcmHull *hull;
gchar *data;
@@ -405,10 +265,10 @@ gcm_test_profile_func (void)
"red", &xyz,
NULL);
g_assert (xyz != NULL);
- gcm_color_convert_XYZ_to_Yxy (xyz, &yxy);
+ cd_color_convert_xyz_to_yxy (xyz, &yxy);
g_assert_cmpfloat (fabs (yxy.x - 0.648454), <, 0.01);
- gcm_color_free_XYZ (xyz);
+ cd_color_xyz_free (xyz);
g_object_unref (clut);
g_object_unref (profile);
@@ -436,10 +296,10 @@ gcm_test_profile_func (void)
profile = gcm_profile_new ();
/* from my T61 */
- gcm_color_set_Yxy (&red, 1.0f, 0.569336f, 0.332031f);
- gcm_color_set_Yxy (&green, 1.0f, 0.311523f, 0.543945f);
- gcm_color_set_Yxy (&blue, 1.0f, 0.149414f, 0.131836f);
- gcm_color_set_Yxy (&white, 1.0f, 0.313477f, 0.329102f);
+ cd_color_set_yxy (&red, 1.0f, 0.569336f, 0.332031f);
+ cd_color_set_yxy (&green, 1.0f, 0.311523f, 0.543945f);
+ cd_color_set_yxy (&blue, 1.0f, 0.149414f, 0.131836f);
+ cd_color_set_yxy (&white, 1.0f, 0.313477f, 0.329102f);
/* create from chroma */
ret = gcm_profile_create_from_chroma (profile, 2.2f, &red, &green, &blue, &white, &error);
@@ -602,29 +462,6 @@ gcm_test_dmi_func (void)
}
static void
-gcm_test_xyz_func (void)
-{
- GcmColorXYZ *xyz;
- GcmColorYxy yxy;
-
- xyz = gcm_color_new_XYZ ();
- g_assert (xyz != NULL);
-
- /* nothing set */
- gcm_color_convert_XYZ_to_Yxy (xyz, &yxy);
- g_assert_cmpfloat (fabs (yxy.x - 0.0f), <, 0.001f);
-
- /* set dummy values */
- gcm_color_set_XYZ (xyz, 0.125, 0.25, 0.5);
- gcm_color_convert_XYZ_to_Yxy (xyz, &yxy);
-
- g_assert_cmpfloat (fabs (yxy.x - 0.142857143f), <, 0.001f);
- g_assert_cmpfloat (fabs (yxy.y - 0.285714286f), <, 0.001f);
-
- gcm_color_free_XYZ (xyz);
-}
-
-static void
gcm_test_profile_store_func (void)
{
GcmProfileStore *store;
@@ -741,51 +578,6 @@ gcm_test_image_func (void)
}
static void
-gcm_test_usb_func (void)
-{
- GcmUsb *usb;
- gboolean ret;
- GError *error = NULL;
-
- usb = gcm_usb_new ();
- g_assert (usb != NULL);
- g_assert (!gcm_usb_get_connected (usb));
- g_assert (gcm_usb_get_device_handle (usb) == NULL);
-
- /* try to load */
- ret = gcm_usb_load (usb, &error);
- g_assert_no_error (error);
- g_assert (ret);
-
- /* attach to the default mainloop */
- gcm_usb_attach_to_context (usb, NULL);
-
- /* connect to a non-existant device */
- ret = gcm_usb_connect (usb, 0xffff, 0xffff, 0x1, 0x1, &error);
- g_assert (!ret);
- g_assert_error (error, GCM_USB_ERROR, GCM_USB_ERROR_INTERNAL);
- g_error_free (error);
-
- g_object_unref (usb);
-}
-
-static void
-gcm_test_buffer_func (void)
-{
- guchar buffer[4];
-
- gcm_buffer_write_uint16_be (buffer, 255);
- g_assert_cmpint (buffer[0], ==, 0x00);
- g_assert_cmpint (buffer[1], ==, 0xff);
- g_assert_cmpint (gcm_buffer_read_uint16_be (buffer), ==, 255);
-
- gcm_buffer_write_uint16_le (buffer, 8192);
- g_assert_cmpint (buffer[0], ==, 0x00);
- g_assert_cmpint (buffer[1], ==, 0x20);
- g_assert_cmpint (gcm_buffer_read_uint16_le (buffer), ==, 8192);
-}
-
-static void
gcm_test_x11_func (void)
{
GcmX11Screen *screen;
@@ -870,7 +662,7 @@ gcm_test_sample_window_func (void)
{
GtkWindow *window;
GMainLoop *loop;
- GcmColorRGB source;
+ CdColorRGB source;
window = gcm_sample_window_new ();
g_assert (window != NULL);
@@ -1000,16 +792,16 @@ gcm_test_cie_widget_func (void)
GtkWidget *dialog;
GtkWidget *vbox;
GcmProfile *profile;
- GcmColorXYZ *white;
- GcmColorXYZ *red;
- GcmColorXYZ *green;
- GcmColorXYZ *blue;
+ CdColorXYZ *white;
+ CdColorXYZ *red;
+ CdColorXYZ *green;
+ CdColorXYZ *blue;
gint response;
GFile *file = NULL;
- GcmColorYxy white_Yxy;
- GcmColorYxy red_Yxy;
- GcmColorYxy green_Yxy;
- GcmColorYxy blue_Yxy;
+ CdColorYxy white_Yxy;
+ CdColorYxy red_Yxy;
+ CdColorYxy green_Yxy;
+ CdColorYxy blue_Yxy;
widget = gcm_cie_widget_new ();
g_assert (widget != NULL);
@@ -1025,10 +817,10 @@ gcm_test_cie_widget_func (void)
NULL);
g_object_unref (file);
- gcm_color_convert_XYZ_to_Yxy (white, &white_Yxy);
- gcm_color_convert_XYZ_to_Yxy (red, &red_Yxy);
- gcm_color_convert_XYZ_to_Yxy (green, &green_Yxy);
- gcm_color_convert_XYZ_to_Yxy (blue, &blue_Yxy);
+ cd_color_convert_xyz_to_yxy (white, &white_Yxy);
+ cd_color_convert_xyz_to_yxy (red, &red_Yxy);
+ cd_color_convert_xyz_to_yxy (green, &green_Yxy);
+ cd_color_convert_xyz_to_yxy (blue, &blue_Yxy);
g_object_set (widget,
"red", &red_Yxy,
@@ -1055,10 +847,10 @@ gcm_test_cie_widget_func (void)
gtk_widget_destroy (dialog);
g_object_unref (profile);
- gcm_color_free_XYZ (white);
- gcm_color_free_XYZ (red);
- gcm_color_free_XYZ (green);
- gcm_color_free_XYZ (blue);
+ cd_color_xyz_free (white);
+ cd_color_xyz_free (red);
+ cd_color_xyz_free (green);
+ cd_color_xyz_free (blue);
}
static void
@@ -1293,20 +1085,15 @@ main (int argc, char **argv)
g_test_add_func ("/color/exif", gcm_test_exif_func);
g_test_add_func ("/color/utils", gcm_test_utils_func);
g_test_add_func ("/color/calibrate_dialog", gcm_test_calibrate_dialog_func);
- g_test_add_func ("/color/math", gcm_test_math_func);
g_test_add_func ("/color/hull", gcm_test_hull_func);
- g_test_add_func ("/color/sensor", gcm_test_sensor_func);
g_test_add_func ("/color/edid", gcm_test_edid_func);
g_test_add_func ("/color/tables", gcm_test_tables_func);
g_test_add_func ("/color/profile", gcm_test_profile_func);
g_test_add_func ("/color/clut", gcm_test_clut_func);
- g_test_add_func ("/color/xyz", gcm_test_xyz_func);
g_test_add_func ("/color/dmi", gcm_test_dmi_func);
g_test_add_func ("/color/x11", gcm_test_x11_func);
g_test_add_func ("/color/profile_store", gcm_test_profile_store_func);
- g_test_add_func ("/color/buffer", gcm_test_buffer_func);
g_test_add_func ("/color/sample-window", gcm_test_sample_window_func);
- g_test_add_func ("/color/usb", gcm_test_usb_func);
if (g_test_thorough ()) {
g_test_add_func ("/color/brightness", gcm_test_brightness_func);
g_test_add_func ("/color/image", gcm_test_image_func);
diff --git a/src/gcm-session.c b/src/gcm-session.c
index 676f0d4..c0cfd52 100644
--- a/src/gcm-session.c
+++ b/src/gcm-session.c
@@ -27,6 +27,7 @@
#include <locale.h>
#include <colord.h>
#include <libnotify/notify.h>
+#include <canberra-gtk.h>
#include "gcm-debug.h"
#include "gcm-dmi.h"
@@ -92,7 +93,7 @@ gcm_session_notify_cb (NotifyNotification *notification,
GCM_SETTINGS_RECALIBRATE_PRINTER_THRESHOLD,
0);
} else if (g_strcmp0 (action, "recalibrate") == 0) {
- ret = g_spawn_command_line_async ("gnome-control-center color",
+ ret = g_spawn_command_line_async (BINDIR "/gcm-prefs",
&error);
if (!ret) {
g_warning ("failed to spawn: %s", error->message);
@@ -1345,11 +1346,9 @@ gcm_session_add_x11_output (GcmSessionPrivate *priv, GcmX11Output *output)
g_hash_table_insert (device_props,
g_strdup ("Serial"),
g_strdup (serial));
-#if CD_CHECK_VERSION(0,1,5)
g_hash_table_insert (device_props,
g_strdup ("XRANDR_name"),
g_strdup (gcm_x11_output_get_name (output)));
-#endif
device = cd_client_create_device_sync (priv->client,
device_id,
CD_OBJECT_SCOPE_TEMP,
@@ -1491,6 +1490,49 @@ gcm_session_colord_vanished_cb (GDBusConnection *_connection,
}
/**
+ * gcm_session_sensor_added_cb:
+ **/
+static void
+gcm_session_sensor_added_cb (CdClient *client,
+ CdSensor *sensor,
+ GcmSessionPrivate *priv)
+{
+ gboolean ret;
+ GError *error = NULL;
+
+ ca_context_play (ca_gtk_context_get (), 0,
+ CA_PROP_EVENT_ID, "device-added",
+ /* TRANSLATORS: this is the application name for libcanberra */
+ CA_PROP_APPLICATION_NAME, _("GNOME Color Manager"),
+ /* TRANSLATORS: this is a sound description */
+ CA_PROP_EVENT_DESCRIPTION, _("Sensor added"), NULL);
+
+ /* open up the color prefs window */
+ ret = g_spawn_command_line_async (BINDIR "/gcm-prefs",
+ &error);
+ if (!ret) {
+ g_warning ("failed to spawn: %s", error->message);
+ g_error_free (error);
+ }
+}
+
+/**
+ * gcm_session_sensor_removed_cb:
+ **/
+static void
+gcm_session_sensor_removed_cb (CdClient *client,
+ CdSensor *sensor,
+ GcmSessionPrivate *priv)
+{
+ ca_context_play (ca_gtk_context_get (), 0,
+ CA_PROP_EVENT_ID, "device-removed",
+ /* TRANSLATORS: this is the application name for libcanberra */
+ CA_PROP_APPLICATION_NAME, _("GNOME Color Manager"),
+ /* TRANSLATORS: this is a sound description */
+ CA_PROP_EVENT_DESCRIPTION, _("Sensor removed"), NULL);
+}
+
+/**
* main:
**/
int
@@ -1562,6 +1604,12 @@ main (int argc, char *argv[])
g_signal_connect (priv->client, "device-changed",
G_CALLBACK (gcm_session_device_changed_assign_cb),
priv);
+ g_signal_connect (priv->client, "sensor-added",
+ G_CALLBACK (gcm_session_sensor_added_cb),
+ priv);
+ g_signal_connect (priv->client, "sensor-removed",
+ G_CALLBACK (gcm_session_sensor_removed_cb),
+ priv);
ret = cd_client_connect_sync (priv->client, NULL, &error);
if (!ret) {
g_warning ("failed to connect to colord: %s", error->message);
diff --git a/src/gcm-viewer.c b/src/gcm-viewer.c
index f337302..0ba5af0 100644
--- a/src/gcm-viewer.c
+++ b/src/gcm-viewer.c
@@ -39,7 +39,6 @@
#include "gcm-profile.h"
#include "gcm-trc-widget.h"
#include "gcm-utils.h"
-#include "gcm-color.h"
#include "gcm-debug.h"
#ifdef HAVE_CLUTTER
diff --git a/src/gsd-color-manager.c b/src/gsd-color-manager.c
index 9ef66ca..0a8ef24 100644
--- a/src/gsd-color-manager.c
+++ b/src/gsd-color-manager.c
@@ -33,7 +33,7 @@
struct GsdColorManagerPrivate
{
guint timeout;
- GcmSensorClient *sensor_client;
+ CdClient *sensor_client;
EggConsoleKit *console_kit;
};
@@ -63,13 +63,13 @@ gsd_color_manager_stop (GsdColorManager *manager)
* gsd_color_manager_sensor_client_changed_cb:
**/
static void
-gsd_color_manager_sensor_client_changed_cb (GcmSensorClient *sensor_client, GsdColorManager *manager)
+gsd_color_manager_sensor_client_changed_cb (CdClient *sensor_client, GsdColorManager *manager)
{
gboolean ret;
GError *error = NULL;
/* is sensor connected */
- ret = gcm_sensor_client_get_present (sensor_client);
+ ret = cd_sensor_client_get_present (sensor_client);
if (!ret)
return;
@@ -86,7 +86,7 @@ gsd_color_manager_sensor_client_changed_cb (GcmSensorClient *sensor_client, GsdC
* gsd_color_manager_active_changed_cb:
**/
static void
-gsd_color_manager_active_changed_cb (GcmSensorClient *sensor_client, gboolean is_active, GsdColorManager *manager)
+gsd_color_manager_active_changed_cb (CdClient *sensor_client, gboolean is_active, GsdColorManager *manager)
{
gboolean ret;
GError *error = NULL;
@@ -130,7 +130,7 @@ static void
gsd_color_manager_init (GsdColorManager *manager)
{
manager->priv = GSD_COLOR_MANAGER_GET_PRIVATE (manager);
- manager->priv->sensor_client = gcm_sensor_client_new ();
+ manager->priv->sensor_client = cd_client_new ();
g_signal_connect (manager->priv->sensor_client, "changed",
G_CALLBACK (gsd_color_manager_sensor_client_changed_cb), manager);
manager->priv->console_kit = egg_console_kit_new ();
diff --git a/tools/Makefile.am b/tools/Makefile.am
index f1a99c3..8ed7949 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -23,9 +23,7 @@ INCLUDES = \
noinst_PROGRAMS = \
gcm-dump-profile \
- gcm-dump-sensor \
- gcm-fix-profile \
- gcm-sensor-example
+ gcm-fix-profile
gcm_dump_profile_SOURCES = \
gcm-dump-profile.c
@@ -40,20 +38,6 @@ gcm_dump_profile_LDADD = \
gcm_dump_profile_CFLAGS = \
$(WARNINGFLAGS_C)
-gcm_dump_sensor_SOURCES = \
- gcm-dump-sensor.c
-
-gcm_dump_sensor_LDADD = \
- $(GLIB_LIBS) \
- $(LCMS_LIBS) \
- $(USB_LIBS) \
- $(GUDEV_LIBS) \
- $(top_builddir)/src/libgcmshared.a \
- -lm
-
-gcm_dump_sensor_CFLAGS = \
- $(WARNINGFLAGS_C)
-
gcm_fix_profile_SOURCES = \
gcm-fix-profile.c
@@ -66,19 +50,6 @@ gcm_fix_profile_LDADD = \
gcm_fix_profile_CFLAGS = \
$(WARNINGFLAGS_C)
-gcm_sensor_example_SOURCES = \
- gcm-sensor-example.c
-
-gcm_sensor_example_LDADD = \
- $(GLIB_LIBS) \
- $(USB_LIBS) \
- $(GUDEV_LIBS) \
- $(top_builddir)/src/libgcmshared.a \
- $(LCMS_LIBS)
-
-gcm_sensor_example_CFLAGS = \
- $(WARNINGFLAGS_C)
-
clean-local:
rm -f *~
diff --git a/tools/gcm-dump-profile.c b/tools/gcm-dump-profile.c
index 873e245..3395144 100644
--- a/tools/gcm-dump-profile.c
+++ b/tools/gcm-dump-profile.c
@@ -46,7 +46,7 @@ gcm_dump_profile_filename (const gchar *filename)
const gchar *manufacturer;
const gchar *model;
const gchar *datetime;
- const GcmColorXYZ *color;
+ const CdColorXYZ *color;
GFile *file = NULL;
guint temperature;
diff --git a/tools/gcm-sensor-example.c b/tools/gcm-sensor-example.c
index 8829d85..d50778b 100644
--- a/tools/gcm-sensor-example.c
+++ b/tools/gcm-sensor-example.c
@@ -51,7 +51,7 @@ main (int argc, char **argv)
GError *error = NULL;
GcmSensor *sensor;
gdouble value;
- GcmColorXYZ values;
+ CdColorXYZ values;
GMainLoop *loop;
context = g_option_context_new ("gnome-color-manager sensor example");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]