Commit graph

475 commits

Author SHA1 Message Date
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
Mohammed Sadiq
0fa1c1ec65 keyboard: item: Notify is-value-default on key changes 2022-12-05 20:50:15 +00:00
Mohammed Sadiq
372c4bbb0e keyboard: item: Add an API to check if a string matches the item 2022-12-05 20:50:15 +00:00
Mohammed Sadiq
149aa3aac8 keyboard: manager: Add shortcuts-loaded signal
And emit the signal after all shorcuts are loaded.
2022-12-05 20:50:15 +00:00
Mohammed Sadiq
f1c09a9277 keyboard: shortcut-editor: Properly escape text
Related #852 #1529
2022-12-05 20:50:15 +00:00
Mohammed Sadiq
799ada8243 keyboard: shortcut-row: Use CSS classes to embolden text
Fixes #852 #1529
2022-12-05 20:50:15 +00:00
Mohammed Sadiq
15f000330c keyboard: shortcut-row: Use GObject bindings to update details
Fixes #1275 #2106
2022-12-05 20:50:15 +00:00
Mohammed Sadiq
9318791d01 keyboard: Use CcListRow where appropriate 2022-11-25 20:18:36 +05:30
Jake Dane
89443fe550 desktop: Remove obsolete Bugzilla entries
The `X-GNOME-Bugzilla-*` entries were for use by bug-buddy, a GNOME 2
technology that's been gone for over a decade. These entries are
obsolete and can be removed from all desktop files.

The `X-GNOME-Settings-Panel` entry is also obsolete as far as I can
tell and only these panels had it in their desktop file: notifications,
sharing, sound and user-accounts. These entries can also be removed.

After removing the `X-GNOME-Bugzilla-*` entries, the desktop files have
no more variables in them. The meson `configure_file` step is therefor
pointless—there are no variables to configure. As such the
`*.desktop.in.in` files are renamed to `*.desktop.in` to reflect this
and `meson.build` files are modified to remove `configure_file` step.
2022-10-20 13:20:09 +00:00
Sebastian Keller
7f6dc4511f tests: Add test for keyboard shortcut normalization
This tests if the shortcuts generated from an event are in the format
that the shell expects.
2022-08-22 12:49:13 +00:00
Sebastian Keller
bad61a2229 keyboard: Handle shift shortcut modifier the same way as the shell does
The way shortcuts in mutter/gnome-shell work is that it looks up the
keycode that generates the shortcut keyval at the lowest shift level and
then checks if all the modifiers match. This does not work for shortcuts
that for example include "dollar" to represent "<Shift>4", because on
some keyboards/layout there is a separate dollar key key with its own
keycode. This would be at a lower shift level than "<Shift>4".

By always translating such shortcuts to "<Shift>number", we make sure
the resulting shortcut will work in the shell and is closer to what the
user likely intended the shortcut to be, because numbers are usually
assigned to things that can be enumerated, such as workspaces or
favorite applications.

This also special cases the num-row key on layouts such as AZERTY, where
the number is the shifted keyval, to always prefer the number. Due to
the way the shell interprets these shortcuts, they still work and by
always using numbers they work across different layouts.

This change also fixes that pressing "<Shift><Super>4" was turned into
"<Shift><Super>dollar", which effectively included the "<Shift>" twice.

Fixes: https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/1528
2022-08-22 12:49:13 +00:00