[gnome-color-manager] Show the EISA ID in the devices tab. Fixes rh#581837



commit d6027f5471433971da0649e69e3f3a86a7202318
Author: Richard Hughes <richard hughsie com>
Date:   Thu May 6 12:17:37 2010 +0100

    Show the EISA ID in the devices tab. Fixes rh#581837

 data/gcm-prefs.ui       |   85 +++++++++++++++++++++++++++++++++++++----------
 src/gcm-device-xrandr.c |   29 +++++++++++++++-
 src/gcm-device-xrandr.h |    1 +
 src/gcm-dump-edid.c     |    8 ++--
 src/gcm-edid.c          |   48 +++++++++++++-------------
 src/gcm-edid.h          |    2 +-
 src/gcm-prefs.c         |   13 +++++++
 src/gcm-profile.c       |    2 +-
 8 files changed, 138 insertions(+), 50 deletions(-)
---
diff --git a/data/gcm-prefs.ui b/data/gcm-prefs.ui
index 12920f6..6bc8c6d 100644
--- a/data/gcm-prefs.ui
+++ b/data/gcm-prefs.ui
@@ -378,6 +378,54 @@
                                           </packing>
                                         </child>
                                         <child>
+                                          <object class="GtkHBox" id="hbox_eisa">
+                                            <property name="visible">True</property>
+                                            <property name="spacing">12</property>
+                                            <child>
+                                              <object class="GtkHBox" id="hbox53">
+                                                <property name="visible">True</property>
+                                                <child>
+                                                  <object class="GtkLabel" id="label_title_eisa">
+                                                    <property name="visible">True</property>
+                                                    <property name="label" translatable="yes" comments="The EISA (standards body) identifier of the device">EISA ID:</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="hbox54">
+                                                <property name="visible">True</property>
+                                                <child>
+                                                  <object class="GtkLabel" id="label_eisa">
+                                                    <property name="visible">True</property>
+                                                    <property name="label">eisa-id</property>
+                                                    <property name="selectable">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="padding">3</property>
+                                            <property name="position">3</property>
+                                          </packing>
+                                        </child>
+                                        <child>
                                           <object class="GtkHBox" id="hbox3">
                                             <property name="visible">True</property>
                                             <child>
@@ -393,7 +441,7 @@
                                             </child>
                                           </object>
                                           <packing>
-                                            <property name="position">3</property>
+                                            <property name="position">4</property>
                                           </packing>
                                         </child>
                                       </object>
@@ -1953,44 +2001,45 @@
   </object>
   <object class="GtkSizeGroup" id="sizegroup_lists">
     <widgets>
-      <widget name="scrolledwindow2"/>
       <widget name="scrolledwindow1"/>
+      <widget name="scrolledwindow2"/>
     </widgets>
   </object>
   <object class="GtkSizeGroup" id="sizegroup_defaults">
     <widgets>
-      <widget name="hbox17"/>
-      <widget name="hbox15"/>
-      <widget name="hbox46"/>
       <widget name="hbox43"/>
+      <widget name="hbox46"/>
+      <widget name="hbox15"/>
+      <widget name="hbox17"/>
     </widgets>
   </object>
   <object class="GtkSizeGroup" id="sizegroup_devices">
     <widgets>
-      <widget name="hbox23"/>
-      <widget name="hbox22"/>
       <widget name="hbox21"/>
+      <widget name="hbox22"/>
+      <widget name="hbox23"/>
+      <widget name="hbox53"/>
     </widgets>
   </object>
   <object class="GtkSizeGroup" id="sizegroup_profiles">
     <widgets>
-      <widget name="hbox33"/>
-      <widget name="hbox31"/>
-      <widget name="hbox12"/>
-      <widget name="hbox48"/>
-      <widget name="hbox34"/>
-      <widget name="hbox10"/>
-      <widget name="hbox36"/>
-      <widget name="hbox39"/>
       <widget name="hbox6"/>
+      <widget name="hbox39"/>
+      <widget name="hbox36"/>
+      <widget name="hbox10"/>
+      <widget name="hbox34"/>
+      <widget name="hbox48"/>
+      <widget name="hbox12"/>
+      <widget name="hbox31"/>
+      <widget name="hbox33"/>
     </widgets>
   </object>
   <object class="GtkSizeGroup" id="sizegroup_combos">
     <widgets>
-      <widget name="combobox_space_rgb"/>
-      <widget name="combobox_space_cmyk"/>
-      <widget name="combobox_rendering_display"/>
       <widget name="combobox_rendering_softproof"/>
