Commit graph

531 commits

Author SHA1 Message Date
Bastien Nocera
1ef60c7f06 keyboard: Fix typo in comment
https://bugzilla.gnome.org/show_bug.cgi?id=771124
2016-09-09 16:51:36 +02:00
Yosef Or Boczko
8aae1f1973 Mark another string as translatable 2016-09-09 12:49:45 +03:00
Yosef Or Boczko
3d868c0888 Mark some strings as translatable 2016-09-09 12:36:03 +03:00
Bastien Nocera
45fb0a4feb keyboard: Normalise Shift and Tab in shortcuts
https://bugzilla.gnome.org/show_bug.cgi?id=771058
2016-09-08 17:38:04 +02:00
Florian Müllner
789639004f keyboard: Remove additional filtering of default mod mask
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
2016-09-08 17:38:04 +02:00
Florian Müllner
4beb7cefd4 keyboard: Allow Tab in accels
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
2016-09-08 17:38:04 +02:00
Bastien Nocera
784d8f89de 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
2016-09-08 17:12:17 +02:00
Bastien Nocera
69258a91a6 keyboard: Add helper to detect empty keybindings
We'll use this shortly.

https://bugzilla.gnome.org/show_bug.cgi?id=769314
2016-09-08 17:12:17 +02:00
Bastien Nocera
58b175f351 keyboard: Fix grabs not working when showing the dialog
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
2016-09-08 17:12:17 +02:00
Bastien Nocera
141441eb71 keyboard: Don't regrab the keyboard after an event
It was already grabbed if we received the event, so no need to grab it
again.

https://bugzilla.gnome.org/show_bug.cgi?id=769314
2016-09-08 17:12:17 +02:00
Bastien Nocera
6c7746abb3 keyboard: Don't rely on events to grab keyboard
Rather than relying on us being in the middle of processing an event to
grab the keyboard, get the keyboard for the first seat of the display.

https://bugzilla.gnome.org/show_bug.cgi?id=769314
2016-09-08 17:12:17 +02:00
Bastien Nocera
b10a1ac935 keyboard: Don't grab the mouse pointer
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
2016-09-08 17:12:17 +02:00
Bastien Nocera
b32f58ed00 keyboard: Remove unused variable
grab_device was added in a0a15588 but unused there or since.

https://bugzilla.gnome.org/show_bug.cgi?id=769314
2016-09-08 17:12:17 +02:00
Georges Basile Stavracas Neto
778395f61b 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
2016-09-08 17:12:17 +02:00
Georges Basile Stavracas Neto
9c4b27309d shortcut-editor: move widgets into a stack
The stack will be used by the next patches to show
an call for action page.

https://bugzilla.gnome.org/show_bug.cgi?id=769314
2016-09-08 17:12:17 +02:00
Georges Basile Stavracas Neto
cbff1e7b0a shortcut-editor: update reset button position and style
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
2016-09-08 17:12:17 +02:00
Georges Basile Stavracas Neto
c5cd32f797 shortcut-editor: use a different page to edit custom shortcuts
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
2016-09-08 17:12:17 +02:00
Georges Basile Stavracas Neto
a0001b14b5 keyboard: add enter-new-shortcut asset
This is a stub icon shown whenever we want to tell
the user to start typing the new shortcut.

https://bugzilla.gnome.org/show_bug.cgi?id=769314
2016-09-08 17:12:17 +02:00
Georges Basile Stavracas Neto
faef0353f3 shortcuts: remove bottom label
https://bugzilla.gnome.org/show_bug.cgi?id=769314
2016-09-08 17:12:17 +02:00
Georges Basile Stavracas Neto
4db1337664 shortcut-editor: hide editing dialog on Escape
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
2016-09-08 17:12:17 +02:00
Georges Basile Stavracas Neto
40ee225385 shortcut-editor: use states to handle headerbar mode
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
2016-09-08 17:12:17 +02:00
Georges Basile Stavracas Neto
472959657b 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
2016-09-08 17:12:17 +02:00
Georges Basile Stavracas Neto
5637d573a6 shortcut-editor: update header title message
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
2016-09-08 17:12:17 +02:00
Georges Basile Stavracas Neto
199ba17258 keyboard: use a better icon to represent "Reset Shortcut"
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
2016-09-08 17:12:17 +02:00
Georges Basile Stavracas Neto
d8d85bae12 keyboard: make Add button insensitive after editing
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
2016-09-08 17:12:17 +02:00
Georges Basile Stavracas Neto
cf3ff886ca keyboard: change standard shortcut top label
Per feedback, the current call-to-action label isn't very clear
and is too long.

