[gnome-control-center] color: Improve the 'Add profile' modal dialog



commit f4ac4f1a0fec0d0fe17fa65140971abf5d45fa28
Author: Richard Hughes <richard hughsie com>
Date:   Thu Oct 13 14:04:48 2011 +0100

    color: Improve the 'Add profile' modal dialog
    
    Remove the 'Only profiles that are compatible with...' lightbulb helper and
    instead just set the dialog title to include the device class, e.g.
    'Available Profiles for Printers'.
    
    Resolves https://bugzilla.gnome.org/show_bug.cgi?id=661657

 panels/color/cc-color-panel.c |   34 +++++++++++++-
 panels/color/color.ui         |  102 +++++++++++++++++++++--------------------
 2 files changed, 86 insertions(+), 50 deletions(-)
---
diff --git a/panels/color/cc-color-panel.c b/panels/color/cc-color-panel.c
index 210ddc1..39fdbcb 100644
--- a/panels/color/cc-color-panel.c
+++ b/panels/color/cc-color-panel.c
@@ -448,6 +448,7 @@ out:
 static void
 gcm_prefs_profile_add_cb (GtkWidget *widget, CcColorPanel *prefs)
 {
+  const gchar *title;
   CdProfile *profile = NULL;
   CcColorPanelPrivate *priv = prefs->priv;
 
@@ -457,6 +458,38 @@ gcm_prefs_profile_add_cb (GtkWidget *widget, CcColorPanel *prefs)
   profile = cd_device_get_default_profile (priv->current_device);
   gcm_prefs_add_profiles_suitable_for_devices (prefs, widget, profile);
 
+  /* set the title */
+  widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
+                                               "label_assign_title"));
+  switch (cd_device_get_kind (priv->current_device)) {
+    case CD_DEVICE_KIND_DISPLAY:
+      /* TRANSLATORS: this is the dialog title in the 'Add profile' UI */
+      title = _("Available Profiles for Displays");
+      break;
+    case CD_DEVICE_KIND_SCANNER:
+      /* TRANSLATORS: this is the dialog title in the 'Add profile' UI */
+      title = _("Available Profiles for Scanners");
+      break;
+    case CD_DEVICE_KIND_PRINTER:
+      /* TRANSLATORS: this is the dialog title in the 'Add profile' UI */
+      title = _("Available Profiles for Printers");
+      break;
+    case CD_DEVICE_KIND_CAMERA:
+      /* TRANSLATORS: this is the dialog title in the 'Add profile' UI */
+      title = _("Available Profiles for Cameras");
+      break;
+    case CD_DEVICE_KIND_WEBCAM:
+      /* TRANSLATORS: this is the dialog title in the 'Add profile' UI */
+      title = _("Available Profiles for Webcams");
+      break;
+    default:
+      /* TRANSLATORS: this is the dialog title in the 'Add profile' UI
+       * where the device type is not recognised */
+      title = _("Available Profiles");
+      break;
+  }
+  gtk_label_set_label (GTK_LABEL (widget), title);
+
   /* show the dialog */
   widget = GTK_WIDGET (gtk_builder_get_object (priv->builder,
                                                "dialog_assign"));
@@ -1089,7 +1122,6 @@ gcm_prefs_set_combo_simple_text (GtkWidget *combo_box)
   g_object_set (renderer,
                 "ellipsize", PANGO_ELLIPSIZE_END,
                 "wrap-mode", PANGO_WRAP_WORD_CHAR,
-                "width-chars", 60,
                 NULL);
   gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_box), renderer, TRUE);
   gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_box), renderer,
diff --git a/panels/color/color.ui b/panels/color/color.ui
index 6592657..6e84ad3 100644
--- a/panels/color/color.ui
+++ b/panels/color/color.ui
@@ -73,7 +73,7 @@
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <child>
-                  <object class="GtkLabel" id="label12">
+                  <object class="GtkLabel" id="label_assign_title">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="label" translatable="yes" comments="Profiles that can be added to the device">Available Profiles</property>
@@ -98,6 +98,7 @@
               <object class="GtkComboBox" id="combobox_profile">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
+                <property name="margin_right">5</property>
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -105,47 +106,9 @@
                 <property name="position">1</property>
               </packing>
             </child>
-            <child>
-              <object class="GtkHBox" id="hbox57">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="spacing">9</property>
-                <child>
-                  <object class="GtkImage" id="image2">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="stock">gtk-dialog-info</property>
-                    <property name="icon-size">6</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="label13">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="label" translatable="yes" comments="Some profiles are not compatible with some devices">Only profiles that are compatible with the device will be listed above.</property>
-                    <property name="wrap">True</property>
-                  </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">2</property>
-              </packing>
-            </child>
           </object>
           <packing>
