[gnome-color-manager] Make it clear in the UI and code that the ICC manufacturer is not the profile vendor



commit d439db2def00f43f452b6285856724073723394e
Author: Richard Hughes <richard hughsie com>
Date:   Thu Dec 3 11:04:05 2009 +0000

    Make it clear in the UI and code that the ICC manufacturer is not the profile vendor

 data/gcm-prefs.ui |   69 ++++++++++++++++++++++++++++++++++++++++++++++-------
 src/gcm-prefs.c   |   63 +++++++++++++++++++++++++++++-------------------
 src/gcm-profile.c |   42 ++++++++++++++++----------------
 3 files changed, 119 insertions(+), 55 deletions(-)
---
diff --git a/data/gcm-prefs.ui b/data/gcm-prefs.ui
index bc4457b..03cc861 100644
--- a/data/gcm-prefs.ui
+++ b/data/gcm-prefs.ui
@@ -644,16 +644,16 @@
                                         <property name="visible">True</property>
                                         <property name="orientation">vertical</property>
                                         <child>
-                                          <object class="GtkHBox" id="hbox_vendor">
+                                          <object class="GtkHBox" id="hbox_profile_manufacturer">
                                             <property name="visible">True</property>
                                             <property name="spacing">9</property>
                                             <child>
                                               <object class="GtkHBox" id="hbox5">
                                                 <property name="visible">True</property>
                                                 <child>
-                                                  <object class="GtkLabel" id="label_title_vendor">
+                                                  <object class="GtkLabel" id="label_title_profile_manufacturer">
                                                     <property name="visible">True</property>
-                                                    <property name="label" translatable="yes" comments="The manufacturer of the profile">Vendor:</property>
+                                                    <property name="label" translatable="yes" comments="The manufacturer of the profile">Device manufacturer:</property>
                                                   </object>
                                                   <packing>
                                                     <property name="expand">False</property>
@@ -670,9 +670,9 @@
                                               <object class="GtkHBox" id="hbox11">
                                                 <property name="visible">True</property>
                                                 <child>
-                                                  <object class="GtkLabel" id="label_vendor">
+                                                  <object class="GtkLabel" id="label_profile_manufacturer">
                                                     <property name="visible">True</property>
-                                                    <property name="label">vendor</property>
+                                                    <property name="label">manufacturer</property>
                                                     <property name="use_markup">True</property>
                                                     <property name="wrap">True</property>
                                                   </object>
@@ -695,6 +695,57 @@
                                           </packing>
                                         </child>
                                         <child>
+                                          <object class="GtkHBox" id="hbox_profile_model">
+                                            <property name="visible">True</property>
+                                            <property name="spacing">9</property>
+                                            <child>
+                                              <object class="GtkHBox" id="hbox34">
+                                                <property name="visible">True</property>
+                                                <child>
+                                                  <object class="GtkLabel" id="label_title_profile_model">
+                                                    <property name="visible">True</property>
+                                                    <property name="label" translatable="yes" comments="The manufacturer of the profile">Device model:</property>
+                                                  </object>
+                                                  <packing>
+                                                    <property name="expand">False</property>
+                                                    <property name="position">0</property>
+                                                  </packing>
+                                                </child>
+                                              </object>
+                                              <packing>
+                                                <property name="expand">False</property>
+                                                <property name="position">0</property>
+                                              </packing>
+                                            </child>
+                                            <child>
+                                              <object class="GtkHBox" id="hbox35">
+                                                <property name="visible">True</property>
+                                                <child>
+                                                  <object class="GtkLabel" id="label_profile_model">
+                                                    <property name="visible">True</property>
+                                                    <property name="label">model</property>
+                                                    <property name="use_markup">True</property>
+                                                    <property name="wrap">True</property>
+                                                  </object>
+                                                  <packing>
+                                                    <property name="expand">False</property>
+                                                    <property name="position">0</property>
+                                                  </packing>
+                                                </child>
+                                              </object>
+                                              <packing>
+                                                <property name="position">1</property>
+                                              </packing>
+                                            </child>
+                                          </object>
+                                          <packing>
+                                            <property name="expand">False</property>
+                                            <property name="fill">False</property>
+                                            <property name="padding">3</property>
+                                            <property name="position">1</property>
+                                          </packing>
+                                        </child>
+                                        <child>
                                           <object class="GtkHBox" id="hbox_copyright">
                                             <property name="visible">True</property>
                                             <property name="spacing">9</property>