Fix that by rewording the label.

https://bugzilla.gnome.org/show_bug.cgi?id=769314
2016-09-08 17:12:17 +02:00
Georges Basile Stavracas Neto
b39bc93600 keyboard: fix list sizes with latest Gtk+
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
2016-09-07 14:26:29 +02:00
Georges Basile Stavracas Neto
00f1b53abb keyboard: make sure to retrieve the correct type from variants
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
2016-07-29 19:32:51 +02:00
Georges Basile Stavracas Neto
ab8721fc04 keyboard: add search support
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
2016-07-29 13:48:31 -03:00
Georges Basile Stavracas Neto
7b877bc33f keyboard: bring back reverse item management
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
2016-07-29 13:48:31 -03:00
Georges Basile Stavracas Neto
d0c32c38a3 keyboard: remove unused code
CcKeyboardItem overrides GObject:constructor with an
empty function that only hooks up with the parent
constructor.

https://bugzilla.gnome.org/show_bug.cgi?id=769063
2016-07-29 13:48:31 -03:00
Georges Basile Stavracas Neto
1c85479742 keyboard: add support to reset shortcuts to their default values
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
2016-07-29 13:48:31 -03:00
Georges Basile Stavracas Neto
376459af43 keyboard: add API to track whether a shortcut is default
The current keyboard item API does not track whether the
keyboard shortcut is the default value or not. In order to
properly implement the Reset operation, the keyboard item
must receive this API and ideally handle it internally.

This patch adds the necessary API to CcKeyboardItem to track
whether the shortcut is the default value or not.

https://bugzilla.gnome.org/show_bug.cgi?id=769063
2016-07-29 13:48:31 -03:00
Georges Basile Stavracas Neto
4e50c3c375 keyboard: bring back uniqueness check
The collision detection code was removed in commit a0a155884e
as the cleanup was happening because the previous code was closely
tied to the user interface components.

Because that code wasn't appliable to the new listbox UI, it was
temporarily removed.

This patch re-adds this feature to work with the new code orgazination.

https://bugzilla.gnome.org/show_bug.cgi?id=769063
2016-07-29 13:48:22 -03:00
Georges Basile Stavracas Neto
60b235754e keyboard: move keyboard management code to custom class
Instead of having CcKeyboardPanel managing both UI and backend code,
factor the backend code to a new CcKeyboardManager class and drop
backend management from the panel itself.

The new backend class handles the loading, creation and removal and
search of keyboard shortcuts. It also resolves reversible shortcuts
when searching.

This patch moves the code to this new class, and updates the rest of
the Keyboard panel to use it instead.

https://bugzilla.gnome.org/show_bug.cgi?id=769063
2016-07-29 13:43:47 -03:00
Georges Basile Stavracas Neto
70bba2bbcd keyboard: avoid stray Meta modified
While using the Keyboard shortcut editor dialog under
Wayland, the user receives a <Meta> key even when this
key isn't present in the physical keyboard nor in the
keymap.

This is probably the result of Wayland inheriting from
X's xkb.

To work around that, simply filter out this modifier.

https://bugzilla.gnome.org/show_bug.cgi?id=769063
2016-07-29 13:43:47 -03:00
Georges Basile Stavracas Neto
a0a155884e keyboard: introduce CcKeyboardShortcutEditor
The current CcKeyboardPanel used to manage keyboard
editing through GtkCellRendererAccel, which was replaced
when we moved to use a GtkListBox. Because of that,
the ability to edit shortcuts is now missing.

Re-add shortcut editing capabilities through a new dialog,
which is done according to the latest mockups available.

https://bugzilla.gnome.org/show_bug.cgi?id=769063
2016-07-29 13:43:47 -03:00
Georges Basile Stavracas Neto
847fe447da keyboard: remove the shortcuts treeview
After porting the shortcuts management entirely to
GtkListBox, the current treeview is not necessary
anymore.

This patch removes the shortcuts treeview and all
the related functions, and separates the treeviews
from the underlying models.

https://bugzilla.gnome.org/show_bug.cgi?id=769063
2016-07-29 13:43:47 -03:00
Georges Basile Stavracas Neto
fd3044272e keyboard: show shortcuts in a listbox
Replace the current treeview with the new listbox. This
patch simply adds the listbox, and does not remove the
treeview yet.

