[gnome-color-manager] Redo the graph UI in the profiles page to be more HUG friendly



commit 34a4c3ad847607e940ba80bac6cd6c3a0de7117d
Author: Richard Hughes <richard hughsie com>
Date:   Fri Jun 11 11:19:08 2010 +0100

    Redo the graph UI in the profiles page to be more HUG friendly

 data/gcm-prefs.ui                        |  427 +++++++++++++++++++++++-------
 data/org.gnome.color-manager.gschema.xml |    5 +
 src/gcm-prefs.c                          |  136 +++++++++-
 src/gcm-utils.h                          |    1 +
 4 files changed, 463 insertions(+), 106 deletions(-)
---
diff --git a/data/gcm-prefs.ui b/data/gcm-prefs.ui
index 8dc426d..5a8534b 100644
--- a/data/gcm-prefs.ui
+++ b/data/gcm-prefs.ui
@@ -798,7 +798,322 @@
                                       <object class="GtkVBox" id="vbox_profiles_details">
                                         <property name="visible">True</property>
                                         <property name="orientation">vertical</property>
-                                        <property name="spacing">9</property>
+                                        <property name="spacing">3</property>
+                                        <child>
+                                          <object class="GtkVBox" id="vbox_graph">
+                                            <property name="visible">True</property>
+                                            <property name="orientation">vertical</property>
+                                            <property name="spacing">3</property>
+                                            <child>
+                                              <object class="GtkHBox" id="hbox_graph">
+                                                <property name="visible">True</property>
+                                                <property name="spacing">12</property>
+                                                <child>
+                                                  <object class="GtkHBox" id="hbox19">
+                                                    <property name="visible">True</property>
+                                                    <child>
+                                                      <object class="GtkLabel" id="label_title_graph">
+                                                        <property name="visible">True</property>
+                                                        <property name="label" translatable="yes" comments="The graph representing the profile">Graph:</property>
+                                                        <attributes>
+                                                          <attribute name="weight" value="bold"/>
+                                                        </attributes>
+                                                      </object>
+                                                      <packing>
+                                                        <property name="expand">False</property>
+                                                        <property name="pack_type">end</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="hbox38">
+                                                    <property name="visible">True</property>
+                                                    <child>
+                                                      <object class="GtkComboBox" id="combobox_graph">
+                                                        <property name="visible">True</property>
+                                                      </object>
+                                                      <packing>
+                                                        <property name="position">0</property>
+                                                      </packing>
+                                                    </child>
+                                                  </object>
+                                                  <packing>
+                                                    <property name="expand">False</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">0</property>
+                                              </packing>
+                                            </child>
+                                            <child>
+                                              <object class="GtkHBox" id="hbox_graph_widgets">
+                                                <child>
+                                                  <object class="GtkHBox" id="hbox61">
+                                                    <property name="visible">True</property>
+                                                    <child>
+                                                      <object class="GtkLabel" id="label_title_graph1">
+                                                        <property name="visible">True</property>
+                                                        <attributes>
+                                                          <attribute name="weight" value="bold"/>
+                                                        </attributes>
+                                                      </object>
+                                                      <packing>
+                                                        <property name="expand">False</property>
+                                                        <property name="pack_type">end</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="hbox60">
+                                                    <property name="visible">True</property>
+                                                    <child>
+                                                      <object class="GtkVBox" id="vbox_cie_axis">
+                                                        <property name="orientation">vertical</property>
+                                                        <child>
+                                                          <object class="GtkHBox" id="hbox_cie_axis">
+                                                            <property name="visible">True</property>
+                                                            <child>
+                                                            <object class="GtkLabel" id="label17">
+                                                            <property name="visible">True</property>
+                                                            <property name="label" translatable="yes" comments="The CIE axis label, not to be confused with 'Y'">y</property>
+                                                            <property name="angle">90</property>
+                                                            </object>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <object class="GtkAspectFrame" id="aspectframe_cie">
+                                                            <property name="visible">True</property>
+                                                            <property name="label_xalign">0</property>
+                                                            <property name="shadow_type">none</property>
+                                                            <property name="obey_child">False</property>
+                                                            <child>
+                                                            <object class="GtkHBox" id="hbox_cie_widget">
+                                                            <property name="visible">True</property>
+                                                            <child>
+                                                            <object class="GtkLabel" id="label3">
+                                                            <property name="visible">True</property>
+                                                            </object>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            </object>
+                                                            </child>
+                                                            </object>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                          </object>
+                                                          <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                          </packing>
+                                                        </child>
+                                                        <child>
+                                                          <object class="GtkLabel" id="label18">
+                                                            <property name="visible">True</property>
+                                                            <property name="label" translatable="yes" comments="The CIE axis label, not to be confused with 'X'">x</property>
+                                                          </object>
+                                                          <packing>
+                                                            <property name="position">1</property>
+                                                          </packing>
+                                                        </child>
+                                                      </object>
+                                                      <packing>
+                                                        <property name="expand">False</property>
+                                                        <property name="fill">False</property>
+                                                        <property name="position">0</property>
+                                                      </packing>
+                                                    </child>
+                                                    <child>
+                                                      <object class="GtkVBox" id="vbox_trc_axis">
+                                                        <property name="orientation">vertical</property>
+                                                        <child>
+                                                          <object class="GtkHBox" id="hbox_trc_axis">
+                                                            <property name="visible">True</property>
+                                                            <child>
+                                                            <object class="GtkLabel" id="label7">
+                                                            <property name="visible">True</property>
+                                                            <property name="label" translatable="yes" comments="The TRC axis label">Response out</property>
+                                                            <property name="angle">90</property>
+                                                            </object>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <object class="GtkAspectFrame" id="aspectframe_trc">
+                                                            <property name="visible">True</property>
+                                                            <property name="label_xalign">0</property>
+                                                            <property name="shadow_type">none</property>
+                                                            <property name="obey_child">False</property>
+                                                            <child>
+                                                            <object class="GtkHBox" id="hbox_trc_widget">
+                                                            <property name="visible">True</property>
+                                                            <child>
+                                                            <object class="GtkLabel" id="label6">
+                                                            <property name="visible">True</property>
+                                                            </object>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            </object>
+                                                            </child>
+                                                            </object>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                          </object>
+                                                          <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                          </packing>
+                                                        </child>
+                                                        <child>
+                                                          <object class="GtkLabel" id="label16">
+                                                            <property name="visible">True</property>
+                                                            <property name="label" translatable="yes" comments="The TRC axis label">Response in</property>
+                                                          </object>
+                                                          <packing>
+                                                            <property name="position">1</property>
+                                                          </packing>
+                                                        </child>
+                                                      </object>
+                                                      <packing>
+                                                        <property name="expand">False</property>
+                                                        <property name="fill">False</property>
+                                                        <property name="position">1</property>
+                                                      </packing>
+                                                    </child>
+                                                    <child>
+                                                      <object class="GtkVBox" id="vbox_vcgt_axis">
+                                                        <property name="orientation">vertical</property>
+                                                        <child>
+                                                          <object class="GtkHBox" id="hbox_vcgt_axis">
+                                                            <property name="visible">True</property>
+                                                            <child>
+                                                            <object class="GtkLabel" id="label19">
+                                                            <property name="visible">True</property>
+                                                            <property name="label" translatable="yes" comments="The TRC axis label">Video card out</property>
+                                                            <property name="angle">90</property>
+                                                            </object>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <object class="GtkAspectFrame" id="aspectframe_vcgt">
+                                                            <property name="visible">True</property>
+                                                            <property name="label_xalign">0</property>
+                                                            <property name="shadow_type">none</property>
+                                                            <property name="obey_child">False</property>
+                                                            <child>
+                                                            <object class="GtkHBox" id="hbox_vcgt_widget">
+                                                            <property name="visible">True</property>
+                                                            <child>
+                                                            <object class="GtkLabel" id="label20">
+                                                            <property name="visible">True</property>
+                                                            </object>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            </object>
+                                                            </child>
+                                                            </object>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                          </object>
+                                                          <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                          </packing>
+                                                        </child>
+                                                        <child>
+                                                          <object class="GtkLabel" id="label21">
+                                                            <property name="visible">True</property>
+                                                            <property name="label" translatable="yes" comments="The TRC axis label">Response in</property>
+                                                          </object>
+                                                          <packing>
+                                                            <property name="position">1</property>
+                                                          </packing>
+                                                        </child>
+                                                      </object>
+                                                      <packing>
+                                                        <property name="expand">False</property>
+                                                        <property name="fill">False</property>
+                                                        <property name="position">2</property>
+                                                      </packing>
+                                                    </child>
+                                                  </object>
+                                                  <packing>
+                                                    <property name="position">1</property>
+                                                  </packing>
+                                                </child>
+                                              </object>
+                                              <packing>
+                                                <property name="position">1</property>
+                                              </packing>
+                                            </child>
+                                            <child>
+                                              <object class="GtkHSeparator" id="hseparator2">
+                                                <property name="visible">True</property>
+                                              </object>
+                                              <packing>
+                                                <property name="expand">False</property>
+                                                <property name="position">2</property>
+                                              </packing>
+                                            </child>
+                                          </object>
+                                          <packing>
+                                            <property name="position">0</property>
+                                          </packing>
+                                        </child>
                                         <child>
                                           <object class="GtkVBox" id="vbox_profiles_details1">
                                             <property name="visible">True</property>
