From a Coverity scan:
panels/keyboard/cc-keyboard-manager.c:208: unreachable: Since the loop
increment "i++;" is unreachable, the loop body will never execute more
than once.
This seems like a logic thinko introduced in commit
3207fe97ec . In practice it was unlikely
to be a problem since we don't have repeated shortcut gsettings key
names in all our KeyListEntries files.
After successfully editing a default shortcut (and making sure the
"Set" button is sensitive), if the user clicks the '+' row to create
a new custom shortcut, the "Add" button is sensitive even with all
fields empty.
Fix that by ensuring the "Add" button is always insensitive whenever
we add a custom shortcut.
https://bugzilla.gnome.org/show_bug.cgi?id=777842
As described in the proposed mockups [1], the Keyboard panel
should have a Reset All button above the list of shortcuts that
allows the user to quickly reset all the shortcuts to their
default keybinding. The current implementation, however, lacks
this button.
Fix that by adding a "Reset All" button, and implementing the
reset all action. A message dialog is shown in order to confirm
the action, and custom shortcuts are not reset (unless the conflict
with the default keybinding of another standard shortcut).
[1] https://raw.githubusercontent.com/gnome-design-team/gnome-mockups/master/system-settings/keyboard/keyboard-wires.pnghttps://bugzilla.gnome.org/show_bug.cgi?id=777840
The current shortcut editor state is managed by setting and
comparing the page name directly, making the code look more
complicated than it should.
Fix this by introducing the concept of pages, and using this
to set and get the current shortcut editor dialog state.
https://bugzilla.gnome.org/show_bug.cgi?id=777845
After introducing the reset button to match the mockups [1], the
shortcut editor dialog had some issues exposed. This is visible
e.g. when the user tries to edit a custom shortcut's name and
the shortcut is disabled.
This happens because we assume there is always a shortcut set.
When we open the dialog to edit a custom shortcut, however, nothing
is actually set, and we end up saving the disabled shortcut when
editing the shortcut's name or command.
Fix that by initializing the shortcut's accelerators when editing a
shortcut, and correcting the logic to validate the shortcut.
[1] https://raw.githubusercontent.com/gnome-design-team/gnome-mockups/master/system-settings/keyboard/keyboard-wires.pnghttps://bugzilla.gnome.org/show_bug.cgi?id=777845
When adding a custom shortcut, the header mode was set to be
only "Cancel". Per mockups, the "Add" button should also be
visible but insensitive.
Fix that by correctly setting the header mode on creation mode.
https://bugzilla.gnome.org/show_bug.cgi?id=777824
When creating a new shortcut, we currently assume the entries are
sensitive and just show the dialog. This, however, may not be, for
example after previously canceling the editing of a custom shortcut,
leading to a state where the name and command entries are insensitive.
Fix that by always making sure the entries are sensitive when
setting the dialog to creation mode.
https://bugzilla.gnome.org/show_bug.cgi?id=777824
When canceling the editing of a custom shortcut, the "Edit" button
keeps pressed, causing inconsistencies when editing future custom
events.
To reproduce that:
- Open a custom shortcut and click "Edit"
- Start typing the new shortcut; the "Cancel" button will appear
- *Before* completing the new shortcut, click "Cancel"; the dialog will hide
- Open a custom shortcut again; the "Edit" button is still toggled
Fix that by properly untoggling the Edit button when cancelling
the editing.
https://bugzilla.gnome.org/show_bug.cgi?id=777824
The mask returned by gtk_accelerator_get_default_mod_mask() should
work without additional filtering, in particular when it is overly
restrictive - a lot of shortcuts use the Super modifier nowadays,
so stop filtering it out.
https://bugzilla.gnome.org/show_bug.cgi?id=771058
gtk_accelerator_valid() doesn't accept Tab as keyval, so using it to
check whether a shortcut is valid breaks commonly used shortcuts like
Alt+Tab. Unbreak those by adding a small wrapper that special-cases
Tab-with-modifiers.
https://bugzilla.gnome.org/show_bug.cgi?id=771058
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
We couldn't override gnome-shell's keybindings without having a working
grab, but the grab was only started when clicking the "edit" button when
editing a custom shortcut, or *after* receiving the first key press event.
To fix that problem, we need to grab the keyboard once we've shown the
dialog itself, but not in the ->map vfunc, otherwise it will block the
dialog from showing up. We set up a short timeout instead. Hopefully
this isn't too fragile.
https://bugzilla.gnome.org/show_bug.cgi?id=769314
In a0a15588, we starting using a separate shortcut editor window, which
was doing its own capture instead of using the GtkCellRendererAccel. But
this started grabbing both keyboard and pointer, making it impossible to
cancel captures using the pointer.
We now only grab keyboard keys, making the pointer usable again.
https://bugzilla.gnome.org/show_bug.cgi?id=769314
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
The Reset button, according to the mockups, should be placed
at the right side (left on rtl) of the shortcut label. Also,
rather than a plain string, the button should use a symbolic
icon for 'edit-clear' action.
This patch moves and updates the Reset button to match the
mockups.
https://bugzilla.gnome.org/show_bug.cgi?id=769314
When adding a new keyboard shortcut, in accordance to the mockups,
the dialog should present a new page calling for an action from the
user.
This patch adds this page, and adapts the code to show it whenever
the user wants to change the shortcut.
https://bugzilla.gnome.org/show_bug.cgi?id=769314
When editing a standard shortcut, the current code only
cancels the editing on Escape, but doesn't hide the
dialog.
Fix that by properly handling the canceling of shortcut
editing and making sure we always hide the dialog on
cancel.
https://bugzilla.gnome.org/show_bug.cgi?id=769314
Instead of manually handling every button in the headerbar
individually, using states to switch between modes. It's clearer
and easier to maintain.
This patch adds the headerbar mode handling code, and updates
the current code to use it rather than by updating each individual
button manually.
https://bugzilla.gnome.org/show_bug.cgi?id=769314
Instead of showing the shortcut description, show an
action-oriented title, according to the mockups. Precisely,
"Set Shortcut" for standard shortcuts and "Set Custom
Shortcut" for custom shortcuts.
https://bugzilla.gnome.org/show_bug.cgi?id=769314
The current button to reset shortcuts is represented by the
'x' icon, which induces the user to think this is a remove
button rather then a reset button.
Fix that by using edit-clear-symbolic icon to represent the
reset action.
https://bugzilla.gnome.org/show_bug.cgi?id=769314
When creating a new keyboard shortcut, the Add button gets
sensitive when all the fields are valid. If the user tries
to create a new shortcut right after closing the shortcut
editor dialog, the Add button is still sensitive even with
invalid custom fields.
Fix that by making the Add button sensitive whenever we
finish editing the new custom shortcut.
https://bugzilla.gnome.org/show_bug.cgi?id=769314
Gtk+ changed again the behavior of the scrolled window,
fixing the weird height issue but introducing a new issue
where the keyboard shortcut list doesn't expand horizontally
nor allocates the correct size vertically.
Fortunately, this is easily solvable with the newly introduced
GtkScrolledWindow:propagate-natural-width and -height
properties.
Fix the misbehavior by setting the new properties to sane
values.
https://bugzilla.gnome.org/show_bug.cgi?id=769314
When comparing the keyboard shortcut's default and current
values, we double-check what kind of variant the default
value is, but don't check that for the user value.
This ends up throwing lots of variant-related warnings, as
the user value may not be a plain string.
Fix that by checking the variant types both for the user and
the default value of the shortcut's settings.
https://bugzilla.gnome.org/show_bug.cgi?id=769310
Based on the latest mockups, the Keyboard panel would
benefit from a search functionality.
This patch add all the necessary UI and functions to
make the search work. Worth noticing that the current
implementation still doesn't work with search-as-you-type,
which'll be addressed on a future fix.
https://bugzilla.gnome.org/show_bug.cgi?id=769063
In order to simplify the porting to the new UI, the
reverse item functionality was removed. Now that all
the necessary code landed, it is time to bring it back.
This patch adds back the ability to manage reverse items.
https://bugzilla.gnome.org/show_bug.cgi?id=769063
Following the proposed mockups, the shortcut list must
have the ability to reset modified to non-default shortcuts
right from the listbox.
After adding the necessary API in CcKeyboardItem, adding
the user-visible elements to enable that is easy.
To make that happen, add a button that resets the
keyboard shortcut.
https://bugzilla.gnome.org/show_bug.cgi?id=769063