[gnome-color-manager] trivial: Move the picker measure button into the headerbar



commit 9b303389820b41f468b5fa32834c523b1e3118d5
Author: Richard Hughes <richard hughsie com>
Date:   Tue Jan 27 10:01:12 2015 +0000

    trivial: Move the picker measure button into the headerbar

 data/gcm-picker.ui |  142 ++++++++++++++++++++-------------------------------
 src/gcm-picker.c   |   36 +------------
 2 files changed, 58 insertions(+), 120 deletions(-)
---
diff --git a/data/gcm-picker.ui b/data/gcm-picker.ui
index cc2252b..e271a09 100644
--- a/data/gcm-picker.ui
+++ b/data/gcm-picker.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.16.0 on Tue Oct  8 14:06:49 2013 
+<!-- Generated with glade 3.18.1 
 
 GNOME Color Manager
 Copyright (C) 2011-2013 Richard Hughes <richard hughsie com>
@@ -20,27 +20,33 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
 -->
 <interface>
-  <!-- interface-requires gtk+ 3.10 -->
+  <requires lib="gtk+" version="3.10"/>
   <object class="GtkDialog" id="dialog_picker">
     <property name="can_focus">False</property>
     <property name="border_width">3</property>
     <property name="title" translatable="yes" comments="Window title, where the user can pick spot colors 
using a measuring device">Color Picker</property>
     <property name="icon_name">gnome-color-manager</property>
     <property name="type_hint">dialog</property>
-    <child type="titlebar">
-      <object class="GtkHeaderBar" id="headerbar">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="show-close-button">True</property>
-        <property name="title" translatable="yes">Color Picker</property>
-      </object>
-    </child>
     <child internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox1">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
+        <property name="margin_left">12</property>
+        <property name="margin_right">12</property>
+        <property name="margin_top">12</property>
+        <property name="margin_bottom">12</property>
         <property name="orientation">vertical</property>
         <property name="spacing">2</property>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox" id="dialog-action_area1">
+            <property name="can_focus">False</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
         <child>
           <object class="GtkBox" id="box1">
             <property name="visible">True</property>
@@ -48,37 +54,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
             <property name="orientation">vertical</property>
             <property name="spacing">9</property>
             <child>
-              <object class="GtkBox" id="box2">
+              <object class="GtkImage" id="image_preview">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="spacing">24</property>
-                <child>
-                  <object class="GtkImage" id="image_preview">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                  </object>
-                  <packing>
-                    <property name="expand">True</property>
-                    <property name="fill">True</property>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkButton" id="button_measure">
-                    <property name="label" translatable="yes" comments="Button text, to get a single sample 
of color">_Measure</property>
-                    <property name="use_action_appearance">False</property>
-                    <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">True</property>
-                    <property name="use_underline">True</property>
-                    <property name="image_position">top</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="position">1</property>
-                  </packing>
-                </child>
+                <property name="hexpand">True</property>
+                <property name="vexpand">True</property>
               </object>
               <packing>
                 <property name="expand">True</property>
@@ -101,22 +81,20 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
                       <object class="GtkLabel" id="label_xyz">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="xalign">0</property>
                         <property name="selectable">True</property>
+                        <property name="xalign">0</property>
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
                         <property name="top_attach">0</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                     <child>
                       <object class="GtkLabel" id="label_xyz_title">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="xalign">1</property>
                         <property name="label" translatable="yes" comments="the color 
representation">XYZ</property>
+                        <property name="xalign">1</property>
                         <style>
                           <class name="dim-label"/>
                         </style>
@@ -124,16 +102,14 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
                       <packing>
                         <property name="left_attach">0</property>
                         <property name="top_attach">0</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                     <child>
                       <object class="GtkLabel" id="label_lab_title">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="xalign">1</property>
                         <property name="label" translatable="yes" comments="Lab is the color representation 
and D50 is the white point">Lab (D50)</property>
+                        <property name="xalign">1</property>
                         <style>
                           <class name="dim-label"/>
                         </style>
