[gnome-control-center] shortcut-editor: add 'Set' button



commit 472959657b2e68995c0e599f9a0dff0239903b72
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Tue Aug 30 11:42:09 2016 -0300

    shortcut-editor: add 'Set' button
    
    The Set button will be used to update a standard
    shortcut.
    
    This patch adds it to the headerbar.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=769314

 panels/keyboard/cc-keyboard-shortcut-editor.c |   10 ++++++++++
 panels/keyboard/shortcut-editor.ui            |   16 ++++++++++++++++
 2 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/panels/keyboard/cc-keyboard-shortcut-editor.c b/panels/keyboard/cc-keyboard-shortcut-editor.c
index 37e4eed..e9f9005 100644
--- a/panels/keyboard/cc-keyboard-shortcut-editor.c
+++ b/panels/keyboard/cc-keyboard-shortcut-editor.c
@@ -44,6 +44,7 @@ struct _CcKeyboardShortcutEditor
   GtkWidget          *remove_button;
   GtkWidget          *replace_button;
   GtkWidget          *reset_button;
+  GtkWidget          *set_button;
   GtkWidget          *shortcut_accel_label;
   GtkWidget          *shortcut_conflict_label;
   GtkWidget          *stack;
@@ -421,6 +422,13 @@ reset_item_clicked_cb (CcKeyboardShortcutEditor *self)
 }
 
 static void
+set_button_clicked_cb (CcKeyboardShortcutEditor *self)
+{
+  update_shortcut (self);
+  gtk_widget_hide (GTK_WIDGET (self));
+}
+
+static void
 setup_keyboard_item (CcKeyboardShortcutEditor *self,
                      CcKeyboardItem           *item)
 {
@@ -689,6 +697,7 @@ cc_keyboard_shortcut_editor_class_init (CcKeyboardShortcutEditorClass *klass)
   gtk_widget_class_bind_template_child (widget_class, CcKeyboardShortcutEditor, remove_button);
   gtk_widget_class_bind_template_child (widget_class, CcKeyboardShortcutEditor, replace_button);
   gtk_widget_class_bind_template_child (widget_class, CcKeyboardShortcutEditor, reset_button);
+  gtk_widget_class_bind_template_child (widget_class, CcKeyboardShortcutEditor, set_button);
   gtk_widget_class_bind_template_child (widget_class, CcKeyboardShortcutEditor, shortcut_accel_label);
   gtk_widget_class_bind_template_child (widget_class, CcKeyboardShortcutEditor, shortcut_conflict_label);
   gtk_widget_class_bind_template_child (widget_class, CcKeyboardShortcutEditor, stack);
@@ -702,6 +711,7 @@ cc_keyboard_shortcut_editor_class_init (CcKeyboardShortcutEditorClass *klass)
   gtk_widget_class_bind_template_callback (widget_class, remove_button_clicked_cb);
   gtk_widget_class_bind_template_callback (widget_class, replace_button_clicked_cb);
   gtk_widget_class_bind_template_callback (widget_class, reset_item_clicked_cb);
+  gtk_widget_class_bind_template_callback (widget_class, set_button_clicked_cb);
 }
 
 static void
diff --git a/panels/keyboard/shortcut-editor.ui b/panels/keyboard/shortcut-editor.ui
index 81b5dc3..4cdbf42 100644
--- a/panels/keyboard/shortcut-editor.ui
+++ b/panels/keyboard/shortcut-editor.ui
@@ -262,6 +262,22 @@
             <property name="position">2</property>
           </packing>
         </child>
+        <child>
+          <object class="GtkButton" id="set_button">
+            <property name="label" translatable="yes">Set</property>
+            <property name="visible">True</property>
+            <property name="can_focus">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>
+            <property name="position">3</property>
+          </packing>
+        </child>
       </object>
     </child>
   </template>


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