-            <property name="expand">True</property>
+            <property name="expand">False</property>
             <property name="fill">True</property>
             <property name="position">1</property>
           </packing>
@@ -259,50 +222,62 @@
                   <object class="GtkToolItem" id="left_button_group">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
+                    <property name="use_action_appearance">False</property>
                     <child>
                       <object class="GtkBox" id="left_button_group_box">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="homogeneous">False</property>
                         <child>
                           <object class="GtkButton" id="toolbutton_device_add">
+                            <property name="label" translatable="yes">Add device</property>
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
+                            <property name="receives_default">False</property>
                             <property name="has_tooltip">True</property>
                             <property name="tooltip_markup" translatable="yes">Add a virtual device</property>
                             <property name="tooltip_text">Add a virtual device</property>
-                            <property name="label" translatable="yes">Add device</property>
+                            <property name="use_action_appearance">False</property>
                             <property name="use_underline">True</property>
                           </object>
                           <packing>
                             <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
                           </packing>
                         </child>
                         <child>
                           <object class="GtkButton" id="toolbutton_device_remove">
+                            <property name="label" translatable="yes">Delete device</property>
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
+                            <property name="receives_default">False</property>
                             <property name="has_tooltip">True</property>
                             <property name="tooltip_markup" translatable="yes">Remove a device</property>
                             <property name="tooltip_text">Remove a device</property>
-                            <property name="label" translatable="yes">Delete device</property>
+                            <property name="use_action_appearance">False</property>
                             <property name="use_underline">True</property>
                           </object>
                           <packing>
                             <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">1</property>
                           </packing>
                         </child>
                         <child>
                           <object class="GtkButton" id="toolbutton_device_default">
+                            <property name="label" translatable="yes">Set for all users</property>
                             <property name="can_focus">False</property>
+                            <property name="receives_default">False</property>
                             <property name="has_tooltip">True</property>
                             <property name="tooltip_markup" translatable="yes">Set this device for all users on this computer</property>
                             <property name="tooltip_text">Set this device for all users on this computer</property>
-                            <property name="label" translatable="yes">Set for all users</property>
+                            <property name="use_action_appearance">False</property>
                             <property name="use_underline">True</property>
                           </object>
                           <packing>
                             <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">2</property>
                           </packing>
                         </child>
                       </object>
@@ -310,68 +285,97 @@
                   </object>
                   <packing>
                     <property name="expand">True</property>
-                    <property name="homogeneous">False</property>
                   </packing>
                 </child>
                 <child>
                   <object class="GtkToolItem" id="right_button_group">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
+                    <property name="use_action_appearance">False</property>
                     <child>
                       <object class="GtkBox" id="right_button_group_box">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <child>
                           <object class="GtkButton" id="toolbutton_profile_add">
+                            <property name="label" translatable="yes">Add profile</property>
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="label" translatable="yes">Add profile</property>
+                            <property name="receives_default">False</property>
+                            <property name="use_action_appearance">False</property>
                             <property name="use_underline">True</property>
                           </object>
                           <packing>
                             <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
                           </packing>
                         </child>
                         <child>
                           <object class="GtkButton" id="toolbutton_device_calibrate">
+                            <property name="label" translatable="yes">Calibrateâ</property>
                             <property name="can_focus">False</property>
+                            <property name="receives_default">False</property>
                             <property name="has_tooltip">True</property>
                             <property name="tooltip_markup" translatable="yes">Calibrate the device</property>
                             <property name="tooltip_text" translatable="yes">Calibrate the device</property>
-                            <property name="label" translatable="yes">Calibrateâ</property>
+                            <property name="use_action_appearance">False</property>
                             <property name="use_underline">True</property>
                           </object>
                           <packing>
                             <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">1</property>
                           </packing>
                         </child>
                         <child>
                           <object class="GtkButton" id="toolbutton_profile_remove">
-                            <property name="can_focus">False</property>
                             <property name="label" translatable="yes">Remove profile</property>
+                            <property name="can_focus">False</property>
+                            <property name="receives_default">False</property>
+                            <property name="use_action_appearance">False</property>
                             <property name="use_underline">True</property>
                           </object>
                           <packing>
                             <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">2</property>
                           </packing>
                         </child>
                         <child>
                           <object class="GtkButton" id="toolbutton_profile_view">
-                            <property name="can_focus">False</property>
                             <property name="label" translatable="yes">View details</property>
+                            <property name="can_focus">False</property>
+                            <property name="receives_default">False</property>
+                            <property name="use_action_appearance">False</property>
                             <property name="use_underline">True</property>
                           </object>
                           <packing>
                             <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">3</property>
                           </packing>
                         </child>
                       </object>
                     </child>
                   </object>
+                  <packing>
+                    <property name="expand">False</property>
+                  </packing>
                 </child>
               </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
             </child>
           </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
         </child>
       </object>
     </child>



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