[gnome-color-manager] Fix the scanner and camera calibration to work correctly



commit aa41145c6cf8f96a77583dd7d94f8fde632b6208
Author: Richard Hughes <richard hughsie com>
Date:   Sat Nov 14 13:46:30 2009 +0000

    Fix the scanner and camera calibration to work correctly

 contrib/gnome-color-manager.spec.in |    1 +
 src/gcm-calibrate.c                 |   28 ++++++++++++++++++++++------
 src/gcm-prefs.c                     |    4 ++--
 3 files changed, 25 insertions(+), 8 deletions(-)
---
diff --git a/contrib/gnome-color-manager.spec.in b/contrib/gnome-color-manager.spec.in
index c2f6431..af2d7db 100644
--- a/contrib/gnome-color-manager.spec.in
+++ b/contrib/gnome-color-manager.spec.in
@@ -45,6 +45,7 @@ BuildRequires: libgudev1-devel
 BuildRequires: dbus-glib-devel >= %{dbus_glib_version}
 BuildRequires: libXxf86vm-devel
 BuildRequires: libXrandr-devel
+BuildRequires: gnome-desktop-devel
 
 %description
 gnome-color-manager provides a way to control ICC colour profiles.
diff --git a/src/gcm-calibrate.c b/src/gcm-calibrate.c
index 7c916ef..28898fa 100644
--- a/src/gcm-calibrate.c
+++ b/src/gcm-calibrate.c
@@ -634,6 +634,10 @@ gcm_calibrate_display_generate_profile (GcmCalibrate *calibrate, GError **error)
 	vte_terminal_reset (VTE_TERMINAL(priv->terminal), TRUE, FALSE);
 	priv->child_pid = vte_terminal_fork_command (VTE_TERMINAL(priv->terminal), "colprof", argv, NULL, GCM_CALIBRATE_TEMP_DIR, FALSE, FALSE, FALSE);
 
+	/* no need for an okay button */
+	widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_ok"));
+	gtk_widget_hide (widget);
+
 	/* TRANSLATORS: title, a profile is a ICC file */
 	gcm_calibrate_set_title (calibrate, _("Generating the profile"));
 	/* TRANSLATORS: dialog message */
@@ -676,7 +680,7 @@ gcm_calibrate_scanner_copy (GcmCalibrate *calibrate, GError **error)
 {
 	gboolean ret;
 	gchar *scanner = NULL;
-	gchar *it8src = NULL;
+	gchar *it8cht = NULL;
 	gchar *it8ref = NULL;
 	GcmCalibratePrivate *priv = calibrate->priv;
 
@@ -685,16 +689,19 @@ gcm_calibrate_scanner_copy (GcmCalibrate *calibrate, GError **error)
 	/* TRANSLATORS: dialog message */
 	gcm_calibrate_set_message (calibrate, _("Copying source image, chart data and CIE reference values."));
 
+	/* setup generic basename */
+	calibrate->priv->basename = g_strdup ("scanner");
+
 	/* build filenames */
 	scanner = g_build_filename (GCM_CALIBRATE_TEMP_DIR, "scanner.tif", NULL);
-	it8src = g_build_filename (GCM_CALIBRATE_TEMP_DIR, "it8.cht", NULL);
+	it8cht = g_build_filename (GCM_CALIBRATE_TEMP_DIR, "it8.cht", NULL);
 	it8ref = g_build_filename (GCM_CALIBRATE_TEMP_DIR, "it8ref.txt", NULL);
 
 	/* copy all files to /tmp as argyllcms doesn't cope well with paths */
-	ret = gcm_utils_mkdir_and_copy ("/usr/share/color/argyll/ref/it8.cht", scanner, error);
+	ret = gcm_utils_mkdir_and_copy ("/usr/share/color/argyll/ref/it8.cht", it8cht, error);
 	if (!ret)
 		goto out;
-	ret = gcm_utils_mkdir_and_copy (priv->filename_source, it8src, error);
+	ret = gcm_utils_mkdir_and_copy (priv->filename_source, scanner, error);
 	if (!ret)
 		goto out;
 	ret = gcm_utils_mkdir_and_copy (priv->filename_reference, it8ref, error);
@@ -702,7 +709,7 @@ gcm_calibrate_scanner_copy (GcmCalibrate *calibrate, GError **error)
 		goto out;
 out:
 	g_free (scanner);
-	g_free (it8src);
+	g_free (it8cht);
 	g_free (it8ref);
 	return ret;
 }
@@ -905,7 +912,8 @@ gcm_calibrate_finish (GcmCalibrate *calibrate, GError **error)
 {
 	gchar *filename;
 	guint i;
-	const gchar *exts[] = {"cal", "ti1", "ti3", NULL};
+	const gchar *exts[] = {"cal", "ti1", "ti3", "tif", NULL};
+	const gchar *filenames[] = {"it8.cht", "it8ref.txt1", NULL};
 
 	/* remove all the temp files */
 	for (i=0; exts[i] != NULL; i++) {
@@ -915,6 +923,14 @@ gcm_calibrate_finish (GcmCalibrate *calibrate, GError **error)
 		g_free (filename);
 	}
 
+	/* remove all the temp files */
+	for (i=0; filenames[i] != NULL; i++) {
+		filename = g_strdup_printf ("%s/%s", GCM_CALIBRATE_TEMP_DIR, filenames[i]);
+		egg_debug ("removing %s", filename);
+		g_unlink (filename);
+		g_free (filename);
+	}
+
 	/* get the finished icc file */
 	filename = g_strdup_printf ("%s/%s.icc", GCM_CALIBRATE_TEMP_DIR, calibrate->priv->basename);
 
diff --git a/src/gcm-prefs.c b/src/gcm-prefs.c
index 724add5..8252740 100644
--- a/src/gcm-prefs.c
+++ b/src/gcm-prefs.c
@@ -225,7 +225,7 @@ gcm_prefs_calibrate_scanner_get_scanned_profile (void)
 	/* TRANSLATORS: filter name on the file->open dialog */
 	gtk_file_filter_set_name (filter, _("Supported images files"));
 	gtk_file_chooser_add_filter (GTK_FILE_CHOOSER(dialog), filter);
-	g_object_unref (filter);
+//	g_object_unref (filter);
 
 	/* did user choose file */
 	if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
@@ -268,7 +268,7 @@ gcm_prefs_calibrate_scanner_get_reference_data (void)
 	/* TRANSLATORS: filter name on the file->open dialog */
 	gtk_file_filter_set_name (filter, _("CIE values"));
 	gtk_file_chooser_add_filter (GTK_FILE_CHOOSER(dialog), filter);
-	g_object_unref (filter);
+//	g_object_unref (filter);
 
 	/* did user choose file */
 	if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)



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