[gnome-color-manager] trivial: add framework code to support calibration device model in the profile description



commit 34e29b56f96fd77c4f3c9c6e2530238a050c4b27
Author: Richard Hughes <richard hughsie com>
Date:   Wed Dec 23 10:23:29 2009 +0000

    trivial: add framework code to support calibration device model in the profile description

 src/gcm-calibrate-argyll.c |    7 +++++--
 src/gcm-calibrate.c        |   19 +++++++++++++++++++
 src/gcm-prefs.c            |   30 +++++++++++++++++++++++-------
 3 files changed, 47 insertions(+), 9 deletions(-)
---
diff --git a/src/gcm-calibrate-argyll.c b/src/gcm-calibrate-argyll.c
index 1c5a4de..5298bfd 100644
--- a/src/gcm-calibrate-argyll.c
+++ b/src/gcm-calibrate-argyll.c
@@ -803,6 +803,7 @@ gcm_calibrate_argyll_device_generate_profile (GcmCalibrateArgyll *calibrate_argy
 	gchar *basename = NULL;
 	gchar *manufacturer = NULL;
 	gchar *model = NULL;
+	gchar *device = NULL;
 
 	/* get shared data */
 	g_object_get (calibrate_argyll,
@@ -810,6 +811,7 @@ gcm_calibrate_argyll_device_generate_profile (GcmCalibrateArgyll *calibrate_argy
 		      "description", &description,
 		      "manufacturer", &manufacturer,
 		      "model", &model,
+		      "device", &device,
 		      NULL);
 
 	/* get correct name of the command */
@@ -823,8 +825,8 @@ gcm_calibrate_argyll_device_generate_profile (GcmCalibrateArgyll *calibrate_argy
 	date = g_date_new ();
 	g_date_set_time_t (date, time (NULL));
 
-        /* TRANSLATORS: this is the formattted custom profile description. "Custom" refers to the fact that it's user generated" */
-	description_tmp = g_strdup_printf ("%s, %s (%04i-%02i-%02i)", _("Custom"), description, date->year, date->month, date->day);
+        /* create a long description */
+	description_tmp = g_strdup_printf ("%s, %s (%04i-%02i-%02i)", device, description, date->year, date->month, date->day);
 
 	/* TRANSLATORS: this is the copyright string, where it might be "Copyright (c) 2009 Edward Scissorhands" */
 	copyright = g_strdup_printf ("%s %04i %s", _("Copyright (c)"), date->year, g_get_real_name ());
@@ -881,6 +883,7 @@ out:
 	g_free (model);
 	g_free (description);
 	g_free (command);
+	g_free (device);
 	g_strfreev (argv);
 	return ret;
 }
diff --git a/src/gcm-calibrate.c b/src/gcm-calibrate.c
index 1c4129f..ec2145b 100644
--- a/src/gcm-calibrate.c
+++ b/src/gcm-calibrate.c
@@ -58,6 +58,7 @@ struct _GcmCalibratePrivate
 	gchar				*manufacturer;
 	gchar				*model;
 	gchar				*description;
+	gchar				*device;
 };
 
 enum {
@@ -65,6 +66,7 @@ enum {
 	PROP_BASENAME,
 	PROP_MODEL,
 	PROP_DESCRIPTION,
+	PROP_DEVICE,
 	PROP_MANUFACTURER,
 	PROP_IS_LCD,
 	PROP_IS_CRT,
@@ -291,6 +293,9 @@ gcm_calibrate_get_property (GObject *object, guint prop_id, GValue *value, GPara
 	case PROP_DESCRIPTION:
 		g_value_set_string (value, priv->description);
 		break;
+	case PROP_DEVICE:
+		g_value_set_string (value, priv->device);
+		break;
 	case PROP_MANUFACTURER:
 		g_value_set_string (value, priv->manufacturer);
 		break;
@@ -365,6 +370,10 @@ gcm_calibrate_set_property (GObject *object, guint prop_id, const GValue *value,
 		g_free (priv->description);
 		priv->description = g_strdup (g_value_get_string (value));
 		break;
+	case PROP_DEVICE:
+		g_free (priv->device);
+		priv->device = g_strdup (g_value_get_string (value));
+		break;
 	case PROP_MANUFACTURER:
 		g_free (priv->manufacturer);
 		priv->manufacturer = g_strdup (g_value_get_string (value));
@@ -460,6 +469,14 @@ gcm_calibrate_class_init (GcmCalibrateClass *klass)
 	g_object_class_install_property (object_class, PROP_DESCRIPTION, pspec);
 
 	/**
+	 * GcmCalibrate:device:
+	 */
+	pspec = g_param_spec_string ("device", NULL, NULL,
+				     NULL,
+				     G_PARAM_READWRITE);
+	g_object_class_install_property (object_class, PROP_DEVICE, pspec);
+
+	/**
 	 * GcmCalibrate:manufacturer:
 	 */
 	pspec = g_param_spec_string ("manufacturer", NULL, NULL,
@@ -485,6 +502,7 @@ gcm_calibrate_init (GcmCalibrate *calibrate)
 	calibrate->priv->manufacturer = NULL;
 	calibrate->priv->model = NULL;
 	calibrate->priv->description = NULL;
+	calibrate->priv->device = NULL;
 }
 
 /**
@@ -504,6 +522,7 @@ gcm_calibrate_finalize (GObject *object)
 	g_free (priv->manufacturer);
 	g_free (priv->model);
 	g_free (priv->description);
+	g_free (priv->device);
 
 	G_OBJECT_CLASS (gcm_calibrate_parent_class)->finalize (object);
 }
diff --git a/src/gcm-prefs.c b/src/gcm-prefs.c
index dbb047a..57d41d6 100644
--- a/src/gcm-prefs.c
+++ b/src/gcm-prefs.c
@@ -188,6 +188,7 @@ gcm_prefs_calibrate_display (GcmCalibrate *calibrate)
 	gchar *manufacturer = NULL;
 	gchar *model = NULL;
 	gchar *description = NULL;
+	gchar *device = NULL;
 	GtkWindow *window;
 
 	/* get the device */
@@ -207,16 +208,30 @@ gcm_prefs_calibrate_display (GcmCalibrate *calibrate)
 	basename = gcm_prefs_calibrate_get_basename (current_device);
 
 	/* get model */
-	if (model == NULL)
-		model = g_strdup ("unknown model");
+	if (model == NULL) {
+		/* TRANSLATORS: this is saved in the profile */
+		model = g_strdup (_("Unknown model"));
+	}
 
 	/* get description */
-	if (description == NULL)
-		description = g_strdup ("calibrated monitor");
+	if (description == NULL) {
+		/* TRANSLATORS: this is saved in the profile */
+		description = g_strdup (_("Unknown display"));
+	}
 
 	/* get manufacturer */
-	if (manufacturer == NULL)
-		manufacturer = g_strdup ("unknown manufacturer");
+	if (manufacturer == NULL) {
+		/* TRANSLATORS: this is saved in the profile */
+		manufacturer = g_strdup (_("Unknown manufacturer"));
+	}
+
+	// TODO: get calibration device model
+
+	/* get device */
+	if (device == NULL) {
+		/* TRANSLATORS: this is the formattted custom profile description. "Custom" refers to the fact that it's user generated */
+		device = g_strdup (_("Custom"));
+	}
 
 	/* set the proper output name */
 	g_object_set (calibrate,
@@ -225,9 +240,9 @@ gcm_prefs_calibrate_display (GcmCalibrate *calibrate)
 		      "model", model,
 		      "description", description,
 		      "manufacturer", manufacturer,
+		      "device", device,
 		      NULL);
 
-
 	/* run each task in order */
 	window = GTK_WINDOW(gtk_builder_get_object (builder, "dialog_prefs"));
 	ret = gcm_calibrate_display (calibrate, window, &error);
@@ -245,6 +260,7 @@ out:
 		g_error_free (error);
 	}
 
+	g_free (device);
 	g_free (output_name);
 	g_free (basename);
 	g_free (manufacturer);



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