[gnome-color-manager] Show the profile problems in the viewer application
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] Show the profile problems in the viewer application
- Date: Tue, 20 Nov 2012 09:00:38 +0000 (UTC)
commit 4a17e42236a51c91fe321e4b919e919f23aa408d
Author: Richard Hughes <richard hughsie com>
Date: Sat Nov 17 14:52:17 2012 +0000
Show the profile problems in the viewer application
data/gcm-viewer.ui | 68 +++++++++++++++++++++++++++++++++++-
src/gcm-viewer.c | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 165 insertions(+), 2 deletions(-)
---
diff --git a/data/gcm-viewer.ui b/data/gcm-viewer.ui
index 1f36075..68b463f 100644
--- a/data/gcm-viewer.ui
+++ b/data/gcm-viewer.ui
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
- <requires lib="gtk+" version="2.16"/>
+ <requires lib="gtk+" version="3.0"/>
<object class="GtkWindow" id="dialog_viewer">
<property name="can_focus">False</property>
<property name="border_width">5</property>
@@ -809,6 +809,71 @@
<property name="position">10</property>
</packing>
</child>
+ <child>
+ <object class="GtkHBox" id="hbox_warnings">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkHBox" id="hbox332">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel" id="label_title_warnings">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="valign">start</property>
+ <property name="label" translatable="yes" comments="warnings for the profile">Warnings</property>
+ <property name="mnemonic_widget">label_warnings</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="hbox472">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel" id="label_warnings">
+ <property name="visible">True</property>
+ <property name="can_focus">False</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">11</property>
+ </packing>
+ </child>
</object>
</child>
<child type="tab">
@@ -1552,6 +1617,7 @@
<object class="GtkSizeGroup" id="sizegroup_profiles">
<widgets>
<widget name="hbox33"/>
+ <widget name="hbox332"/>
<widget name="hbox31"/>
<widget name="hbox12"/>
<widget name="hbox48"/>
diff --git a/src/gcm-viewer.c b/src/gcm-viewer.c
index 0e7d888..de16ae9 100644
--- a/src/gcm-viewer.c
+++ b/src/gcm-viewer.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
- * Copyright (C) 2009-2011 Richard Hughes <richard hughsie com>
+ * Copyright (C) 2009-2012 Richard Hughes <richard hughsie com>
*
* Licensed under the GNU General Public License Version 2
*
@@ -901,6 +901,64 @@ out:
return ret;
}
+#if CD_CHECK_VERSION(0,1,25)
+/**
+ * gcm_profile_warning_to_string:
+ **/
+static const gchar *
+gcm_profile_warning_to_string (CdProfileWarning kind_enum)
+{
+ const gchar *kind = NULL;
+ switch (kind_enum) {
+ case CD_PROFILE_WARNING_DESCRIPTION_MISSING:
+ /* TRANSLATORS: the profile is broken */
+ kind = _("No description has been set");
+ break;
+ case CD_PROFILE_WARNING_COPYRIGHT_MISSING:
+ /* TRANSLATORS: the profile is broken */
+ kind = _("No copyright has been set");
+ break;
+ case CD_PROFILE_WARNING_VCGT_NON_MONOTONIC:
+ /* TRANSLATORS: the profile is broken */
+ kind = _("The display compensation table is invalid");
+ break;
+ case CD_PROFILE_WARNING_SCUM_DOT:
+ /* TRANSLATORS: the profile is broken */
+ kind = _("A scum dot is present for media white");
+ break;
+ case CD_PROFILE_WARNING_GRAY_AXIS_INVALID:
+ /* TRANSLATORS: the profile is broken */
+ kind = _("The gray axis contains significant amounts of color");
+ break;
+ case CD_PROFILE_WARNING_GRAY_AXIS_NON_MONOTONIC:
+ /* TRANSLATORS: the profile is broken */
+ kind = _("The gray axis is non-monotonic");
+ break;
+ case CD_PROFILE_WARNING_PRIMARIES_INVALID:
+ /* TRANSLATORS: the profile is broken */
+ kind = _("One or more of the primaries are invalid");
+ break;
+ case CD_PROFILE_WARNING_PRIMARIES_NON_ADDITIVE:
+ /* TRANSLATORS: the profile is broken */
+ kind = _("The primaries do not add to white");
+ break;
+ case CD_PROFILE_WARNING_PRIMARIES_UNLIKELY:
+ /* TRANSLATORS: the profile is broken */
+ kind = _("One or more of the primaries is unlikely");
+ break;
+ case CD_PROFILE_WARNING_WHITEPOINT_INVALID:
+ /* TRANSLATORS: the profile is broken */
+ kind = _("The white is not D50 white");
+ break;
+ default:
+ /* TRANSLATORS: the profile is broken */
+ kind = _("Unknown warning type");
+ break;
+ }
+ return kind;
+}
+#endif
+
/**
* gcm_viewer_set_profile:
**/
@@ -933,6 +991,12 @@ gcm_viewer_set_profile (GcmViewerPrivate *viewer, CdProfile *profile)
guint filesize;
gboolean show_section = FALSE;
GError *error = NULL;
+#if CD_CHECK_VERSION(0,1,25)
+ gchar **warnings;
+ guint i;
+ CdProfileWarning warning;
+ GString *str;
+#endif
/* connect to the profile */
ret = cd_profile_connect_sync (profile, NULL, &error);
@@ -1074,6 +1138,35 @@ gcm_viewer_set_profile (GcmViewerPrivate *viewer, CdProfile *profile)
gtk_label_set_label (GTK_LABEL (widget), temp);
g_free (temp);
+ /* set warnings */
+ widget = GTK_WIDGET (gtk_builder_get_object (viewer->builder, "hbox_warnings"));
+#if CD_CHECK_VERSION(0,1,25)
+ warnings = cd_profile_get_warnings (profile);
+ size = g_strv_length (warnings);
+ if (size == 0) {
+ gtk_widget_set_visible (widget, FALSE);
+ } else {
+ gtk_widget_set_visible (widget, TRUE);
+ widget = GTK_WIDGET (gtk_builder_get_object (viewer->builder, "label_warnings"));
+ str = g_string_new ("");
+ /* TRANSLATORS: profiles that have warnings are useable,
+ * but may not be any good */
+ g_string_append_printf (str, "%s\n", _("The profile has the following problems:"));
+ for (i = 0; i < size; i++) {
+ g_debug ("warnings[i]=%s", warnings[i]);
+ warning = cd_profile_warning_from_string (warnings[i]);
+ g_string_append_printf (str, "â %s\n",
+ gcm_profile_warning_to_string (warning));
+ }
+ if (str->len > 0)
+ g_string_set_size (str, str->len - 1);
+ gtk_label_set_label (GTK_LABEL (widget), str->str);
+ g_string_free (str, TRUE);
+ }
+#else
+ gtk_widget_set_visible (widget, FALSE);
+#endif
+
/* set profile version */
filename = gcm_profile_get_version (gcm_profile);
widget = GTK_WIDGET (gtk_builder_get_object (viewer->builder,
@@ -1668,6 +1761,10 @@ gcm_viewer_startup_cb (GApplication *application, GcmViewerPrivate *viewer)
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_warnings"));
+ 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");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]