+      <widget name="combobox_rendering_display"/>
+      <widget name="combobox_space_cmyk"/>
+      <widget name="combobox_space_rgb"/>
     </widgets>
   </object>
 </interface>
diff --git a/src/gcm-device-xrandr.c b/src/gcm-device-xrandr.c
index 7fdac19..c1a3142 100644
--- a/src/gcm-device-xrandr.c
+++ b/src/gcm-device-xrandr.c
@@ -51,6 +51,7 @@ static void     gcm_device_xrandr_finalize	(GObject     *object);
 struct _GcmDeviceXrandrPrivate
 {
 	gchar				*native_device;
+	gchar				*eisa_id;
 	guint				 gamma_size;
 	GcmEdid				*edid;
 	GcmDmi				*dmi;
@@ -64,6 +65,7 @@ enum {
 	PROP_0,
 	PROP_NATIVE_DEVICE,
 	PROP_XRANDR_FALLBACK,
+	PROP_EISA_ID,
 	PROP_LAST
 };
 
@@ -82,7 +84,16 @@ gcm_device_xrandr_get_native_device (GcmDeviceXrandr *device_xrandr)
 }
 
 /**
- * gcm_device_xrandr_get_native_device:
+ * gcm_device_xrandr_get_eisa_id:
+ **/
+const gchar *
+gcm_device_xrandr_get_eisa_id (GcmDeviceXrandr *device_xrandr)
+{
+	return device_xrandr->priv->eisa_id;
+}
+
+/**
+ * gcm_device_xrandr_get_fallback:
  **/
 gboolean
 gcm_device_xrandr_get_fallback (GcmDeviceXrandr *device_xrandr)
