[gnome-color-manager] Use the CIE widget in the prefs dialog



commit d67eec0818d0d57a7ed8340799d99cadcf14c603
Author: Richard Hughes <richard hughsie com>
Date:   Wed Dec 2 09:24:04 2009 +0000

    Use the CIE widget in the prefs dialog

 data/gcm-prefs.ui |  181 +++++++++++++++++++++++++++++------------------------
 src/gcm-prefs.c   |   44 +++++++++++++
 2 files changed, 143 insertions(+), 82 deletions(-)
---
diff --git a/data/gcm-prefs.ui b/data/gcm-prefs.ui
index 54d53cd..50821ff 100644
--- a/data/gcm-prefs.ui
+++ b/data/gcm-prefs.ui
@@ -323,155 +323,172 @@
                                   </packing>
                                 </child>
                                 <child>
-                                  <object class="GtkVBox" id="vbox_details">
+                                  <object class="GtkHBox" id="hbox_cie_widget">
                                     <property name="visible">True</property>
-                                    <property name="orientation">vertical</property>
+                                    <property name="spacing">6</property>
                                     <child>
-                                      <object class="GtkHBox" id="hbox_vendor">
+                                      <object class="GtkVBox" id="vbox_details">
                                         <property name="visible">True</property>
-                                        <property name="spacing">3</property>
+                                        <property name="orientation">vertical</property>
                                         <child>
-                                          <object class="GtkHBox" id="hbox5">
+                                          <object class="GtkHBox" id="hbox_vendor">
                                             <property name="visible">True</property>
+                                            <property name="spacing">3</property>
                                             <child>
-                                              <object class="GtkLabel" id="label_title_vendor">
+                                              <object class="GtkHBox" id="hbox5">
                                                 <property name="visible">True</property>
-                                                <property name="label" translatable="yes" comments="The manufacturer of the profile">Vendor:</property>
+                                                <child>
+                                                  <object class="GtkLabel" id="label_title_vendor">
+                                                    <property name="visible">True</property>
+                                                    <property name="label" translatable="yes" comments="The manufacturer of the profile">Vendor:</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>
-                                          </object>
-                                          <packing>
-                                            <property name="position">0</property>
-                                          </packing>
-                                        </child>
-                                        <child>
-                                          <object class="GtkHBox" id="hbox11">
-                                            <property name="visible">True</property>
                                             <child>
-                                              <object class="GtkLabel" id="label_vendor">
+                                              <object class="GtkHBox" id="hbox11">
                                                 <property name="visible">True</property>
-                                                <property name="label">vendor</property>
-                                                <property name="use_markup">True</property>
-                                                <property name="wrap">True</property>
+                                                <child>
+                                                  <object class="GtkLabel" id="label_vendor">
+                                                    <property name="visible">True</property>
+                                                    <property name="label">vendor</property>
+                                                    <property name="use_markup">True</property>
+                                                    <property name="wrap">True</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>
+                                                <property name="position">1</property>
                                               </packing>
                                             </child>
                                           </object>
                                           <packing>
-                                            <property name="position">1</property>
+                                            <property name="expand">False</property>
+                                            <property name="fill">False</property>
+                                            <property name="padding">3</property>
+                                            <property name="position">0</property>
                                           </packing>
                                         </child>
-                                      </object>
-                                      <packing>
-                                        <property name="padding">3</property>
-                                        <property name="position">0</property>
-                                      </packing>
-                                    </child>
-                                    <child>
-                                      <object class="GtkHBox" id="hbox_copyright">
-                                        <property name="visible">True</property>
-                                        <property name="spacing">3</property>
                                         <child>
-                                          <object class="GtkHBox" id="hbox10">
+                                          <object class="GtkHBox" id="hbox_copyright">
                                             <property name="visible">True</property>
+                                            <property name="spacing">3</property>
                                             <child>
-                                              <object class="GtkLabel" id="label_title_copyright">
+                                              <object class="GtkHBox" id="hbox10">
                                                 <property name="visible">True</property>
-                                                <property name="label" translatable="yes" comments="The licence of the profile, normally non-free">License:</property>
+                                                <child>
+                                                  <object class="GtkLabel" id="label_title_copyright">
+                                                    <property name="visible">True</property>
+                                                    <property name="label" translatable="yes" comments="The licence of the profile, normally non-free">License:</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>
-                                          </object>
-                                          <packing>
-                                            <property name="position">0</property>
-                                          </packing>
-                                        </child>
-                                        <child>
-                                          <object class="GtkHBox" id="hbox12">
-                                            <property name="visible">True</property>
                                             <child>
-                                              <object class="GtkLabel" id="label_copyright">
+                                              <object class="GtkHBox" id="hbox12">
                                                 <property name="visible">True</property>
-                                                <property name="label">non-free</property>
-                                                <property name="use_markup">True</property>
-                                                <property name="wrap">True</property>
+                                                <child>
+                                                  <object class="GtkLabel" id="label_copyright">
+                                                    <property name="visible">True</property>
+                                                    <property name="label">non-free</property>
+                                                    <property name="use_markup">True</property>
+                                                    <property name="wrap">True</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>
+                                                <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">1</property>
                                           </packing>
                                         </child>
