Commit graph

485 commits

Author SHA1 Message Date
Eric Daigle
322830e3cc keyboard: fix input row movement options
As described in #2565, the "Move Up" and "Move Down" popover menu options
are currently displayed for all input rows in the list, doing nothing if clicked
when a row is at the top or bottom of the list respectively. This commit adds
checks when creating and moving the input rows and disables these options at the
top and bottom of the list respectively, removing a useless menu option.

Fixes #2565
2023-07-17 09:19:09 +00:00
Carlos Garnacho
4e340b7602 keyboard: Spawn "tecla" to show keyboard map
This is a modern replacement for gkbd-keyboard-display, stuck in gtk3
and X11 (libxklavier).
2023-07-13 13:11:13 +00:00
Marcos Miller
b5ce4fafcd keyboard: replace 'gtk_widget_hide' and 'gtk_widget_show' 2023-07-03 10:33:39 +00:00
Marcos Miller
f35779a0b0 Keyboard: elements jump in UI
When editing shortcut key combination and this new combination already
exists in another shortcut, a message (new_shortcut_conflict_label) is
shown, but when clicking on the reset button (reset_custom_button) the
elements Name, Command and Shortcut skip.

It turned out that these jumps were due to the current values of the
width_chars and max_width_chars properties of the new_shortcut_conflict_label
element. So by setting these properties to zero the jumps don't occur.
2023-07-03 10:33:39 +00:00
Marcos Miller
e7de7e3941 Keyboard: Align button to create shortcut
The 'Set Shortcut...' button is inside a GtkStack having only one
column, not allowing to expand it.

I removed GtkStack keeping its 'Set Shortcut' child taking up two
columns.

