[gnome-control-center] keyboard: make the "Set" and "Add" buttons blue



commit c57cadf50b0d78d8363f7b9d14eb8cd4e6136578
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Tue Jan 31 10:07:52 2017 -0200

    keyboard: make the "Set" and "Add" buttons blue
    
    Per the available mockups [1], the "Set" and "Add" buttons
    are the suggested action of the dialog and should be blue.
    
    [1] 
https://raw.githubusercontent.com/gnome-design-team/gnome-mockups/master/system-settings/keyboard/keyboard-wires.png
    
    https://bugzilla.gnome.org/show_bug.cgi?id=777842

 panels/keyboard/cc-keyboard-shortcut-editor.c |   19 +++++++++++++++++++
 panels/keyboard/shortcut-editor.ui            |   14 ++++++++------
 2 files changed, 27 insertions(+), 6 deletions(-)
---
diff --git a/panels/keyboard/cc-keyboard-shortcut-editor.c b/panels/keyboard/cc-keyboard-shortcut-editor.c
index 861e710..e568cc4 100644
--- a/panels/keyboard/cc-keyboard-shortcut-editor.c
+++ b/panels/keyboard/cc-keyboard-shortcut-editor.c
@@ -319,6 +319,25 @@ set_header_mode (CcKeyboardShortcutEditor *self,
                                                mode != HEADER_MODE_CUSTOM_EDIT);
   gtk_widget_set_visible (self->replace_button, mode == HEADER_MODE_REPLACE);
   gtk_widget_set_visible (self->set_button, mode == HEADER_MODE_SET);
+
+  /* By setting the default response, the action button gets the 'suggested-action' applied */
+  switch (mode)
+    {
+    case HEADER_MODE_SET:
+      gtk_dialog_set_default_response (GTK_DIALOG (self), GTK_RESPONSE_APPLY);
+      break;
+
+    case HEADER_MODE_REPLACE:
+      gtk_dialog_set_default_response (GTK_DIALOG (self), GTK_RESPONSE_ACCEPT);
+      break;
+
+    case HEADER_MODE_ADD:
+      gtk_dialog_set_default_response (GTK_DIALOG (self), GTK_RESPONSE_OK);
+      break;
+
+    default:
+      gtk_dialog_set_default_response (GTK_DIALOG (self), GTK_RESPONSE_NONE);
+    }
 }
 
 static void
diff --git a/panels/keyboard/shortcut-editor.ui b/panels/keyboard/shortcut-editor.ui
index bebec36..ac0f01b 100644
--- a/panels/keyboard/shortcut-editor.ui
+++ b/panels/keyboard/shortcut-editor.ui
@@ -369,11 +369,9 @@
             <property name="visible">True</property>
             <property name="sensitive">False</property>
             <property name="can_focus">True</property>
+            <property name="can_default">True</property>
             <property name="receives_default">True</property>
             <signal name="clicked" handler="add_button_clicked_cb" object="CcKeyboardShortcutEditor" 
swapped="yes" />
-            <style>
-              <class name="suggested-action" />
-            </style>
           </object>
           <packing>
             <property name="pack_type">end</property>
@@ -398,11 +396,9 @@
             <property name="label" translatable="yes">Set</property>
             <property name="visible">True</property>
             <property name="can_focus">True</property>
+            <property name="can_default">True</property>
             <property name="receives_default">True</property>
             <signal name="clicked" handler="set_button_clicked_cb" object="CcKeyboardShortcutEditor" 
swapped="yes" />
-            <style>
-              <class name="suggested-action" />
-            </style>
           </object>
           <packing>
             <property name="pack_type">end</property>
@@ -411,6 +407,12 @@
         </child>
       </object>
     </child>
+    <action-widgets>
+      <action-widget response="cancel">cancel_button</action-widget>
+      <action-widget response="accept">replace_button</action-widget>
+      <action-widget response="apply">set_button</action-widget>
+      <action-widget response="ok" default="true">add_button</action-widget>
+    </action-widgets>
   </template>
   <object class="GtkSizeGroup">
     <widgets>


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