-                                      </object>
-                                      <packing>
-                                        <property name="padding">3</property>
-                                        <property name="position">1</property>
-                                      </packing>
-                                    </child>
-                                    <child>
-                                      <object class="GtkHBox" id="hbox_type">
-                                        <property name="visible">True</property>
-                                        <property name="spacing">3</property>
                                         <child>
-                                          <object class="GtkHBox" id="hbox6">
+                                          <object class="GtkHBox" id="hbox_type">
                                             <property name="visible">True</property>
+                                            <property name="spacing">3</property>
                                             <child>
-                                              <object class="GtkLabel" id="label_title_type">
+                                              <object class="GtkHBox" id="hbox6">
                                                 <property name="visible">True</property>
-                                                <property name="label" translatable="yes" comments="The type of profile, e.g. display, scanner, etc.">Profile type:</property>
+                                                <child>
+                                                  <object class="GtkLabel" id="label_title_type">
+                                                    <property name="visible">True</property>
+                                                    <property name="label" translatable="yes" comments="The type of profile, e.g. display, scanner, etc.">Profile type:</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>
-                                          </object>
-                                          <packing>
-                                            <property name="position">0</property>
-                                          </packing>
-                                        </child>
-                                        <child>
-                                          <object class="GtkHBox" id="hbox18">
-                                            <property name="visible">True</property>
                                             <child>
-                                              <object class="GtkLabel" id="label_type">
+                                              <object class="GtkHBox" id="hbox18">
                                                 <property name="visible">True</property>
-                                                <property name="label">input</property>
-                                                <property name="use_markup">True</property>
-                                                <property name="wrap">True</property>
+                                                <child>
+                                                  <object class="GtkLabel" id="label_type">
+                                                    <property name="visible">True</property>
+                                                    <property name="label">input</property>
+                                                    <property name="use_markup">True</property>
+                                                    <property name="wrap">True</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>
+                                                <property name="position">1</property>
                                               </packing>
                                             </child>
                                           </object>
                                           <packing>
-                                            <property name="position">1</property>
+                                            <property name="expand">False</property>
+                                            <property name="fill">False</property>
+                                            <property name="padding">3</property>
+                                            <property name="position">2</property>
                                           </packing>
                                         </child>
                                       </object>
                                       <packing>
-                                        <property name="padding">3</property>
-                                        <property name="position">2</property>
+                                        <property name="position">0</property>
                                       </packing>
                                     </child>
                                   </object>
                                   <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
                                     <property name="position">1</property>
                                   </packing>
                                 </child>
diff --git a/src/gcm-prefs.c b/src/gcm-prefs.c
index 1923e37..9dad2ed 100644
--- a/src/gcm-prefs.c
+++ b/src/gcm-prefs.c
@@ -38,6 +38,8 @@
 #include "gcm-calibrate.h"
 #include "gcm-brightness.h"
 #include "gcm-client.h"
+#include "gcm-xyz.h"
+#include "gcm-cie-widget.h"
 
 static GtkBuilder *builder = NULL;
 static GtkListStore *list_store_devices = NULL;
@@ -49,6 +51,7 @@ static GUdevClient *client = NULL;
 static GcmClient *gcm_client = NULL;
 static gboolean setting_up_device = FALSE;
 static GtkWidget *info_bar = NULL;
+static GtkWidget *cie_widget = NULL;
 static guint loading_refcount = 0;
 static GConfClient *gconf_client = NULL;
 
@@ -1397,6 +1400,41 @@ gcm_prefs_profile_combo_changed_cb (GtkWidget *widget, gpointer data)
 			      "vendor", &vendor,
 			      "type", &profile_type,
 			      NULL);
+
+{
+	GcmXyz *white;
+	GcmXyz *red;
+	GcmXyz *green;
+	GcmXyz *blue;
+
+	g_object_get (profile,
+		      "white-point", &white,
+		      "luminance-red", &red,
+		      "luminance-green", &green,
+		      "luminance-blue", &blue,
+		      NULL);
+
+	g_object_set (cie_widget,
+		      "red-x", gcm_xyz_get_x (red),
+		      "red-y", gcm_xyz_get_y (red),
+		      "green-x", gcm_xyz_get_x (green),
+		      "green-y", gcm_xyz_get_y (green),
+		      "blue-x", gcm_xyz_get_x (blue),
+		      "blue-y", gcm_xyz_get_y (blue),
+		      "white-x", gcm_xyz_get_x (white),
+		      "white-y", gcm_xyz_get_y (white),
+		      NULL);
+
+	g_object_unref (white);
+	g_object_unref (red);
+	g_object_unref (green);
+	g_object_unref (blue);
+
+}
+
+		gtk_widget_show (cie_widget);
+	} else {
+		gtk_widget_hide (cie_widget);
 	}
 
 	/* set type */
@@ -2090,6 +2128,12 @@ main (int argc, char **argv)
 		gcm_window_set_parent_xid (GTK_WINDOW (main_window), xid);
 	}
 
+	/* use cie widget */
+	cie_widget = gcm_cie_widget_new ();
+	gtk_widget_set_size_request (cie_widget, 100, 100);
+	widget = GTK_WIDGET (gtk_builder_get_object (builder, "hbox_cie_widget"));
+	gtk_box_pack_start (GTK_BOX(widget), cie_widget, TRUE, TRUE, 0);
+
 	/* use infobar */
 	info_bar = gtk_info_bar_new ();
 



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