@@ -960,6 +1275,7 @@
                                                     </child>
                                                   </object>
                                                   <packing>
+                                                    <property name="expand">False</property>
                                                     <property name="position">1</property>
                                                   </packing>
                                                 </child>
@@ -1016,6 +1332,7 @@
                                                     </child>
                                                   </object>
                                                   <packing>
+                                                    <property name="expand">False</property>
                                                     <property name="position">1</property>
                                                   </packing>
                                                 </child>
@@ -1072,6 +1389,7 @@
                                                     </child>
                                                   </object>
                                                   <packing>
+                                                    <property name="expand">False</property>
                                                     <property name="position">1</property>
                                                   </packing>
                                                 </child>
@@ -1128,6 +1446,7 @@
                                                     </child>
                                                   </object>
                                                   <packing>
+                                                    <property name="expand">False</property>
                                                     <property name="position">1</property>
                                                   </packing>
                                                 </child>
@@ -1184,6 +1503,7 @@
                                                     </child>
                                                   </object>
                                                   <packing>
+                                                    <property name="expand">False</property>
                                                     <property name="position">1</property>
                                                   </packing>
                                                 </child>
@@ -1240,6 +1560,7 @@
                                                     </child>
                                                   </object>
                                                   <packing>
+                                                    <property name="expand">False</property>
                                                     <property name="position">1</property>
                                                   </packing>
                                                 </child>