https://bugzilla.gnome.org/show_bug.cgi?id=769063
2016-07-29 13:43:47 -03:00
Georges Basile Stavracas Neto
c1529c3417 keyboard: add helper method for user-friendly accelerators
The accelerator formatting method itself is copied from
GtkCellRendererAccel, and will be used throughout the code
to format the accelerators just like they used to be before
moving to the listbox.

https://bugzilla.gnome.org/show_bug.cgi?id=769063
2016-07-29 13:43:47 -03:00
Georges Basile Stavracas Neto
d85047d36e keyboard: add a group field to CcKeyboardItem
This group field will be consumed by the next patches
in order to provide the correct ordering of elements
in the listbox.

https://bugzilla.gnome.org/show_bug.cgi?id=769063
2016-07-29 13:43:47 -03:00
Georges Basile Stavracas Neto
c4e1ca2ee0 keyboard: show all shortcuts in a single treeview
Move away from the old sections sidebar, by merging all
the shortcuts in the treeview and removing the sections
treeview.

https://bugzilla.gnome.org/show_bug.cgi?id=769063
2016-07-29 13:43:47 -03:00
Georges Basile Stavracas Neto
d940d7bb5d keyboard: make it a template class
To allow a much easier porting to the new layout, the keyboard
panel is now a template class. That has various implications on
the code organization:

 - The keyboard-shortcuts.c was responsible for filling the shortcuts.
   Because it relied on the GtkBuilder of the panel, most of its code
   was moved to the CcKeyboardPanel class.
 - The unused code from the keyboard panel class had to be removed in
   order to make it work again.
 - All the hash tables and widgets are now part of the CcKeyboardPanel
   structure.
 - The interface elements have a single entry point.

https://bugzilla.gnome.org/show_bug.cgi?id=769063
2016-07-29 13:43:47 -03:00
Georges Basile Stavracas Neto
dfa01baa9d keyboard: expose structures in header
These structures will be used in future commits when
moving to use a template class.

https://bugzilla.gnome.org/show_bug.cgi?id=769063
2016-07-29 13:43:47 -03:00
Florian Müllner
f7fad92c3e keyboard: Add gettext support for keybinding descriptions
gettext can extract strings from xml file formats with the help of
.its files. Provide appropriate rules so modules that install
keybinding descriptions don't need to depend on intltool to
extract translatable strings.

https://bugzilla.gnome.org/show_bug.cgi?id=769066
2016-07-27 17:27:32 +02:00
Georges Basile Stavracas Neto
ce08134c2b keyboard: remove deprecated GtkHBox and GtkVBox
These classes are deprecated by Gtk+ and should be replaced
by vertical and/or horizontal GtkBoxes.

This commit replaces the usage of the deprecated box classes.

https://bugzilla.gnome.org/show_bug.cgi?id=769063
2016-07-26 11:25:25 -03:00
Georges Basile Stavracas Neto
bca7c591af keyboard: remove boilerplate code
After introducing the autocleanup function to
CcPanel, it is now possible to remove a lot of
boilerplate code from the panels.

This commit ports CcKeyboardPanel to be a final
type, removing all the old boilerplate code in
the proccess.

https://bugzilla.gnome.org/show_bug.cgi?id=769063
2016-07-26 11:24:44 -03:00
Georges Basile Stavracas Neto
2777fd583d panels: use the new categories
Following the previous patch, this patch adds the new alternative
categories to the panels' Desktop files. These alternative categories
are only relevant for the alternative Shell, and do not break the
current Shell in any way.

https://bugzilla.gnome.org/show_bug.cgi?id=767301
2016-06-14 12:16:43 -03:00
Bastien Nocera
5c10ce45b8 panels: Fix translators comments being truncated
Commit b3be076 added soft hyphens along with a comment for translators
to use those soft hyphens. Except that gettext would only grab the one
line out of the four we wrote for translators to read. Put them all on
the same line so that gettext actually extracts those.

https://bugzilla.gnome.org/show_bug.cgi?id=765778
2016-04-28 23:38:00 +02:00
Bastien Nocera
b3be07609a panels: Fix truncated panel names for larger fonts
Note that this fix will not automatically fix translations, which will
need to add soft-hyphens (U+00AD) to their translations themselves, and
will not fix larger fonts for which the split up syllables end up
being bigger than the maximum text width.

It's the best we can do without redesigning the Settings shell, which is
already something planned.

https://bugzilla.gnome.org/show_bug.cgi?id=647087#c13
2016-04-07 16:06:35 +02:00