[gnome-color-manager] trivial: Only show the profile graphs if we have valid CIE co-ordinates
- From: Richard Hughes <rhughes src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] trivial: Only show the profile graphs if we have valid CIE co-ordinates
- Date: Wed, 30 Dec 2009 16:05:20 +0000 (UTC)
commit e4893242f73aa711c7ddddc6b2e8795a548520e3
Author: Richard Hughes <richard hughsie com>
Date: Wed Dec 30 13:33:58 2009 +0000
trivial: Only show the profile graphs if we have valid CIE co-ordinates
data/gcm-prefs.ui | 2 +-
src/gcm-prefs.c | 30 +++++++++++++++++++++---------
2 files changed, 22 insertions(+), 10 deletions(-)
---
diff --git a/data/gcm-prefs.ui b/data/gcm-prefs.ui
index ad549fa..0f4bf7b 100644
--- a/data/gcm-prefs.ui
+++ b/data/gcm-prefs.ui
@@ -1080,7 +1080,7 @@
</packing>
</child>
<child>
- <object class="GtkVBox" id="vbox2">
+ <object class="GtkVBox" id="vbox_profile_graphs">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
diff --git a/src/gcm-prefs.c b/src/gcm-prefs.c
index 08d3199..903834a 100644
--- a/src/gcm-prefs.c
+++ b/src/gcm-prefs.c
@@ -1556,6 +1556,8 @@ gcm_prefs_profiles_treeview_clicked_cb (GtkTreeSelection *selection, gpointer us
gboolean ret;
guint size = 0;
guint filesize;
+ gfloat x;
+ gboolean show_section = FALSE;
/* This will only work in single or browse selection mode! */
if (!gtk_tree_selection_get_selected (selection, &model, &iter)) {
@@ -1584,12 +1586,20 @@ gcm_prefs_profiles_treeview_clicked_cb (GtkTreeSelection *selection, gpointer us
"luminance-blue", &blue,
NULL);
- g_object_set (cie_widget,
- "white", white,
- "red", red,
- "green", green,
- "blue", blue,
- NULL);
+ /* check we have enough data for the CIE widget */
+ x = gcm_xyz_get_x (red);
+ if (x > 0.001) {
+ g_object_set (cie_widget,
+ "white", white,
+ "red", red,
+ "green", green,
+ "blue", blue,
+ NULL);
+ gtk_widget_show (cie_widget);
+ show_section = TRUE;
+ } else {
+ gtk_widget_hide (cie_widget);
+ }
/* get curve data */
clut = gcm_profile_generate_curve (profile, 256);
@@ -1607,13 +1617,11 @@ gcm_prefs_profiles_treeview_clicked_cb (GtkTreeSelection *selection, gpointer us
"clut", clut,
NULL);
gtk_widget_show (trc_widget);
+ show_section = TRUE;
} else {
gtk_widget_hide (trc_widget);
}
- /* ensure showing */
- gtk_widget_show (cie_widget);
-
/* set type */
widget = GTK_WIDGET (gtk_builder_get_object (builder, "hbox_type"));
if (profile_type == GCM_PROFILE_TYPE_UNKNOWN) {
@@ -1702,6 +1710,10 @@ gcm_prefs_profiles_treeview_clicked_cb (GtkTreeSelection *selection, gpointer us
widget = GTK_WIDGET (gtk_builder_get_object (builder, "button_profile_delete"));
gtk_widget_set_sensitive (widget, ret);
+ /* should we show the pane at all */
+ widget = GTK_WIDGET (gtk_builder_get_object (builder, "vbox_profile_graphs"));
+ gtk_widget_set_visible (widget, show_section);
+
if (clut != NULL)
g_object_unref (clut);
g_object_unref (white);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]