[gnome-color-manager/gnome-3-2] Hide the target whitepoint selection screen if the sensor is a colorimeter
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-color-manager/gnome-3-2] Hide the target whitepoint selection screen if the sensor is a colorimeter
- Date: Thu, 10 May 2012 09:02:55 +0000 (UTC)
commit c0ecde6e6d7972a0d7d2a0ecad78a44cf9ec06d6
Author: Richard Hughes <richard hughsie com>
Date: Thu May 10 09:55:27 2012 +0100
Hide the target whitepoint selection screen if the sensor is a colorimeter
Only expensive photospectometer devices are able to get the accurate readings
required to do this without getting a color cast.
Too many users are reporting the screen 'goes pink' using colorimeter devices,
and so force them to have a native whitepoint used during calibration.
src/gcm-calibrate-main.c | 73 +++++++++++++++++++++++++++++++---------------
1 files changed, 49 insertions(+), 24 deletions(-)
---
diff --git a/src/gcm-calibrate-main.c b/src/gcm-calibrate-main.c
index 507c515..c653dc6 100644
--- a/src/gcm-calibrate-main.c
+++ b/src/gcm-calibrate-main.c
@@ -1855,6 +1855,48 @@ gcm_calib_setup_page_failure (GcmCalibratePriv *calib)
}
/**
+ * gcm_calib_got_sensor:
+ **/
+static void
+gcm_calib_got_sensor (GcmCalibratePriv *calib, CdSensor *sensor)
+{
+ gboolean is_photospectrometer = FALSE;
+ gboolean ret;
+ GError *error = NULL;
+ GtkWidget *vbox;
+
+ /* connect to sensor */
+ ret = cd_sensor_connect_sync (sensor, NULL, &error);
+ if (!ret) {
+ g_warning ("failed to connect to sensor: %s",
+ error->message);
+ g_error_free (error);
+ goto out;
+ }
+ calib->sensor = g_object_ref (sensor);
+ gcm_calibrate_set_sensor (calib->calibrate, sensor);
+
+ /* hide the prompt for the user to insert a sensor */
+ vbox = gcm_calib_get_vbox_for_page (calib,
+ GCM_CALIBRATE_PAGE_SENSOR);
+ gtk_widget_hide (vbox);
+
+ /* if the device is a simple colorimeter, hide the temperature
+ * chooser. Only expensive accurate spectrophotometers are
+ * accurate enough to do a good job without a color cast */
+ if (cd_sensor_get_kind (sensor) == CD_SENSOR_KIND_I1_PRO ||
+ cd_sensor_get_kind (sensor) == CD_SENSOR_KIND_COLOR_MUNKI ||
+ cd_sensor_get_kind (sensor) == CD_SENSOR_KIND_I1_DISPLAY3) {
+ is_photospectrometer = TRUE;
+ }
+ vbox = gcm_calib_get_vbox_for_page (calib,
+ GCM_CALIBRATE_PAGE_DISPLAY_TEMPERATURE);
+ gtk_widget_set_visible (vbox, is_photospectrometer);
+out:
+ return;
+}
+
+/**
* gcm_calib_get_sensors_cb:
**/
static void
@@ -1863,11 +1905,10 @@ gcm_calib_get_sensors_cb (GObject *object,
gpointer user_data)
{
CdClient *client = CD_CLIENT (object);
+ CdSensor *sensor_tmp;
GcmCalibratePriv *calib = (GcmCalibratePriv *) user_data;
GError *error = NULL;
GPtrArray *sensors;
- GtkWidget *vbox;
- gboolean ret;
/* get the result */
sensors = cd_client_get_sensors_finish (client, res, &error);
@@ -1878,22 +1919,10 @@ gcm_calib_get_sensors_cb (GObject *object,
goto out;
}
- /* hide the sensors screen */
- if (sensors->len > 0) {
- calib->sensor = g_object_ref (g_ptr_array_index (sensors, 0));
-
- ret = cd_sensor_connect_sync (calib->sensor, NULL, &error);
- if (!ret) {
- g_warning ("failed to connect to sensor: %s",
- error->message);
- g_error_free (error);
- goto out;
- }
-
- gcm_calibrate_set_sensor (calib->calibrate, calib->sensor);
- vbox = gcm_calib_get_vbox_for_page (calib,
- GCM_CALIBRATE_PAGE_SENSOR);
- gtk_widget_hide (vbox);
+ /* we've got a sensor */
+ if (sensors->len != 0) {
+ sensor_tmp = g_ptr_array_index (sensors, 0);
+ gcm_calib_got_sensor (calib, sensor_tmp);
}
out:
if (sensors != NULL)
@@ -1972,13 +2001,9 @@ gcm_calib_add_pages (GcmCalibratePriv *calib)
static void
gcm_calib_sensor_added_cb (CdClient *client, CdSensor *sensor, GcmCalibratePriv *calib)
{
- GtkWidget *vbox;
-
g_debug ("sensor inserted");
- calib->sensor = g_object_ref (sensor);
- vbox = gcm_calib_get_vbox_for_page (calib,
- GCM_CALIBRATE_PAGE_SENSOR);
- gtk_widget_hide (vbox);
+ gcm_calib_got_sensor (calib, sensor);
+ gtk_assistant_next_page (GTK_ASSISTANT (calib->main_window));
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]