[Issue #2107](https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/2107)
2023-07-03 10:33:39 +00:00
Automeris naranja
4151c06012 keyboard-shortcut-dialog: Add mnemonic to the "Add Shortcut" button 2023-06-27 16:23:42 -03:00
Robert Ancell
dd37cafb62 keyboard: Connect signal handlers in swapped form 2023-06-07 09:12:54 +12:00
sunflowerskater
266c55715a general: Add tooltips to headerbar controls
Acc. HIG, "controls in the header bars of primary windows should all have tooltips".

https://developer.gnome.org/hig/patterns/feedback/tooltips.html
2023-06-06 13:27:00 +00:00
Gunnar Hjalmarsson
d5becccc7c keyboard: Drop "Left Alt" as compose key option
Fixes https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/2509
2023-05-31 20:43:24 +00:00
Marcos Miller
478b3b4346 keyboard: change message dialog in 'reset all shortcuts'
The class Gtk.MessageDialog is deprecated in gtk 4.10.

This change remove class deprecated and uses the new class
AdwMessageDialog for view the message of 'reset all shortcut'.

keyboard: fix white space in function

keyboard: align arguments

keyboard: fix alignment of arguments in function
2023-05-31 13:51:26 +00:00
Marcos Miller
b0063d015f keyboard: fix "Add Custom Shortcut" in others sections
Clicking on the 'Custom Shortcuts' row when there are no custom
shortcuts causes the 'Add Custom Shortcuts' dialog to be shown for
all subsequent sessions. This is because the first stack defined was
'Add Custom Shortcuts', it would always be visible, as it was no
longer defined which stack was going to be shown.

Fixes (https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/2479)
2023-05-31 08:15:59 +00:00
Robert Ancell
a06914a60c keyboard: Do signal handlers in swapped form 2023-05-30 08:36:22 +00:00
Felipe Borges
e97429f0f6 Make dialogs close when pressing the Escape key
Fixes #2503
2023-05-25 23:24:00 +00:00
Pablo Correa Gómez
7f7b65545c all: meson: do not specify resources from gresource files as dependencies
Meson extracts them by itself and add them as dependencies for the target.
It means one less location to keep track of files, and a lot less boilerplate
around the meson files
2023-05-24 08:34:14 +00:00
Automeris naranja
13e4e0c242 general: Set a minimum size for various dialogs
This change prevents some dialogs from being shrunk
to a really small size by setting a minimum size for them.
2023-05-04 09:54:07 +00:00
sunflowerskater
c95dcf2a9a general: Add placeholder text to various search entries
Acc. HIG, "text fields should have placeholder text or a label".

https://developer.gnome.org/hig/patterns/controls/text-fields.html

Fixes https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/2190
2023-04-21 12:40:42 +00:00
Chris Mayo
92c4b6a706 Fix panel crashes due to unknown types in UI descriptions
Error building template class 'CcSearchPanel' for an instance of type 'CcSearchPanel': .:0:0 Invalid object type 'CcListRow'

Error building template class 'CcDisplayPanel' for an instance of type 'CcDisplayPanel': .:0:0 Invalid object type 'CcListRow'

Error building template class 'CcMousePanel' for an instance of type 'CcMousePanel': .:0:0 Invalid object type 'CcIllustratedRow'

Error building template class 'CcKeyboardPanel' for an instance of type 'CcKeyboardPanel': .:0:0 Invalid object type 'CcListRow'

Error building template class 'CcRegionPanel' for an instance of type 'CcRegionPanel': .:0:0 Invalid object type 'CcListRow'

Error building template class 'CcUaPanel' for an instance of type 'CcUaPanel': .:0:0 Invalid object type 'CcListRow'

Error building template class 'CcUserPanel' for an instance of type 'CcUserPanel': .:0:0 Invalid object type 'CcAvatarChooser'
Error building template class 'CcUserPanel' for an instance of type 'CcUserPanel': .:0:0 Invalid object type 'CcListRow'

Error building template class 'CcDateTimePanel' for an instance of type 'CcDateTimePanel': .:0:0 Invalid object type 'CcTzDialog'
cc_tz_dialog_get_selected_location: assertion 'CC_IS_TZ_DIALOG (self)' failed
dumped core
Error building template class 'CcDateTimePanel' for an instance of type 'CcDateTimePanel': .:0:0 Invalid object type 'CcListRow'

Error building template class 'CcInfoOverviewPanel' for an instance of type 'CcInfoOverviewPanel': .:0:0 Invalid object type 'CcHostnameEntry'
2023-04-17 12:14:58 +00:00
Automeris naranja
fe5257bc9e general: Remove a11y labels when they aren't needed
A11y labels aren't needed when using the "activatable-widget"
property, because the relation is set automatically:

https://gitlab.gnome.org/GNOME/libadwaita/-/blob/main/src/adw-action-row.c#L661
2023-04-12 18:34:20 -03:00
Automeris naranja
fe435b9e93 general: Use the "activatable-widget" property in several rows 2023-04-12 18:27:37 -03:00
Automeris naranja
8f8b2a7ea8 keyboard-shortcut-dialog: Add ellipsis to the "Add Shortcut" button label
Acc. HIG, "use an ellipsis (…) at the end of a label
if further input or confirmation is required from the user".

https://developer.gnome.org/hig/guidelines/writing-style.html?highlight=ellipsis
2023-03-31 10:36:00 +00:00
Automeris naranja
1722002728 keyboards: Add "Character" keyword 2023-03-31 10:33:57 +00:00
Automeris naranja
b3e4a40630 keyboards: Add "Compose" keyword
It isn't possible to open the Keyboards panel by searching for "Compose".
Compose key is an important feature, so this change adds a "Compose" keyword to improve the discoverability of this setting.
2023-03-31 10:33:57 +00:00
Maksym Hazevych
08c2e69851 Resolving suggestions 2023-03-29 14:26:55 +13:00
Maksym Hazevych
81d7a8a85e Use gtk_window_present and gtk_window_close 2023-03-29 14:26:55 +13:00
Maksym Hazevych
e00f773b2f Remove unnecessary visibility change 2023-03-29 14:26:55 +13:00
Maksym Hazevych
5b988a6943 Replace all occurrences of 'gtk_widget_hide'
Replace all occurrences of 'gtk_widget_hide(smth)' with
'gtk_widget_set_visible(smth, FALSE)'.
2023-03-29 14:26:55 +13:00
Maksym Hazevych
d831e5cb48 Replace all occurrences of 'gtk_widget_show'
Replace all occurrences of 'gtk_widget_show(smth)' with
'gtk_widget_set_visible(smth, TRUE)'.
2023-03-29 14:26:55 +13:00
Gotam Gorabh
50eed44089 remove extra line 2023-03-23 22:15:15 +00:00
Gotam Gorabh
2906168a72 keyboard:Fix cancel button issue 2023-03-23 22:15:15 +00:00
Mohammed Sadiq
e155979dc2 keyboard: shortcut-dialog: Set custom title for subview
So that we can have different titles for main view and subview,
and so the title won't be broken when swiping back from subview.
2023-03-01 16:12:19 +00:00
Mohammed Sadiq
287ab748a1 keyboard: shortcut-dialog: Pack content in a single leaflet
Don't pack headerbar and content separately, keep them together.
So that navigating back shall work right.
2023-03-01 16:12:19 +00:00
Mohammed Sadiq
f86fc38ef4 keyboard: shortcut-dialog: Remove separator between headerbar and search
Since we now uses GtkSearchBar, we no longer requires a separator in
between as GtkSearchBar has one already.
2023-03-01 16:12:19 +00:00
Mohammed Sadiq
d978d51c96 keyboard: shortcut-dialog: Don't update search results in sub-view
Since the main view is not visible, there is no point in updating
search results when we are in a sub-view.  This will happen as we
always listen to keyboard events for the whole window - regardless
of whether the search entry has focus or not.
2023-03-01 16:12:19 +00:00
Mohammed Sadiq
73c76a7e85 keyboard: shortcut-dialog: Pack search inside a SearchBar
So that they are shown distinct from the rest of the content and
have proper margins

Fixes #2202
2023-03-01 16:12:19 +00:00
Mohammed Sadiq
587a1b05ae keyboard: shortcut-dialog: Add margins around search entry
So that they won't get too close to the window borders.  Also adjust
width-chars so that the window width can reach smaller sizes
2023-03-01 16:12:19 +00:00
Mohammed Sadiq
76707bb701 keyboard: shortcut-dialog: Align status pages to the center of the page
Fixes #2202
2023-03-01 16:12:19 +00:00
Mohammed Sadiq
40cf37590f keyboard: shortcut-dialog: Remove sub-view search code
We have had removed support for searching in sub-sections.
Remove related code which is no longer used
2023-03-01 16:12:19 +00:00
Mohammed Sadiq
80ff36d18c keyboard: shortcut-dialog: Don't update search visibility in custom shortcuts
Now we never show search entry in subpages, so don't hide search entry
when switching to subviews.  Otherwise, the search entry will be hidden
when the user switches back to the main view.
2023-03-01 16:12:19 +00:00
Mohammed Sadiq
c0be13c7d6 keyboard: shortcut-dialog: Fix search on swipe navigations
We were updating the state when the back button is pressed, not when
the pages were changed, and so the dialog state was broken if the
user went back by swipe (or means other than clicking the back button).

Fix it by handling updating state when the visible view changes.
2023-03-01 16:12:19 +00:00
Mohammed Sadiq
6a84e1eb83 keyboard: shortcut-dialog: Use AdwLeaflet for headerbar
So that users can swipe on headerbar to go back

Fixes #2202
2023-03-01 16:12:19 +00:00
Mohammed Sadiq
db82543a62 keyboard: shortcut-dialog: Focus search entry when the window is presented 2023-03-01 16:12:19 +00:00
Nelson Benítez León
e865b14e3b keyboard: allow going back from CCInputChooser via single click
When adding new input sources, the first dialog shows a list of
languages, when single clicking one item you go to a subdialog
that has a 'go back' item, that item only works if double-clicking
it, but that is unintuitive because if you entered the dialog by
single click you also expect the 'go back' button to work by
single click too.

The subdialog is a GtkListBox configured to be double click,
because it has an 'Accept' header bar button and we don't
really want to activate the subdialog items by single click,
but the 'go back' row is special and as explained before it is
expected to work by single click too.

So this commit adds the required single click handler for the
'go back' rows created in CCInputChooser.

Fixes #1954
2023-02-14 03:24:20 +00:00
Alessandro Bono
19d83d6839 keyboard: Rewrite layout intersection algorithm
The current layout intersection algorithm compares pointers to strings.
It assumes that `gnome_xkb_info_get_layouts_for_country()` and
`gnome_xkb_info_get_layouts_for_language()` will return two GList
containing pointers to the same strings. Looking at libgnome-desktop[1]
it seems like this is the case: given the same layout, the same pointer
to the layout id will be stored in both lists. However, this is an
implementation detail and we should not rely on that.

Rewrite the intersection algorithm in order to compare the strings. While
at it, use a more efficient algorithm: add all the items of the first list
to a set, then iterate over the second list and check if the item is in
the set. If this happens, remove the item from the set and add it to the
intersection list.

Probably the layout lists are not big enough to notice the difference, but
the complexity goes from O(N*M) to O(N+M).

[1] 3c8834af09/libgnome-desktop/gnome-xkb-info.c (L281)
2023-02-10 11:32:05 +00:00
Sundeep Anand
b05990e024 keyboard: country matches should not be shown under a language name.
country_layouts are being appended to the layouts_with_locale which results in less relevant
layout groupings. for example, we if choose Hindi language which is an Indian language,
all Indian language layouts are shown within it - including Tamil, Bangla etc.

furthermore, language_layouts are also getting appended for countries where they may not
belong, for example, English (Ireland) is shown when we search India.

The layouts_with_locale table is filled as union however it yields better
search results if we change that to intersection.

Relates #2114
2023-02-09 14:12:27 +00:00
Nelson Benítez León
f61bc83409 keyboard: fix bad state when moving input rows
When moving CcInputRows we can't just rely on
row index, because there are rows which are
not CCInputRows, so let's check for that.

Fixes #2282
2023-01-30 11:42:51 +00:00
sunflowerskater
c5c64f2b7d keyboard: Add "Hotkey" keyword
Currently, it's not possible to find the Keyboard panel by searching for "hotkey".

This commit adds the "hotkey" word to the *.desktop.in file.

Fixes: https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/283
2023-01-06 12:40:19 +00:00
Felipe Borges
294156c0f9 Drop most uses of deprecated gtk_style_context_add/remove_class
GtkStyleContext will be deprecated in gtk 4.10.
https://docs.gtk.org/gtk4/class.StyleContext.html

This preserves code blocks where additional GtkStyleContext operations
were used, such as gtk_style_context_save/restore.
2023-01-05 18:55:51 +00:00
Mohammed Sadiq
6ad36fe6db keyboard: shortcut-dialog: Refactor
- Use GListModel for creation, filter and sorting of shortcut sections
- Use AdwStatusPage instead of handling empty states manually

Fixes #1212 #1735 #2105 #2159 #2160 #2169
2022-12-05 20:50:15 +00:00
Mohammed Sadiq
ab9d529d9f Add cc-keyboard-shortcut-group
This widget shall list all keyboard shortcuts for
a section
2022-12-05 20:50:15 +00:00
Mohammed Sadiq
19548906c7 keyboard: shortcut-row: Add API to get shortcut item 2022-12-05 20:50:15 +00:00