@@ -1311,7 +1632,7 @@
                                             </child>
                                           </object>
                                           <packing>
-                                            <property name="position">0</property>
+                                            <property name="position">1</property>
                                           </packing>
                                         </child>
                                       </object>
@@ -1324,93 +1645,9 @@
                                 </child>
                               </object>
                               <packing>
-                                <property name="expand">False</property>
                                 <property name="position">0</property>
                               </packing>
                             </child>
-                            <child>
-                              <object class="GtkExpander" id="expander_profile_graphs">
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <child>
-                                  <object class="GtkAlignment" id="alignment6">
-                                    <property name="visible">True</property>
-                                    <property name="left_padding">12</property>
-                                    <child>
-                                      <object class="GtkHBox" id="hbox52">
-                                        <property name="visible">True</property>
-                                        <child>
-                                          <object class="GtkAspectFrame" id="aspectframe1">
-                                            <property name="visible">True</property>
-                                            <property name="label_xalign">0</property>
-                                            <property name="shadow_type">none</property>
-                                            <child>
-                                              <object class="GtkHBox" id="hbox_cie_widget">
-                                                <property name="visible">True</property>
-                                                <child>
-                                                  <object class="GtkLabel" id="label3">
-                                                    <property name="visible">True</property>
-                                                  </object>
-                                                  <packing>
-                                                    <property name="expand">False</property>
-                                                    <property name="fill">False</property>
-                                                    <property name="position">0</property>
-                                                  </packing>
-                                                </child>
-                                              </object>
-                                            </child>
-                                          </object>
-                                          <packing>
-                                            <property name="expand">False</property>
-                                            <property name="position">0</property>
-                                          </packing>
-                                        </child>
-                                        <child>
-                                          <object class="GtkAspectFrame" id="aspectframe2">
-                                            <property name="visible">True</property>
-                                            <property name="label_xalign">0</property>
-                                            <property name="shadow_type">none</property>
-                                            <child>
-                                              <object class="GtkHBox" id="hbox_trc_widget">
-                                                <property name="visible">True</property>
-                                                <child>
-                                                  <object class="GtkLabel" id="label6">
-                                                    <property name="visible">True</property>
-                                                  </object>
-                                                  <packing>
-                                                    <property name="expand">False</property>
-                                                    <property name="fill">False</property>
-                                                    <property name="position">0</property>
-                                                  </packing>
-                                                </child>
-                                              </object>
-                                            </child>
-                                          </object>
-                                          <packing>
-                                            <property name="expand">False</property>
-                                            <property name="position">1</property>
-                                          </packing>
-                                        </child>
-                                      </object>
-                                    </child>
-                                  </object>
-                                </child>
-                                <child type="label">
-                                  <object class="GtkLabel" id="label7">
-                                    <property name="visible">True</property>
-                                    <property name="label" translatable="yes">Profile Graphs</property>
-                                    <attributes>
-                                      <attribute name="weight" value="bold"/>
-                                    </attributes>
-                                  </object>
-                                </child>
-                              </object>
-                              <packing>
-                                <property name="expand">False</property>
-                                <property name="fill">False</property>
-                                <property name="position">1</property>
-                              </packing>
-                            </child>
                           </object>
                           <packing>
                             <property name="position">0</property>