@@ -742,7 +793,7 @@
                                             <property name="expand">False</property>
                                             <property name="fill">False</property>
                                             <property name="padding">3</property>
-                                            <property name="position">1</property>
+                                            <property name="position">2</property>
                                           </packing>
                                         </child>
                                         <child>
@@ -793,7 +844,7 @@
                                             <property name="expand">False</property>
                                             <property name="fill">False</property>
                                             <property name="padding">3</property>
-                                            <property name="position">2</property>
+                                            <property name="position">3</property>
                                           </packing>
                                         </child>
                                         <child>
@@ -844,7 +895,7 @@
                                             <property name="expand">False</property>
                                             <property name="fill">False</property>
                                             <property name="padding">3</property>
-                                            <property name="position">3</property>
+                                            <property name="position">4</property>
                                           </packing>
                                         </child>
                                         <child>
@@ -895,7 +946,7 @@
                                             <property name="expand">False</property>
                                             <property name="fill">False</property>
                                             <property name="padding">3</property>
-                                            <property name="position">4</property>
+                                            <property name="position">5</property>
                                           </packing>
                                         </child>
                                       </object>
diff --git a/src/gcm-prefs.c b/src/gcm-prefs.c
index a63ab0e..bc0500d 100644
--- a/src/gcm-prefs.c
+++ b/src/gcm-prefs.c
@@ -146,15 +146,18 @@ gcm_prefs_calibrate_get_basename (GcmDevice *device)
 	timespec = gcm_prefs_get_time ();
 
 	/* form basename */
-	basename = g_string_new ("gcm");
+	basename = g_string_new ("GCM");
 	if (manufacturer != NULL)
-		g_string_append_printf (basename, "_%s", manufacturer);
+		g_string_append_printf (basename, " - %s", manufacturer);
 	if (model != NULL)
-		g_string_append_printf (basename, "_%s", model);
+		g_string_append_printf (basename, " - %s", model);
 	if (serial != NULL)
-		g_string_append_printf (basename, "_%s", serial);
-	g_string_append_printf (basename, "_%04i-%02i-%02i", date->year, date->month, date->day);
-	g_string_append_printf (basename, "_%s", timespec);
+		g_string_append_printf (basename, " - %s", serial);
+	g_string_append_printf (basename, " (%04i-%02i-%02i)", date->year, date->month, date->day);
+
+	/* maybe configure in GConf? */
+	if (0)
+		g_string_append_printf (basename, " [%s]", timespec);
 
 	g_date_free (date);
 	g_free (serial);
@@ -442,7 +445,7 @@ gcm_prefs_calibrate_device (GcmCalibrate *calib)
 	/* ensure we have data */
 	basename = gcm_prefs_calibrate_get_basename (current_device);
 	if (manufacturer == NULL)
-		manufacturer = g_strdup ("Generic vendor");
+		manufacturer = g_strdup ("Generic manufacturer");
 	if (model == NULL)
 		model = g_strdup ("Generic model");
 	if (description == NULL)
@@ -531,6 +534,7 @@ gcm_prefs_update_profile_list (void)
 		g_object_get (profile,
 			      "description", &description,
 			      "type", &profile_type,
+			      "filename", &filename,
 			      NULL);
 
 		egg_debug ("add %s to profiles list", filename);
@@ -543,6 +547,7 @@ gcm_prefs_update_profile_list (void)
 				    GPM_PROFILES_COLUMN_PROFILE, profile,
 				    -1);
 
+		g_free (filename);
 		g_free (description);
 	}
 }