@@ -141,16 +117,14 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
                       <packing>
                         <property name="left_attach">0</property>
                         <property name="top_attach">1</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                     <child>
                       <object class="GtkLabel" id="label_whitepoint_title">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="xalign">1</property>
                         <property name="label" translatable="yes" comments="This refers to the amount of 
ambient light on the sensor">Media whitepoint</property>
+                        <property name="xalign">1</property>
                         <style>
                           <class name="dim-label"/>
                         </style>
@@ -158,16 +132,14 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
                       <packing>
                         <property name="left_attach">0</property>
                         <property name="top_attach">2</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                     <child>
                       <object class="GtkLabel" id="label_temperature_title">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="xalign">1</property>
                         <property name="label" translatable="yes" comments="This refers to the amount of 
ambient light on the sensor">Color Temperature</property>
+                        <property name="xalign">1</property>
                         <style>
                           <class name="dim-label"/>
                         </style>
@@ -175,16 +147,14 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
                       <packing>
                         <property name="left_attach">0</property>
                         <property name="top_attach">3</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                     <child>
                       <object class="GtkLabel" id="label_ambient_title">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="xalign">1</property>
                         <property name="label" translatable="yes" comments="This refers to the amount of 
ambient light on the sensor">Ambient</property>
+                        <property name="xalign">1</property>
                         <style>
                           <class name="dim-label"/>
                         </style>
@@ -192,16 +162,14 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
                       <packing>
                         <property name="left_attach">0</property>
                         <property name="top_attach">4</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                     <child>
                       <object class="GtkLabel" id="label_colorspace">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="xalign">1</property>
                         <property name="label" translatable="yes" comments="This is the title to a combobox 
that switches the RGB conversion between different colorspaces such as Adobe RGB and 
sRGB">Colorspace</property>
+                        <property name="xalign">1</property>
                         <style>
                           <class name="dim-label"/>
                         </style>
@@ -209,16 +177,14 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
                       <packing>
                         <property name="left_attach">0</property>
                         <property name="top_attach">5</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                     <child>
                       <object class="GtkLabel" id="label_rgb_title">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="xalign">1</property>
                         <property name="label" translatable="yes" comments="These are the values of the 
chosen color in Red, Green, Blue encoding">RGB</property>
+                        <property name="xalign">1</property>
                         <style>
                           <class name="dim-label"/>
                         </style>
@@ -226,16 +192,14 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
                       <packing>
                         <property name="left_attach">0</property>
                         <property name="top_attach">6</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                     <child>
                       <object class="GtkLabel" id="label_error_title">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="xalign">1</property>
                         <property name="label" translatable="yes" comments="This shows the error in the 
conversion to RGB.">Error</property>
+                        <property name="xalign">1</property>
                         <style>
                           <class name="dim-label"/>
                         </style>
@@ -243,50 +207,42 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
                       <packing>
                         <property name="left_attach">0</property>
                         <property name="top_attach">7</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                     <child>
                       <object class="GtkLabel" id="label_lab">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="xalign">0</property>
                         <property name="selectable">True</property>
+                        <property name="xalign">0</property>
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
                         <property name="top_attach">1</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                     <child>
                       <object class="GtkLabel" id="label_whitepoint">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="xalign">0</property>
                         <property name="selectable">True</property>
+                        <property name="xalign">0</property>
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
                         <property name="top_attach">2</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                     <child>
                       <object class="GtkLabel" id="label_ambient">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="xalign">0</property>
                         <property name="selectable">True</property>
+                        <property name="xalign">0</property>
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
                         <property name="top_attach">4</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                     <child>
@@ -297,50 +253,42 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
                       <packing>
                         <property name="left_attach">1</property>
                         <property name="top_attach">5</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                     <child>
                       <object class="GtkLabel" id="label_rgb">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="xalign">0</property>
                         <property name="selectable">True</property>
+                        <property name="xalign">0</property>
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
                         <property name="top_attach">6</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                     <child>
                       <object class="GtkLabel" id="label_temperature">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="xalign">0</property>
                         <property name="selectable">True</property>
+                        <property name="xalign">0</property>
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
                         <property name="top_attach">3</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                     <child>
                       <object class="GtkLabel" id="label_error">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="xalign">0</property>
                         <property name="selectable">True</property>