@@ -190,7 +201,7 @@ gcm_device_xrandr_get_id_for_xrandr_device (GcmDeviceXrandr *device_xrandr, Gnom
 	name = gcm_edid_get_monitor_name (priv->edid);
 	if (name != NULL)
 		g_string_append_printf (string, "_%s", name);
-	ascii = gcm_edid_get_ascii_string (priv->edid);
+	ascii = gcm_edid_get_eisa_id (priv->edid);
 	if (ascii != NULL)
 		g_string_append_printf (string, "_%s", ascii);
 	serial = gcm_edid_get_serial_number (priv->edid);
@@ -249,6 +260,7 @@ gcm_device_xrandr_set_from_output (GcmDevice *device, GnomeRROutput *output, GEr
 	model = gcm_edid_get_monitor_name (priv->edid);
 	manufacturer = gcm_edid_get_vendor_name (priv->edid);
 	serial = gcm_edid_get_serial_number (priv->edid);
+	priv->eisa_id = g_strdup (gcm_edid_get_eisa_id (priv->edid));
 
 	/* refine data if it's missing */
 	output_name = gnome_rr_output_get_name (output);
@@ -601,6 +613,9 @@ gcm_device_xrandr_get_property (GObject *object, guint prop_id, GValue *value, G
 	case PROP_XRANDR_FALLBACK:
 		g_value_set_boolean (value, priv->xrandr_fallback);
 		break;
+	case PROP_EISA_ID:
+		g_value_set_string (value, priv->eisa_id);
+		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
 		break;
@@ -659,6 +674,14 @@ gcm_device_xrandr_class_init (GcmDeviceXrandrClass *klass)
 				      G_PARAM_READABLE);
 	g_object_class_install_property (object_class, PROP_XRANDR_FALLBACK, pspec);
 
+	/**
+	 * GcmDeviceXrandr:eisa-id:
+	 */
+	pspec = g_param_spec_string ("eisa-id", NULL, NULL,
+				     NULL,
+				     G_PARAM_READABLE);
+	g_object_class_install_property (object_class, PROP_EISA_ID, pspec);
+
 	g_type_class_add_private (klass, sizeof (GcmDeviceXrandrPrivate));
 }
 
@@ -670,6 +693,7 @@ gcm_device_xrandr_init (GcmDeviceXrandr *device_xrandr)
 {
 	device_xrandr->priv = GCM_DEVICE_XRANDR_GET_PRIVATE (device_xrandr);
 	device_xrandr->priv->native_device = NULL;
+	device_xrandr->priv->eisa_id = NULL;
 	device_xrandr->priv->xrandr_fallback = FALSE;
 	device_xrandr->priv->gamma_size = 0;
 	device_xrandr->priv->edid = gcm_edid_new ();
@@ -689,6 +713,7 @@ gcm_device_xrandr_finalize (GObject *object)
 	GcmDeviceXrandrPrivate *priv = device_xrandr->priv;
 
 	g_free (priv->native_device);
+	g_free (priv->eisa_id);
 	g_object_unref (priv->edid);
 	g_object_unref (priv->dmi);
 	g_object_unref (priv->gconf_client);
diff --git a/src/gcm-device-xrandr.h b/src/gcm-device-xrandr.h
index 785e10e..63697d8 100644
--- a/src/gcm-device-xrandr.h
+++ b/src/gcm-device-xrandr.h
@@ -54,6 +54,7 @@ gboolean	 gcm_device_xrandr_set_from_output	(GcmDevice		*device,
 							 GnomeRROutput		*output,
 							 GError			**error);
 const gchar	*gcm_device_xrandr_get_native_device	(GcmDeviceXrandr	*device_xrandr);
+const gchar	*gcm_device_xrandr_get_eisa_id		(GcmDeviceXrandr	*device_xrandr);
 gboolean	 gcm_device_xrandr_get_fallback		(GcmDeviceXrandr	*device_xrandr);
 
 G_END_DECLS
diff --git a/src/gcm-dump-edid.c b/src/gcm-dump-edid.c
index e5e9df8..b9efb3a 100644
--- a/src/gcm-dump-edid.c
+++ b/src/gcm-dump-edid.c
@@ -41,7 +41,7 @@ gcm_dump_edid_filename (const gchar *filename)
 	const gchar *monitor_name;
 	const gchar *vendor_name;
 	const gchar *serial_number;
-	const gchar *ascii_string;
+	const gchar *eisa_id;
 	const gchar *pnp_id;
 	gchar *data = NULL;
 	guint width;
@@ -84,10 +84,10 @@ gcm_dump_edid_filename (const gchar *filename)
 		/* TRANSLATORS: this is debugging output for the supplied EDID file */
 		g_print ("  %s: %s\n", _("Serial number"), serial_number);
 	}
-	ascii_string = gcm_edid_get_ascii_string (edid);
-	if (ascii_string != NULL) {
+	eisa_id = gcm_edid_get_eisa_id (edid);
+	if (eisa_id != NULL) {
 		/* TRANSLATORS: this is debugging output for the supplied EDID file */
-		g_print ("  %s: %s\n", _("Text string"), ascii_string);
+		g_print ("  %s: %s\n", _("EISA ID"), eisa_id);
 	}
 	pnp_id = gcm_edid_get_pnp_id (edid);
 	if (pnp_id != NULL) {
diff --git a/src/gcm-edid.c b/src/gcm-edid.c
index 75a68ac..bee35fc 100644
--- a/src/gcm-edid.c
+++ b/src/gcm-edid.c
@@ -53,7 +53,7 @@ struct _GcmEdidPrivate
 	gchar				*monitor_name;
 	gchar				*vendor_name;
 	gchar				*serial_number;
-	gchar				*ascii_string;
+	gchar				*eisa_id;
 	gchar				*pnp_id;
 	guint				 width;
 	guint				 height;
@@ -66,7 +66,7 @@ enum {
 	PROP_MONITOR_NAME,
 	PROP_VENDOR_NAME,
 	PROP_SERIAL_NUMBER,
-	PROP_ASCII_STRING,
+	PROP_EISA_ID,
 	PROP_GAMMA,
 	PROP_PNP_ID,
 	PROP_WIDTH,
@@ -126,13 +126,13 @@ gcm_edid_get_serial_number (GcmEdid *edid)
 }
 
 /**
- * gcm_edid_get_ascii_string:
+ * gcm_edid_get_eisa_id:
  **/
 const gchar *
-gcm_edid_get_ascii_string (GcmEdid *edid)
+gcm_edid_get_eisa_id (GcmEdid *edid)
 {
 	g_return_val_if_fail (GCM_IS_EDID (edid), NULL);
-	return edid->priv->ascii_string;
+	return edid->priv->eisa_id;
 }
 
 /**
@@ -189,7 +189,7 @@ gcm_edid_reset (GcmEdid *edid)
 	g_free (priv->monitor_name);
 	g_free (priv->vendor_name);
 	g_free (priv->serial_number);
-	g_free (priv->ascii_string);
+	g_free (priv->eisa_id);
 
 	/* do not deallocate, just blank */
 	priv->pnp_id[0] = '\0';
@@ -198,7 +198,7 @@ gcm_edid_reset (GcmEdid *edid)
 	priv->monitor_name = NULL;
 	priv->vendor_name = NULL;
 	priv->serial_number = NULL;
-	priv->ascii_string = NULL;
+	priv->eisa_id = NULL;
 	priv->width = 0;
 	priv->height = 0;
 	priv->gamma = 0.0f;
@@ -383,8 +383,8 @@ gcm_edid_parse (GcmEdid *edid, const guint8 *data, GError **error)
 		} else if (data[i+3] == GCM_DESCRIPTOR_ALPHANUMERIC_DATA_STRING) {
 			tmp = gcm_edid_parse_string (&data[i+5]);
 			if (tmp != NULL) {
-				g_free (priv->ascii_string);
-				priv->ascii_string = tmp;
+				g_free (priv->eisa_id);
+				priv->eisa_id = tmp;
 			}
 		} else if (data[i+3] == GCM_DESCRIPTOR_COLOR_POINT) {
 			if (data[i+3+9] != 0xff) {
@@ -408,7 +408,7 @@ gcm_edid_parse (GcmEdid *edid, const guint8 *data, GError **error)
 	/* print what we've got */
 	egg_debug ("monitor name: %s", priv->monitor_name);
 	egg_debug ("serial number: %s", priv->serial_number);
-	egg_debug ("ascii string: %s", priv->ascii_string);
+	egg_debug ("ascii string: %s", priv->eisa_id);
 out:
 	return ret;
 }
@@ -432,8 +432,8 @@ gcm_edid_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec
 	case PROP_SERIAL_NUMBER:
 		g_value_set_string (value, priv->serial_number);
 		break;
-	case PROP_ASCII_STRING:
-		g_value_set_string (value, priv->ascii_string);
+	case PROP_EISA_ID:
+		g_value_set_string (value, priv->eisa_id);
 		break;
 	case PROP_GAMMA:
 		g_value_set_float (value, priv->gamma);
@@ -503,12 +503,12 @@ gcm_edid_class_init (GcmEdidClass *klass)
 	g_object_class_install_property (object_class, PROP_SERIAL_NUMBER, pspec);
 
 	/**
-	 * GcmEdid:ascii-string:
+	 * GcmEdid:eisa-id:
 	 */
-	pspec = g_param_spec_string ("ascii-string", NULL, NULL,
+	pspec = g_param_spec_string ("eisa-id", NULL, NULL,
 				     NULL,
 				     G_PARAM_READABLE);
-	g_object_class_install_property (object_class, PROP_ASCII_STRING, pspec);
+	g_object_class_install_property (object_class, PROP_EISA_ID, pspec);
 
 	/**
 	 * GcmEdid:gamma:
@@ -555,7 +555,7 @@ gcm_edid_init (GcmEdid *edid)
 	edid->priv->monitor_name = NULL;
 	edid->priv->vendor_name = NULL;
 	edid->priv->serial_number = NULL;
-	edid->priv->ascii_string = NULL;
+	edid->priv->eisa_id = NULL;
 	edid->priv->tables = gcm_tables_new ();
 	edid->priv->pnp_id = g_new0 (gchar, 4);
 }
@@ -572,7 +572,7 @@ gcm_edid_finalize (GObject *object)
 	g_free (priv->monitor_name);
 	g_free (priv->vendor_name);
 	g_free (priv->serial_number);
-	g_free (priv->ascii_string);
+	g_free (priv->eisa_id);
 	g_free (priv->pnp_id);
 	g_object_unref (priv->tables);
 
@@ -602,7 +602,7 @@ typedef struct {
 	const gchar *monitor_name;
 	const gchar *vendor_name;
 	const gchar *serial_number;
-	const gchar *ascii_string;
+	const gchar *eisa_id;
 	const gchar *pnp_id;
 	guint width;
 	guint height;
@@ -616,7 +616,7 @@ gcm_edid_test_parse_edid_file (EggTest *test, GcmEdid *edid, const gchar *datafi
 	const gchar *monitor_name;
 	const gchar *vendor_name;
 	const gchar *serial_number;
-	const gchar *ascii_string;
+	const gchar *eisa_id;
 	const gchar *pnp_id;
 	gchar *data;
 	guint width;
@@ -668,11 +668,11 @@ gcm_edid_test_parse_edid_file (EggTest *test, GcmEdid *edid, const gchar *datafi
 
 	/************************************************************/
 	egg_test_title (test, "check ascii string for %s", datafile);
-	ascii_string = gcm_edid_get_ascii_string (edid);
-	if (g_strcmp0 (ascii_string, test_data->ascii_string) == 0)
+	eisa_id = gcm_edid_get_eisa_id (edid);
+	if (g_strcmp0 (eisa_id, test_data->eisa_id) == 0)
 		egg_test_success (test, NULL);
 	else
-		egg_test_failed (test, "invalid value: %s, expecting: %s", ascii_string, test_data->ascii_string);
+		egg_test_failed (test, "invalid value: %s, expecting: %s", eisa_id, test_data->eisa_id);
 
 	/************************************************************/
 	egg_test_title (test, "check pnp id for %s", datafile);
@@ -729,7 +729,7 @@ gcm_edid_test (EggTest *test)
 	test_data.monitor_name = "L225W";
 	test_data.vendor_name = "Goldstar Company Ltd";
 	test_data.serial_number = "34398";
-	test_data.ascii_string = NULL;
+	test_data.eisa_id = NULL;
 	test_data.pnp_id = "GSM";
 	test_data.height = 30;
 	test_data.width = 47;
@@ -740,7 +740,7 @@ gcm_edid_test (EggTest *test)
 	test_data.monitor_name = NULL;
 	test_data.vendor_name = "IBM France";
 	test_data.serial_number = NULL;
-	test_data.ascii_string = "LTN154P2-L05";
+	test_data.eisa_id = "LTN154P2-L05";
 	test_data.pnp_id = "IBM";
 	test_data.height = 21;
 	test_data.width = 33;
diff --git a/src/gcm-edid.h b/src/gcm-edid.h
index 269127a..5cc4d6d 100644
--- a/src/gcm-edid.h
+++ b/src/gcm-edid.h
@@ -63,7 +63,7 @@ gboolean	 gcm_edid_parse				(GcmEdid		*edid,
 const gchar	*gcm_edid_get_monitor_name		(GcmEdid		*edid);
 const gchar	*gcm_edid_get_vendor_name		(GcmEdid		*edid);
 const gchar	*gcm_edid_get_serial_number		(GcmEdid		*edid);
-const gchar	*gcm_edid_get_ascii_string		(GcmEdid		*edid);
+const gchar	*gcm_edid_get_eisa_id		(GcmEdid		*edid);
 const gchar	*gcm_edid_get_pnp_id			(GcmEdid		*edid);
 guint		 gcm_edid_get_width			(GcmEdid		*edid);
 guint		 gcm_edid_get_height			(GcmEdid		*edid);
diff --git a/src/gcm-prefs.c b/src/gcm-prefs.c
index ede6b38..e39c659 100644
--- a/src/gcm-prefs.c
+++ b/src/gcm-prefs.c
@@ -1253,6 +1253,7 @@ gcm_prefs_devices_treeview_clicked_cb (GtkTreeSelection *selection, gpointer use
 	const gchar *device_serial = NULL;
 	const gchar *device_model = NULL;
 	const gchar *device_manufacturer = NULL;
+	const gchar *eisa_id = NULL;
 
 	/* This will only work in single or browse selection mode! */
 	if (!gtk_tree_selection_get_selected (selection, &model, &iter)) {
@@ -1338,6 +1339,18 @@ gcm_prefs_devices_treeview_clicked_cb (GtkTreeSelection *selection, gpointer use
 	widget = GTK_WIDGET (gtk_builder_get_object (builder, "vbox_device_details"));
 	gtk_widget_show (widget);
 
+	/* get display specific properties */
+	if (kind == GCM_DEVICE_KIND_DISPLAY)
+		eisa_id = gcm_device_xrandr_get_eisa_id (GCM_DEVICE_XRANDR (current_device));
+	widget = GTK_WIDGET (gtk_builder_get_object (builder, "hbox_eisa"));
+	if (eisa_id != NULL) {
+		gtk_widget_show (widget);
+		widget = GTK_WIDGET (gtk_builder_get_object (builder, "label_eisa"));
+		gtk_label_set_label (GTK_LABEL (widget), eisa_id);
+	} else {
+		gtk_widget_hide (widget);
+	}
+
 	/* set adjustments */
 	setting_up_device = TRUE;
 	localgamma = gcm_device_get_gamma (current_device);
diff --git a/src/gcm-profile.c b/src/gcm-profile.c
index 97efbf4..02a5668 100644
--- a/src/gcm-profile.c
+++ b/src/gcm-profile.c
@@ -896,7 +896,7 @@ gcm_profile_test_parse_file (EggTest *test, const guint8 *datafile, GcmProfileTe
 	const gchar *model;
 	const gchar *datetime;
 	const gchar *description;
-	const gchar *ascii_string;
+	const gchar *eisa_id;
 	const gchar *pnp_id;
 	guint width;
 	guint kind;



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