@@ -2331,15 +2568,17 @@
   </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"/>
+      <widget name="hbox19"/>
+      <widget name="hbox61"/>
     </widgets>
   </object>
   <object class="GtkSizeGroup" id="sizegroup_combos">
diff --git a/data/org.gnome.color-manager.gschema.xml b/data/org.gnome.color-manager.gschema.xml
index 9211b3a..e3b31ef 100644
--- a/data/org.gnome.color-manager.gschema.xml
+++ b/data/org.gnome.color-manager.gschema.xml
@@ -80,5 +80,10 @@
       <summary>If CUPS support is enabled</summary>
       <description>This allows the user to disable printer support if attached devices fail when probed.</description>
     </key>
+    <key name="profile-graph-type" type="s">
+      <default>'cie-1931-xy'</default>
+      <summary>The graph type to show in the properties page</summary>
+      <description>The graph type in the properties page. This should not be changed manually as this is set from the UI.</description>
+    </key>
   </schema>
 </schemalist>
diff --git a/src/gcm-prefs.c b/src/gcm-prefs.c
index fbc4fb0..54a42da 100644
--- a/src/gcm-prefs.c
+++ b/src/gcm-prefs.c
@@ -60,6 +60,7 @@ static GtkWidget *info_bar_vcgt = NULL;
 static GtkWidget *info_bar_profiles = NULL;
 static GtkWidget *cie_widget = NULL;
 static GtkWidget *trc_widget = NULL;
