[gnome-control-center/wip/gbsneto/keyboard-improvements: 66/67] shortcut-editor: show custom page while waiting for input



commit 1edf90c8fb27939162a8e410f9fd07055c0c50a7
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed Aug 31 21:14:34 2016 -0300

    shortcut-editor: show custom page while waiting for input
    
    While waiting for keyboard input, as per the new proposed mockup,
    the shortcut editor dialog should show a custom page with an icon
    that indicates the required action. The current code, however, does
    not expose this new customized page.
    
    Fix that by adding this new page and controlling the time when it
    shows and hides.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=769314

 panels/keyboard/cc-keyboard-shortcut-editor.c |   11 ++++++++-
 panels/keyboard/shortcut-editor.ui            |   31 +++++++++++++++++++++++++
 2 files changed, 41 insertions(+), 1 deletions(-)
---
diff --git a/panels/keyboard/cc-keyboard-shortcut-editor.c b/panels/keyboard/cc-keyboard-shortcut-editor.c
index 3422b75..08b9815 100644
--- a/panels/keyboard/cc-keyboard-shortcut-editor.c
+++ b/panels/keyboard/cc-keyboard-shortcut-editor.c
@@ -48,6 +48,7 @@ struct _CcKeyboardShortcutEditor
   GtkWidget          *set_button;
   GtkWidget          *shortcut_accel_label;
   GtkWidget          *shortcut_conflict_label;
+  GtkWidget          *standard_shortcut_stack;
   GtkWidget          *stack;
   GtkWidget          *top_info_label;
 
@@ -300,6 +301,10 @@ setup_custom_shortcut (CcKeyboardShortcutEditor *self)
   if (!accel_valid)
     return;
 
+  /* Valid shortcut, show it in the standard page */
+  if (!is_custom)
+    gtk_stack_set_visible_child_name (GTK_STACK (self->standard_shortcut_stack), "main");
+
   shortcut_label = get_current_shortcut_label (self);
 
   collision_item = cc_keyboard_manager_get_collision (self->manager,
@@ -507,7 +512,7 @@ setup_keyboard_item (CcKeyboardShortcutEditor *self,
   gtk_widget_hide (self->replace_button);
 
   /* Setup the top label */
-  text = g_strdup_printf (_("Enter new shortcut to change <b>%s</b>, or press Esc to cancel."), 
item->description);
+  text = g_strdup_printf (_("Enter new shortcut to change <b>%s</b>."), item->description);
 
   gtk_label_set_markup (GTK_LABEL (self->top_info_label), text);
 
@@ -547,6 +552,9 @@ setup_keyboard_item (CcKeyboardShortcutEditor *self,
 
   /* Show the apropriate view */
   gtk_stack_set_visible_child_name (GTK_STACK (self->stack), is_custom ? "custom" : "edit");
+
+  if (!is_custom)
+    gtk_stack_set_visible_child_name (GTK_STACK (self->standard_shortcut_stack), "change-shortcut");
 }
 
 static void
@@ -759,6 +767,7 @@ cc_keyboard_shortcut_editor_class_init (CcKeyboardShortcutEditorClass *klass)
   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, standard_shortcut_stack);
   gtk_widget_class_bind_template_child (widget_class, CcKeyboardShortcutEditor, stack);
   gtk_widget_class_bind_template_child (widget_class, CcKeyboardShortcutEditor, top_info_label);
 
diff --git a/panels/keyboard/shortcut-editor.ui b/panels/keyboard/shortcut-editor.ui
index b6ba41d..b8c0f1d 100644
--- a/panels/keyboard/shortcut-editor.ui
+++ b/panels/keyboard/shortcut-editor.ui
@@ -47,6 +47,37 @@
                       <object class="GtkBox">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
+                        <property name="orientation">vertical</property>
+                        <property name="spacing">18</property>
+                        <property name="expand">True</property>
+                        <property name="halign">center</property>
+                        <property name="valign">center</property>
+                        <child>
+                          <object class="GtkImage">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property 
name="resource">/org/gnome/control-center/keyboard/enter-keyboard-shortcut.svg</property>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="GtkLabel">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label">Press Esc to cancel.</property>
+                            <style>
+                              <class name="dim-label" />
+                            </style>
+                          </object>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="name">change-shortcut</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkBox">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
                         <property name="hexpand">True</property>
                         <property name="orientation">vertical</property>
                         <property name="spacing">18</property>


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