[gnome-color-manager] Help the user scan in a file and select a IT8.7/2 reference image



commit 01f14dda323110b6a70d2018a786bc04722bbaf6
Author: Richard Hughes <richard hughsie com>
Date:   Mon Nov 16 16:25:32 2009 +0000

    Help the user scan in a file and select a IT8.7/2 reference image

 src/gcm-calibrate.c |   53 +++++++++++++++++++++++++++++++++++++++++++++++++++
 src/gcm-calibrate.h |    1 +
 src/gcm-prefs.c     |    8 +++++++
 3 files changed, 62 insertions(+), 0 deletions(-)
---
diff --git a/src/gcm-calibrate.c b/src/gcm-calibrate.c
index d9788e4..e8308a9 100644
--- a/src/gcm-calibrate.c
+++ b/src/gcm-calibrate.c
@@ -639,6 +639,55 @@ out:
 }
 
 /**
+ * gcm_calibrate_scanner_setup:
+ **/
+static gboolean
+gcm_calibrate_scanner_setup (GcmCalibrate *calibrate, GError **error)
+{
+	gboolean ret = TRUE;
+	GString *string = NULL;
+	GcmCalibratePrivate *priv = calibrate->priv;
+
+	string = g_string_new ("");
+
+	/* TRANSLATORS: title, a profile is a ICC file */
+	gcm_calibrate_set_title (calibrate, _("Setting up scanner"));
+
+	/* TRANSLATORS: dialog message, preface */
+	g_string_append_printf (string, "%s\n", _("Before calibrating the scanner, you have to manually scan a reference image and save it as a TIFF image file."));
+
+	/* TRANSLATORS: dialog message, preface */
+	g_string_append_printf (string, "%s\n", _("Ensure that the contrast and brightness is not changed and color correction profiles are not applied."));
+
+	/* TRANSLATORS: dialog message, suffix */
+	g_string_append_printf (string, "%s\n", _("The scanner glass should have been cleaned prior to scanning and the output file resolution should be at least 200dpi."));
+
+	/* TRANSLATORS: dialog message, suffix */
+	g_string_append_printf (string, "\n%s\n", _("For best results, the reference image should also be less than two years old."));
+
+	/* TRANSLATORS: dialog question */
+	g_string_append_printf (string, "\n%s", _("Do you have a scanned TIFF file of a IT8.7/2 reference image?"));
+
+	/* set the message */
+	gcm_calibrate_set_message (calibrate, string->str);
+
+	/* wait until user selects okay or closes window */
+	g_main_loop_run (priv->loop);
+
+	/* get result */
+	if (priv->response != GTK_RESPONSE_OK) {
+		if (error != NULL)
+			*error = g_error_new (1, 0, "user did not follow calibration steps");
+		ret = FALSE;
+		goto out;
+	}
+out:
+	if (string != NULL)
+		g_string_free (string, TRUE);
+	return ret;
+}
+
+/**
  * gcm_calibrate_scanner_copy:
  **/
 static gboolean
@@ -850,6 +899,10 @@ gcm_calibrate_task (GcmCalibrate *calibrate, GcmCalibrateTask task, GError **err
 		ret = gcm_calibrate_display_generate_profile (calibrate, error);
 		goto out;
 	}
+	if (task == GCM_CALIBRATE_TASK_SCANNER_SETUP) {
+		ret = gcm_calibrate_scanner_setup (calibrate, error);
+		goto out;
+	}
 	if (task == GCM_CALIBRATE_TASK_SCANNER_COPY) {
 		ret = gcm_calibrate_scanner_copy (calibrate, error);
 		goto out;
diff --git a/src/gcm-calibrate.h b/src/gcm-calibrate.h
index 24129f7..d24157d 100644
--- a/src/gcm-calibrate.h
+++ b/src/gcm-calibrate.h
@@ -60,6 +60,7 @@ typedef enum {
 	GCM_CALIBRATE_TASK_DISPLAY_GENERATE_PATCHES,
 	GCM_CALIBRATE_TASK_DISPLAY_DRAW_AND_MEASURE,
 	GCM_CALIBRATE_TASK_DISPLAY_GENERATE_PROFILE,
+	GCM_CALIBRATE_TASK_SCANNER_SETUP,
 	GCM_CALIBRATE_TASK_SCANNER_COPY,
 	GCM_CALIBRATE_TASK_SCANNER_MEASURE,
 	GCM_CALIBRATE_TASK_SCANNER_GENERATE_PROFILE,
diff --git a/src/gcm-prefs.c b/src/gcm-prefs.c
index 9cbf746..f113bd2 100644
--- a/src/gcm-prefs.c
+++ b/src/gcm-prefs.c
@@ -342,6 +342,14 @@ gcm_prefs_calibrate_scanner (GcmCalibrate *calib)
 		goto out;
 	}
 
+	/* step 0 */
+	ret = gcm_calibrate_task (calib, GCM_CALIBRATE_TASK_SCANNER_SETUP, &error);
+	if (!ret) {
+		egg_warning ("failed to setup: %s", error->message);
+		g_error_free (error);
+		goto out;
+	}
+
 	/* get scanned image */
 	scanned_image = gcm_prefs_calibrate_scanner_get_scanned_profile ();
 	if (scanned_image == NULL)



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