+static GtkWidget *vcgt_widget = NULL;
 static GSettings *settings = NULL;
 
 enum {
@@ -1988,7 +1989,8 @@ gcm_prefs_profiles_treeview_clicked_cb (GtkTreeSelection *selection, gpointer us
 	GtkTreeIter iter;
 	GtkWidget *widget;
 	GcmProfile *profile;
-	GcmClut *clut = NULL;
+	GcmClut *clut_trc = NULL;
+	GcmClut *clut_vcgt = NULL;
 	GcmXyz *white;
 	GcmXyz *red;
 	GcmXyz *green;
@@ -2047,14 +2049,14 @@ gcm_prefs_profiles_treeview_clicked_cb (GtkTreeSelection *selection, gpointer us
 	}
 
 	/* get curve data */
-	clut = gcm_profile_generate_curve (profile, 256);
+	clut_trc = gcm_profile_generate_curve (profile, 256);
 
 	/* only show if there is useful information */
-	if (clut != NULL)
-		size = gcm_clut_get_size (clut);
+	if (clut_trc != NULL)
+		size = gcm_clut_get_size (clut_trc);
 	if (size > 0) {
 		g_object_set (trc_widget,
-			      "clut", clut,
+			      "clut", clut_trc,
 			      NULL);
 		gtk_widget_show (trc_widget);
 		show_section = TRUE;
@@ -2062,6 +2064,22 @@ gcm_prefs_profiles_treeview_clicked_cb (GtkTreeSelection *selection, gpointer us
 		gtk_widget_hide (trc_widget);
 	}
 
+	/* get vcgt data */
+	clut_vcgt = gcm_profile_generate_vcgt (profile, 256);
+
+	/* only show if there is useful information */
+	if (clut_vcgt != NULL)
+		size = gcm_clut_get_size (clut_vcgt);
+	if (size > 0) {
+		g_object_set (vcgt_widget,
+			      "clut", clut_vcgt,
+			      NULL);
+		gtk_widget_show (vcgt_widget);
+		show_section = TRUE;
+	} else {
+		gtk_widget_hide (vcgt_widget);
+	}
+
 	/* set kind */
 	widget = GTK_WIDGET (gtk_builder_get_object (builder, "hbox_type"));
 	profile_kind = gcm_profile_get_kind (profile);
@@ -2178,13 +2196,15 @@ gcm_prefs_profiles_treeview_clicked_cb (GtkTreeSelection *selection, gpointer us
 	}
 
 	/* should we show the pane at all */
-	widget = GTK_WIDGET (gtk_builder_get_object (builder, "expander_profile_graphs"));
+	widget = GTK_WIDGET (gtk_builder_get_object (builder, "vbox_graph"));
 	gtk_widget_set_visible (widget, show_section);
 	widget = GTK_WIDGET (gtk_builder_get_object (builder, "vbox_profile_info"));
 	gtk_widget_set_visible (widget, TRUE);
 
-	if (clut != NULL)
-		g_object_unref (clut);
+	if (clut_trc != NULL)
+		g_object_unref (clut_trc);
+	if (clut_vcgt != NULL)
+		g_object_unref (clut_vcgt);
 	g_object_unref (white);
 	g_object_unref (red);
 	g_object_unref (green);
@@ -3080,6 +3100,80 @@ gcm_prefs_setup_virtual_combobox (GtkWidget *widget)
 	gtk_combo_box_set_active (GTK_COMBO_BOX (widget), GCM_DEVICE_KIND_PRINTER - 2);
 }
 
+
+/**
+ * gcm_prefs_graph_combo_changed_cb:
+ **/
+static void
+gcm_prefs_graph_combo_changed_cb (GtkWidget *widget, gpointer data)
+{
+	gint active;
+	const gchar *value = "none";
+
+	/* no selection */
+	active = gtk_combo_box_get_active (GTK_COMBO_BOX(widget));
+	if (active == -1)
+		return;
+
+	/* hide or show the correct graphs */
+	widget = GTK_WIDGET (gtk_builder_get_object (builder, "hbox_graph_widgets"));
+	gtk_widget_set_visible (widget, active != 0);
+
+	/* hide or show the correct graphs */
+	widget = GTK_WIDGET (gtk_builder_get_object (builder, "vbox_cie_axis"));
+	gtk_widget_set_visible (widget, active == 1);
+
+	/* hide or show the correct graphs */
+	widget = GTK_WIDGET (gtk_builder_get_object (builder, "vbox_trc_axis"));
+	gtk_widget_set_visible (widget, active == 2);
+
+	/* hide or show the correct graphs */
+	widget = GTK_WIDGET (gtk_builder_get_object (builder, "vbox_vcgt_axis"));
+	gtk_widget_set_visible (widget, active == 3);
+
+	/* save to GSettings */
+	if (active == 1)
+		value = "cie-1931-xy";
+	else if (active == 2)
+		value = "trc";
+	else if (active == 3)
+		value = "vcgt";
+	egg_debug ("changed profile-graph-type to %s", value);
+	g_settings_set_string (settings, GCM_SETTINGS_PROFILE_GRAPH_TYPE, value);
+}
+
+/**
+ * gcm_prefs_setup_graph_combobox:
+ **/
+static void
+gcm_prefs_setup_graph_combobox (GtkWidget *widget)
+{
+	gchar *graph_type;
+	guint active = 0;
+
+	/* TRANSLATORS: combo-entry, no graph selected to be shown */
+	gtk_combo_box_append_text (GTK_COMBO_BOX(widget), _("None"));
+
+	/* TRANSLATORS: combo-entry, this is a graph plot type (look it up on google...) */
+	gtk_combo_box_append_text (GTK_COMBO_BOX(widget), _("CIE 1931 xy"));
+
+	/* TRANSLATORS: combo-entry, this is a graph plot type (what goes in, v.s. what goes out) */
+	gtk_combo_box_append_text (GTK_COMBO_BOX(widget), _("Transfer response curve"));
+
+	/* TRANSLATORS: combo-entry, this is a graph plot type (what data we snd the graphics card) */
+	gtk_combo_box_append_text (GTK_COMBO_BOX(widget), _("Video card gamma table"));
+
+	/* get from settings */
+	graph_type = g_settings_get_string (settings, GCM_SETTINGS_PROFILE_GRAPH_TYPE);
+	if (g_strcmp0 (graph_type, "cie-1931-xy") == 0)
+		active = 1;
+	if (g_strcmp0 (graph_type, "trc") == 0)
+		active = 2;
+	if (g_strcmp0 (graph_type, "vcgt") == 0)
+		active = 3;
+	gtk_combo_box_set_active (GTK_COMBO_BOX (widget), active);
+}
+
 /**
  * gpk_update_viewer_notify_network_state_cb:
  **/
@@ -3160,6 +3254,9 @@ main (int argc, char **argv)
 	g_signal_connect (application, "prepare-activation",
 			  G_CALLBACK (gcm_prefs_application_prepare_action_cb), NULL);
 
+	/* setup defaults */
+	settings = g_settings_new (GCM_SETTINGS_SCHEMA);
+
 	/* get UI */
 	builder = gtk_builder_new ();
 	retval = gtk_builder_add_from_file (builder, GCM_DATA "/gcm-prefs.ui", &error);
@@ -3277,7 +3374,7 @@ main (int argc, char **argv)
 	gtk_widget_set_sensitive (widget, FALSE);
 
 	/* hidden until a profile is selected */
-	widget = GTK_WIDGET (gtk_builder_get_object (builder, "expander_profile_graphs"));
+	widget = GTK_WIDGET (gtk_builder_get_object (builder, "vbox_graph"));
 	gtk_widget_set_visible (widget, FALSE);
 	widget = GTK_WIDGET (gtk_builder_get_object (builder, "vbox_profile_info"));
 	gtk_widget_set_visible (widget, FALSE);
@@ -3315,6 +3412,12 @@ main (int argc, char **argv)
 	gcm_prefs_set_combo_simple_text (widget);
 	gcm_prefs_setup_virtual_combobox (widget);
 
+	widget = GTK_WIDGET (gtk_builder_get_object (builder, "combobox_graph"));
+	gcm_prefs_set_combo_simple_text (widget);
+	gcm_prefs_setup_graph_combobox (widget);
+	g_signal_connect (widget, "changed",
+			  G_CALLBACK (gcm_prefs_graph_combo_changed_cb), (gpointer) "cmyk");
+
 	/* set up assign dialog */
 	widget = GTK_WIDGET (gtk_builder_get_object (builder, "dialog_assign"));
 	g_signal_connect (widget, "delete-event",
@@ -3389,15 +3492,23 @@ main (int argc, char **argv)
 	gtk_box_pack_start (GTK_BOX(widget), trc_widget, TRUE, TRUE, 0);
 	gtk_box_reorder_child (GTK_BOX(widget), trc_widget, 0);
 
+	/* use vcgt widget */
+	vcgt_widget = gcm_trc_widget_new ();
+	widget = GTK_WIDGET (gtk_builder_get_object (builder, "hbox_vcgt_widget"));
+	gtk_box_pack_start (GTK_BOX(widget), vcgt_widget, TRUE, TRUE, 0);
+	gtk_box_reorder_child (GTK_BOX(widget), vcgt_widget, 0);
+
 	/* do we set a default size to make the window larger? */
 	screen = gdk_screen_get_default ();
 	if (gdk_screen_get_width (screen) < 1024 ||
 	    gdk_screen_get_height (screen) < 768) {
 		gtk_widget_set_size_request (cie_widget, 50, 50);
 		gtk_widget_set_size_request (trc_widget, 50, 50);
+		gtk_widget_set_size_request (vcgt_widget, 50, 50);
 	} else {
 		gtk_widget_set_size_request (cie_widget, 200, 200);
 		gtk_widget_set_size_request (trc_widget, 200, 200);
+		gtk_widget_set_size_request (vcgt_widget, 200, 200);
 	}
 
 	/* use infobar */
@@ -3453,6 +3564,10 @@ main (int argc, char **argv)
 	/* show main UI */
 	gtk_widget_show (main_window);
 
+	/* refresh UI */
+	widget = GTK_WIDGET (gtk_builder_get_object (builder, "combobox_graph"));
+	gcm_prefs_graph_combo_changed_cb (widget, NULL);
+
 	/* connect up sliders */
 	widget = GTK_WIDGET (gtk_builder_get_object (builder, "hscale_contrast"));
 	g_signal_connect (widget, "value-changed",
@@ -3464,9 +3579,6 @@ main (int argc, char **argv)
 	g_signal_connect (widget, "value-changed",
 			  G_CALLBACK (gcm_prefs_slider_changed_cb), NULL);
 
-	/* setup defaults */
-	settings = g_settings_new (GCM_SETTINGS_SCHEMA);
-
 	/* connect up global widget */
 	widget = GTK_WIDGET (gtk_builder_get_object (builder, "checkbutton_display"));
 	g_settings_bind (settings,
diff --git a/src/gcm-utils.h b/src/gcm-utils.h
index 08268c6..b867406 100644
--- a/src/gcm-utils.h
+++ b/src/gcm-utils.h
@@ -51,6 +51,7 @@
 #define GCM_SETTINGS_RECALIBRATE_DISPLAY_THRESHOLD	"recalibrate-display-threshold"
 #define GCM_SETTINGS_ENABLE_SANE			"enable-sane"
 #define GCM_SETTINGS_ENABLE_CUPS			"enable-cups"
+#define GCM_SETTINGS_PROFILE_GRAPH_TYPE			"profile-graph-type"
 
 #define GCM_CONFIG_VERSION_ORIGINAL			0
 #define GCM_CONFIG_VERSION_SHARED_SPEC			1



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