[gnome-color-manager] trivial: do not show 'null' in the UI if the colorimeter device was not present for the chartread ru



commit 25b51e27614ea0068ca726235ff0af43854b670d
Author: Richard Hughes <richard hughsie com>
Date:   Wed Feb 24 18:14:52 2010 +0000

    trivial: do not show 'null' in the UI if the colorimeter device was not present for the chartread run

 src/gcm-calibrate-argyll.c |    5 ++---
 src/gcm-calibrate.c        |   14 ++++++++++++++
 src/gcm-calibrate.h        |    1 +
 3 files changed, 17 insertions(+), 3 deletions(-)
---
diff --git a/src/gcm-calibrate-argyll.c b/src/gcm-calibrate-argyll.c
index 47c7dde..c9d41ca 100644
--- a/src/gcm-calibrate-argyll.c
+++ b/src/gcm-calibrate-argyll.c
@@ -1101,7 +1101,7 @@ gcm_calibrate_argyll_device_generate_profile (GcmCalibrateArgyll *calibrate_argy
 	gchar *basename = NULL;
 	const gchar *manufacturer;
 	const gchar *model;
-	gchar *device = NULL;
+	const gchar *device;
 	gchar *working_path = NULL;
 	const gchar *title;
 	const gchar *message;
@@ -1112,13 +1112,13 @@ gcm_calibrate_argyll_device_generate_profile (GcmCalibrateArgyll *calibrate_argy
 		      "basename", &basename,
 		      "working-path", &working_path,
 		      "reference-kind", &reference_kind,
-		      "device", &device,
 		      NULL);
 
 	/* get, returning fallbacks if nothing was set */
 	model = gcm_calibrate_get_model_fallback (GCM_CALIBRATE (calibrate_argyll));
 	manufacturer = gcm_calibrate_get_manufacturer_fallback (GCM_CALIBRATE (calibrate_argyll));
 	description = gcm_calibrate_get_description_fallback (GCM_CALIBRATE (calibrate_argyll));
+	device = gcm_calibrate_get_device_fallback (GCM_CALIBRATE (calibrate_argyll));
 
 	/* get correct name of the command */
 	command = gcm_calibrate_argyll_get_tool_filename ("colprof", error);
@@ -1205,7 +1205,6 @@ out:
 	g_free (copyright);
 	g_free (basename);
 	g_free (command);
-	g_free (device);
 	g_strfreev (argv);
 	return ret;
 }
diff --git a/src/gcm-calibrate.c b/src/gcm-calibrate.c
index 400ac65..a7a5130 100644
--- a/src/gcm-calibrate.c
+++ b/src/gcm-calibrate.c
@@ -138,6 +138,20 @@ gcm_calibrate_get_manufacturer_fallback (GcmCalibrate *calibrate)
 }
 
 /**
+ * gcm_calibrate_get_device_fallback:
+ **/
+const gchar *
+gcm_calibrate_get_device_fallback (GcmCalibrate *calibrate)
+{
+	GcmCalibratePrivate *priv = calibrate->priv;
+	if (priv->device != NULL)
+		return priv->device;
+
+	/* TRANSLATORS: this is saved in the profile */
+	return _("Unknown device");
+}
+
+/**
  * gcm_calibrate_get_time:
  **/
 static gchar *
diff --git a/src/gcm-calibrate.h b/src/gcm-calibrate.h
index 3b60045..20761c6 100644
--- a/src/gcm-calibrate.h
+++ b/src/gcm-calibrate.h
@@ -125,6 +125,7 @@ gboolean	 gcm_calibrate_set_from_exif		(GcmCalibrate	*calibrate,
 const gchar	*gcm_calibrate_get_model_fallback	(GcmCalibrate	*calibrate);
 const gchar	*gcm_calibrate_get_description_fallback	(GcmCalibrate	*calibrate);
 const gchar	*gcm_calibrate_get_manufacturer_fallback (GcmCalibrate	*calibrate);
+const gchar	*gcm_calibrate_get_device_fallback	(GcmCalibrate	*calibrate);
 
 G_END_DECLS
 



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