+                        <property name="xalign">0</property>
                       </object>
                       <packing>
                         <property name="left_attach">1</property>
                         <property name="top_attach">7</property>
-                        <property name="width">1</property>
-                        <property name="height">1</property>
                       </packing>
                     </child>
                   </object>
@@ -371,5 +319,27 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
         </child>
       </object>
     </child>
+    <child type="titlebar">
+      <object class="GtkHeaderBar" id="headerbar">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="title">Color Picker</property>
+        <property name="show_close_button">True</property>
+        <child>
+          <object class="GtkButton" id="button_measure">
+            <property name="label" translatable="yes" comments="Button text, to get a single sample of 
color">_Measure</property>
+            <property name="use_action_appearance">False</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+            <property name="use_underline">True</property>
+            <property name="image_position">top</property>
+            <style>
+              <class name="suggested-action"/>
+            </style>
+          </object>
+        </child>
+      </object>
+    </child>
   </object>
 </interface>
diff --git a/src/gcm-picker.c b/src/gcm-picker.c
index 6973681..e649b9f 100644
--- a/src/gcm-picker.c
+++ b/src/gcm-picker.c
@@ -1,6 +1,6 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
  *
- * Copyright (C) 2010 Richard Hughes <richard hughsie com>
+ * Copyright (C) 2010-2015 Richard Hughes <richard hughsie com>
  *
  * Licensed under the GNU General Public License Version 2
  *
@@ -346,26 +346,6 @@ out:
 }
 
 /**
- * gcm_picker_close_cb:
- **/
-static void
-gcm_picker_close_cb (GtkWidget *widget, gpointer data)
-{
-       GtkApplication *application = (GtkApplication *) data;
-       g_application_release (G_APPLICATION (application));
-}
-
-/**
- * gcm_picker_delete_event_cb:
- **/
-static gboolean
-gcm_picker_delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data)
-{
-       gcm_picker_close_cb (widget, data);
-       return FALSE;
-}
-
-/**
  * gcm_picker_sensor_client_setup_ui:
  **/
 static void
@@ -718,13 +698,6 @@ gcm_picker_startup_cb (GApplication *application, gpointer user_data)
        main_window = GTK_WIDGET (gtk_builder_get_object (builder, "dialog_picker"));
        gtk_application_add_window (GTK_APPLICATION (application), GTK_WINDOW (main_window));
        gtk_window_set_icon_name (GTK_WINDOW (main_window), GCM_STOCK_ICON);
-       g_signal_connect (main_window, "delete_event",
-                         G_CALLBACK (gcm_picker_delete_event_cb), application);
-
-       widget = GTK_WIDGET (gtk_builder_get_object (builder, "button_close"));
-       g_signal_connect (widget, "clicked",
-                         G_CALLBACK (gcm_picker_close_cb), application);
-
 
        widget = GTK_WIDGET (gtk_builder_get_object (builder, "button_measure"));
        g_signal_connect (widget, "clicked",
@@ -760,9 +733,7 @@ gcm_picker_startup_cb (GApplication *application, gpointer user_data)
 
        /* maintain a list of profiles */
        client = cd_client_new ();
-       ret = cd_client_connect_sync (client,
-                                     NULL,
-                                     &error);
+       ret = cd_client_connect_sync (client, NULL, &error);
        if (!ret) {
                g_warning ("failed to connect to colord: %s",
                           error->message);
@@ -784,9 +755,6 @@ gcm_picker_startup_cb (GApplication *application, gpointer user_data)
        g_signal_connect (G_OBJECT (widget), "changed",
                          G_CALLBACK (gcm_prefs_space_combo_changed_cb), NULL);
 
-       /* setup results expander */
-//     gcm_picker_refresh_results (NULL);
-
        /* setup initial preview window */
        widget = GTK_WIDGET (gtk_builder_get_object (builder, "image_preview"));
        gtk_image_set_from_file (GTK_IMAGE (widget), DATADIR 
"/icons/hicolor/64x64/apps/gnome-color-manager.png");


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