[gnome-control-center] keyboard: Don't apply "Backspace" straight away



commit 784d8f89ded2472202594e41d62eb4596189182c
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Sep 8 14:00:46 2016 +0200

    keyboard: Don't apply "Backspace" straight away
    
    Before, when pressing "Backspace" in the editing dialogue, the
    keybinding would be changed straight away, *behind* the dialogue, and
    the dialogue would still be expecting a new shortcut.
    
    Instead, we should make it behave like other shortcuts, which means
    special handling empty shortcuts as valid ones.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=769314

 panels/keyboard/cc-keyboard-shortcut-editor.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/panels/keyboard/cc-keyboard-shortcut-editor.c b/panels/keyboard/cc-keyboard-shortcut-editor.c
index 51b05c9..cb4580f 100644
--- a/panels/keyboard/cc-keyboard-shortcut-editor.c
+++ b/panels/keyboard/cc-keyboard-shortcut-editor.c
@@ -284,6 +284,8 @@ setup_custom_shortcut (CcKeyboardShortcutEditor *self)
   accel_valid = is_valid_binding (self->custom_keyval, self->custom_mask, self->custom_keycode) &&
                 gtk_accelerator_valid (self->custom_keyval, self->custom_mask) &&
                 !self->custom_is_modifier;
+  if (is_empty_binding (self->custom_keyval, self->custom_mask, self->custom_keycode))
+    accel_valid = TRUE;
   valid = accel_valid;
 
   /* Additional checks for custom shortcuts */
@@ -663,13 +665,11 @@ cc_keyboard_shortcut_editor_key_press_event (GtkWidget   *widget,
   if (!event->is_modifier && real_mask == 0 && event->keyval == GDK_KEY_BackSpace)
     {
       self->edited = TRUE;
+      self->custom_is_modifier = FALSE;
       self->custom_keycode = 0;
       self->custom_keyval = 0;
       self->custom_mask = 0;
 
-      if (self->item)
-        apply_custom_item_fields (self, self->item);
-
       gtk_shortcut_label_set_accelerator (GTK_SHORTCUT_LABEL (self->custom_shortcut_accel_label), "");
       gtk_shortcut_label_set_accelerator (GTK_SHORTCUT_LABEL (self->shortcut_accel_label), "");
 
@@ -678,6 +678,8 @@ cc_keyboard_shortcut_editor_key_press_event (GtkWidget   *widget,
 
       self->edited = FALSE;
 
+      setup_custom_shortcut (self);
+
       return GDK_EVENT_STOP;
     }
 


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