@@ -1343,8 +1348,9 @@ gcm_prefs_profiles_treeview_clicked_cb (GtkTreeSelection *selection, gpointer us
 	GcmXyz *red;
 	GcmXyz *green;
 	GcmXyz *blue;
-	gchar *copyright = NULL;
-	gchar *vendor = NULL;
+	gchar *profile_copyright = NULL;
+	gchar *profile_manufacturer = NULL;
+	gchar *profile_model = NULL;
 	gchar *filename = NULL;
 	gchar *basename = NULL;
 	gchar *size_text = NULL;
@@ -1368,8 +1374,9 @@ gcm_prefs_profiles_treeview_clicked_cb (GtkTreeSelection *selection, gpointer us
 	g_object_get (profile,
 		      "filename", &filename,
 		      "size", &size,
-		      "copyright", &copyright,
-		      "vendor", &vendor,
+		      "copyright", &profile_copyright,
+		      "manufacturer", &profile_manufacturer,
+		      "model", &profile_model,
 		      "type", &profile_type,
 		      "white-point", &white,
 		      "luminance-red", &red,
@@ -1418,32 +1425,34 @@ gcm_prefs_profiles_treeview_clicked_cb (GtkTreeSelection *selection, gpointer us
 		gtk_label_set_label (GTK_LABEL (widget), size_text);
 	}
 
-	/* set new descriptions */
+	/* set new copyright */
 	widget = GTK_WIDGET (gtk_builder_get_object (builder, "hbox_copyright"));
-	if (copyright == NULL) {
+	if (profile_copyright == NULL) {
 		gtk_widget_hide (widget);
 	} else {
 		gtk_widget_show (widget);
 		widget = GTK_WIDGET (gtk_builder_get_object (builder, "label_copyright"));
-		gtk_label_set_label (GTK_LABEL(widget), copyright);
+		gtk_label_set_label (GTK_LABEL(widget), profile_copyright);
 	}
 
-	/* set new descriptions */
-	widget = GTK_WIDGET (gtk_builder_get_object (builder, "hbox_vendor"));
-	if (vendor == NULL) {
+	/* set new manufacturer */
+	widget = GTK_WIDGET (gtk_builder_get_object (builder, "hbox_profile_manufacturer"));
+	if (profile_manufacturer == NULL) {
 		gtk_widget_hide (widget);
 	} else {
 		gtk_widget_show (widget);
-		widget = GTK_WIDGET (gtk_builder_get_object (builder, "label_vendor"));
-		gtk_label_set_label (GTK_LABEL(widget), vendor);
+		widget = GTK_WIDGET (gtk_builder_get_object (builder, "label_profile_manufacturer"));
+		gtk_label_set_label (GTK_LABEL(widget), profile_manufacturer);
 	}
 
-	/* set new descriptions */
-	widget = GTK_WIDGET (gtk_builder_get_object (builder, "vbox_profiles_details"));
-	if (copyright == NULL && vendor == NULL && profile_type == GCM_PROFILE_TYPE_UNKNOWN) {
+	/* set new model */
+	widget = GTK_WIDGET (gtk_builder_get_object (builder, "hbox_profile_model"));
+	if (profile_model == NULL) {
 		gtk_widget_hide (widget);
 	} else {
 		gtk_widget_show (widget);
+		widget = GTK_WIDGET (gtk_builder_get_object (builder, "label_profile_model"));
+		gtk_label_set_label (GTK_LABEL(widget), profile_model);
 	}
 
 	/* set delete sensitivity */
@@ -1459,9 +1468,9 @@ gcm_prefs_profiles_treeview_clicked_cb (GtkTreeSelection *selection, gpointer us
 	g_free (size_text);
 	g_free (filename);
 	g_free (basename);
-	g_free (copyright);
-	g_free (vendor);
-
+	g_free (profile_copyright);
+	g_free (profile_manufacturer);
+	g_free (profile_model);
 }
 
 /**
@@ -2274,6 +2283,8 @@ main (int argc, char **argv)
 	gtk_size_group_add_widget (size_group, widget);
 	widget = GTK_WIDGET (gtk_builder_get_object (builder, "hbox32"));
 	gtk_size_group_add_widget (size_group, widget);
+	widget = GTK_WIDGET (gtk_builder_get_object (builder, "hbox34"));
+	gtk_size_group_add_widget (size_group, widget);
 
 	/* set alignment for right */
 	size_group2 = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
@@ -2293,6 +2304,8 @@ main (int argc, char **argv)
 	gtk_size_group_add_widget (size_group2, widget);
 	widget = GTK_WIDGET (gtk_builder_get_object (builder, "hbox33"));
 	gtk_size_group_add_widget (size_group2, widget);
+	widget = GTK_WIDGET (gtk_builder_get_object (builder, "hbox35"));
+	gtk_size_group_add_widget (size_group2, widget);
 
 	/* get screen */
 	rr_screen = gnome_rr_screen_new (gdk_screen_get_default (), NULL, NULL, &error);
diff --git a/src/gcm-profile.c b/src/gcm-profile.c
index 9a5ce8d..2981e3d 100644
--- a/src/gcm-profile.c
+++ b/src/gcm-profile.c
@@ -129,7 +129,7 @@ struct _GcmProfilePrivate
 	gchar				*description;
 	gchar				*filename;
 	gchar				*copyright;
-	gchar				*vendor;
+	gchar				*manufacturer;
 	gchar				*model;
 	gboolean			 has_mlut;
 	gboolean			 has_vcgt_formula;
@@ -153,7 +153,7 @@ struct _GcmProfilePrivate
 enum {
 	PROP_0,
 	PROP_COPYRIGHT,
-	PROP_VENDOR,
+	PROP_MANUFACTURER,
 	PROP_MODEL,
 	PROP_DESCRIPTION,
 	PROP_FILENAME,
@@ -715,8 +715,8 @@ gcm_profile_parse_data (GcmProfile *profile, const gchar *data, gsize length, GE
 			egg_debug ("found COPYRIGHT: %s", profile->priv->copyright);
 		}
 		if (tag_id == GCM_TAG_ID_DEVICE_MFG_DESC) {
-			profile->priv->vendor = gcm_profile_parse_multi_localized_unicode (profile, data, tag_offset);
-			egg_debug ("found VENDOR: %s", profile->priv->vendor);
+			profile->priv->manufacturer = gcm_profile_parse_multi_localized_unicode (profile, data, tag_offset);
+			egg_debug ("found MANUFACTURER: %s", profile->priv->manufacturer);
 		}
 		if (tag_id == GCM_TAG_ID_DEVICE_MODEL_DESC) {
 			profile->priv->model = gcm_profile_parse_multi_localized_unicode (profile, data, tag_offset);
@@ -822,8 +822,8 @@ gcm_profile_parse_data (GcmProfile *profile, const gchar *data, gsize length, GE
 		gcm_profile_ensure_printable (priv->description);
 	if (priv->copyright != NULL)
 		gcm_profile_ensure_printable (priv->copyright);
-	if (priv->vendor != NULL)
-		gcm_profile_ensure_printable (priv->vendor);
+	if (priv->manufacturer != NULL)
+		gcm_profile_ensure_printable (priv->manufacturer);
 	if (priv->model != NULL)
 		gcm_profile_ensure_printable (priv->model);
 
@@ -1062,8 +1062,8 @@ gcm_profile_get_property (GObject *object, guint prop_id, GValue *value, GParamS
 	case PROP_COPYRIGHT:
 		g_value_set_string (value, priv->copyright);
 		break;
-	case PROP_VENDOR:
-		g_value_set_string (value, priv->vendor);
+	case PROP_MANUFACTURER:
+		g_value_set_string (value, priv->manufacturer);
 		break;
 	case PROP_MODEL:
 		g_value_set_string (value, priv->model);
@@ -1132,12 +1132,12 @@ gcm_profile_class_init (GcmProfileClass *klass)
 	g_object_class_install_property (object_class, PROP_COPYRIGHT, pspec);
 
 	/**
-	 * GcmProfile:vendor:
+	 * GcmProfile:manufacturer:
 	 */
-	pspec = g_param_spec_string ("vendor", NULL, NULL,
+	pspec = g_param_spec_string ("manufacturer", NULL, NULL,
 				     NULL,
 				     G_PARAM_READABLE);
-	g_object_class_install_property (object_class, PROP_VENDOR, pspec);
+	g_object_class_install_property (object_class, PROP_MANUFACTURER, pspec);
 
 	/**
 	 * GcmProfile:model:
@@ -1245,7 +1245,7 @@ gcm_profile_finalize (GObject *object)
 	g_free (priv->copyright);
 	g_free (priv->description);
 	g_free (priv->filename);
-	g_free (priv->vendor);
+	g_free (priv->manufacturer);
 	g_free (priv->model);
 	g_free (priv->vcgt_data);
 	g_free (priv->mlut_data);
@@ -1280,7 +1280,7 @@ gcm_profile_new (void)
 
 typedef struct {
 	const gchar *copyright;
-	const gchar *vendor;
+	const gchar *manufacturer;
 	const gchar *model;
 	const gchar *description;
 	GcmProfileType type;
@@ -1293,7 +1293,7 @@ gcm_profile_test_parse_file (EggTest *test, const gchar *datafile, GcmProfileTes
 	gchar *filename;
 	gchar *filename_tmp;
 	gchar *copyright;
-	gchar *vendor;
+	gchar *manufacturer;
 	gchar *model;
 	gchar *description;
 	gchar *ascii_string;
@@ -1329,7 +1329,7 @@ gcm_profile_test_parse_file (EggTest *test, const gchar *datafile, GcmProfileTes
 	/* get some properties */
 	g_object_get (profile,
 		      "copyright", &copyright,
-		      "vendor", &vendor,
+		      "manufacturer", &manufacturer,
 		      "model", &model,
 		      "description", &description,
 		      "filename", &filename_tmp,
@@ -1351,11 +1351,11 @@ gcm_profile_test_parse_file (EggTest *test, const gchar *datafile, GcmProfileTes
 		egg_test_failed (test, "invalid value: %s, expecting: %s", copyright, test_data->copyright);
 
 	/************************************************************/
-	egg_test_title (test, "check vendor for %s", datafile);
-	if (g_strcmp0 (vendor, test_data->vendor) == 0)
+	egg_test_title (test, "check manufacturer for %s", datafile);
+	if (g_strcmp0 (manufacturer, test_data->manufacturer) == 0)
 		egg_test_success (test, NULL);
 	else
-		egg_test_failed (test, "invalid value: %s, expecting: %s", vendor, test_data->vendor);
+		egg_test_failed (test, "invalid value: %s, expecting: %s", manufacturer, test_data->manufacturer);
 
 	/************************************************************/
 	egg_test_title (test, "check model for %s", datafile);
@@ -1392,7 +1392,7 @@ gcm_profile_test_parse_file (EggTest *test, const gchar *datafile, GcmProfileTes
 	g_object_unref (xyz);
 	g_object_unref (profile);
 	g_free (copyright);
-	g_free (vendor);
+	g_free (manufacturer);
 	g_free (model);
 	g_free (description);
 	g_free (data);
@@ -1439,7 +1439,7 @@ gcm_profile_test (EggTest *test)
 
 	/* bluish test */
 	test_data.copyright = "Copyright (c) 1998 Hewlett-Packard Company";
-	test_data.vendor = "IEC http://www.iec.ch";;
+	test_data.manufacturer = "IEC http://www.iec.ch";;
 	test_data.model = "IEC 61966-2.1 Default RGB colour space - sRGB";
 	test_data.description = "bluish test";
 	test_data.type = GCM_PROFILE_TYPE_DISPLAY_DEVICE;
@@ -1448,7 +1448,7 @@ gcm_profile_test (EggTest *test)
 
 	/* Adobe test */
 	test_data.copyright = "Copyright (c) 1998 Hewlett-Packard Company Modified using Adobe Gamma";
-	test_data.vendor = "IEC http://www.iec.ch";;
+	test_data.manufacturer = "IEC http://www.iec.ch";;
 	test_data.model = "IEC 61966-2.1 Default RGB colour space - sRGB";
 	test_data.description = "ADOBEGAMMA-Test";
 	test_data.type = GCM_PROFILE_TYPE_DISPLAY_DEVICE;



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