[gnome-color-manager] Add the profile version number to the information viewer tab
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] Add the profile version number to the information viewer tab
- Date: Wed, 20 Apr 2011 20:08:46 +0000 (UTC)
commit c790666392d3313275e1533df53dce5a6eca86d0
Author: Richard Hughes <richard hughsie com>
Date: Sat Apr 16 05:30:05 2011 +0100
Add the profile version number to the information viewer tab
data/gcm-viewer.ui | 80 +++++++++++++++++++++++++++++++++++++++++++++++----
src/gcm-profile.c | 17 +++++++++++
src/gcm-profile.h | 1 +
src/gcm-viewer.c | 10 ++++++
4 files changed, 101 insertions(+), 7 deletions(-)
---
diff --git a/data/gcm-viewer.ui b/data/gcm-viewer.ui
index 94473d0..4cc5945 100644
--- a/data/gcm-viewer.ui
+++ b/data/gcm-viewer.ui
@@ -297,6 +297,71 @@
</packing>
</child>
<child>
+ <object class="GtkHBox" id="hbox_version">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkHBox" id="hbox9">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel" id="label_title_version">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="valign">start</property>
+ <property name="label" translatable="yes" comments="The version of the profile">Version</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox13">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel" id="label_version">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label">1.00</property>
+ <property name="use_markup">True</property>
+ <property name="wrap">True</property>
+ <property name="wrap_mode">char</property>
+ <property name="selectable">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <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">3</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkHBox" id="hbox_profile_manufacturer">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -358,7 +423,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>
@@ -423,7 +488,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>
<child>
@@ -486,7 +551,7 @@
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">3</property>
- <property name="position">5</property>
+ <property name="position">6</property>
</packing>
</child>
<child>
@@ -550,7 +615,7 @@
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">3</property>
- <property name="position">6</property>
+ <property name="position">7</property>
</packing>
</child>
<child>
@@ -615,7 +680,7 @@
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">3</property>
- <property name="position">7</property>
+ <property name="position">8</property>
</packing>
</child>
<child>
@@ -678,7 +743,7 @@
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">3</property>
- <property name="position">8</property>
+ <property name="position">9</property>
</packing>
</child>
<child>
@@ -743,7 +808,7 @@
<property name="expand">False</property>
<property name="fill">False</property>
<property name="padding">3</property>
- <property name="position">9</property>
+ <property name="position">10</property>
</packing>
</child>
</object>
@@ -1421,6 +1486,7 @@
<widget name="hbox12"/>
<widget name="hbox31"/>
<widget name="hbox33"/>
+ <widget name="hbox9"/>
</widgets>
</object>
</interface>
diff --git a/src/gcm-profile.c b/src/gcm-profile.c
index 4d292de..11ae699 100644
--- a/src/gcm-profile.c
+++ b/src/gcm-profile.c
@@ -58,6 +58,7 @@ struct _GcmProfilePrivate
gboolean can_delete;
gchar *description;
gchar *filename;
+ gchar *version;
gchar *copyright;
gchar *manufacturer;
gchar *model;
@@ -461,6 +462,16 @@ gcm_profile_set_datetime (GcmProfile *profile, const gchar *datetime)
}
/**
+ * gcm_profile_get_version:
+ **/
+const gchar *
+gcm_profile_get_version (GcmProfile *profile)
+{
+ g_return_val_if_fail (GCM_IS_PROFILE (profile), NULL);
+ return profile->priv->version;
+}
+
+/**
* gcm_profile_get_checksum:
**/
const gchar *
@@ -605,6 +616,7 @@ gcm_profile_parse_data (GcmProfile *profile, const guint8 *data, gsize length, G
CdProfileKind profile_kind;
cmsCIEXYZ *cie_xyz;
cmsCIEXYZTRIPLE cie_illum;
+ cmsFloat64Number profile_version;
struct tm created;
cmsHPROFILE xyz_profile;
cmsHTRANSFORM transform;
@@ -816,6 +828,10 @@ gcm_profile_parse_data (GcmProfile *profile, const guint8 *data, gsize length, G
g_free (text);
}
+ /* get profile header version */
+ profile_version = cmsGetProfileVersion (priv->lcms_profile);
+ priv->version = g_strdup_printf ("%.2lf", profile_version);
+
/* allocate temporary buffer */
text = g_new0 (gchar, 1024);
@@ -2370,6 +2386,7 @@ gcm_profile_finalize (GObject *object)
g_free (priv->model);
g_free (priv->datetime);
g_free (priv->checksum);
+ g_free (priv->version);
cd_color_xyz_free (priv->white);
cd_color_xyz_free (priv->black);
cd_color_xyz_free (priv->red);
diff --git a/src/gcm-profile.h b/src/gcm-profile.h
index c460048..f3f290c 100644
--- a/src/gcm-profile.h
+++ b/src/gcm-profile.h
@@ -74,6 +74,7 @@ gboolean gcm_profile_save (GcmProfile *profile,
GError **error);
gpointer gcm_profile_get_handle (GcmProfile *profile);
const gchar *gcm_profile_get_checksum (GcmProfile *profile);
+const gchar *gcm_profile_get_version (GcmProfile *profile);
gboolean gcm_profile_get_can_delete (GcmProfile *profile);
GcmClut *gcm_profile_generate_vcgt (GcmProfile *profile,
guint size);
diff --git a/src/gcm-viewer.c b/src/gcm-viewer.c
index 084b96e..f1e6635 100644
--- a/src/gcm-viewer.c
+++ b/src/gcm-viewer.c
@@ -830,6 +830,12 @@ gcm_viewer_set_profile (GcmViewerPrivate *viewer, CdProfile *profile)
gtk_label_set_label (GTK_LABEL (widget), temp);
g_free (temp);
+ /* set profile version */
+ filename = gcm_profile_get_version (gcm_profile);
+ widget = GTK_WIDGET (gtk_builder_get_object (viewer->builder,
+ "label_version"));
+ gtk_label_set_label (GTK_LABEL (widget), filename);
+
/* set whitepoint */
temperature = gcm_profile_get_temperature (gcm_profile);
widget = GTK_WIDGET (gtk_builder_get_object (viewer->builder, "label_temp"));
@@ -1300,6 +1306,10 @@ gcm_viewer_startup_cb (GApplication *application, GcmViewerPrivate *viewer)
"label_title_filename"));
context = gtk_widget_get_style_context (widget);
gtk_style_context_add_class (context, "dim-label");
+ widget = GTK_WIDGET (gtk_builder_get_object (viewer->builder,
+ "label_title_version"));
+ context = gtk_widget_get_style_context (widget);
+ gtk_style_context_add_class (context, "dim-label");
/* show main UI */
gtk_widget_show (main_window);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]