Commit graph

132 commits

Author SHA1 Message Date
Pablo Correa Gómez
b9a684dc1d region: fix warning of uninitialized variables
../panels/region/cc-region-panel.c: In function 'set_restart_notification_visible':
../panels/region/cc-region-panel.c:131:17: warning: 'current_locale' may be used uninitialized [-Wmaybe-uninitialized]
  131 |                 uselocale (current_locale);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~
../panels/region/cc-region-panel.c:115:18: note: 'current_locale' was declared here
  115 |         locale_t current_locale;
      |                  ^~~~~~~~~~~~~~
../panels/region/cc-region-panel.c:130:34: warning: 'new_locale' may be used uninitialized [-Wmaybe-uninitialized]
  130 |         if (locale && new_locale != (locale_t) 0) {
      |                       ~~~~~~~~~~~^~~~~~~~~~~~~~~
../panels/region/cc-region-panel.c:114:18: note: 'new_locale' was declared here
  114 |         locale_t new_locale;
      |                  ^~~~~~~~~~
2022-08-20 20:47:35 +00:00
Pablo Correa Gómez
32b5e5dcb3 region: fix permissions_acquired always returning FALSE 2022-08-20 20:47:35 +00:00
Jan Tojnar
c9448f76c2 region: Fix critical when changing language
Changing user’s language resets the formats (region) by passing `NULL` to `update_region`.
However, updating the region calls `maybe_notify`, whose callback `maybe_notify_finish`
tries to parse the `mnd->target_locale` (the `NULL`), producing a critical:

    GLib-CRITICAL **: g_regex_match_full: assertion 'string != NULL' failed

Since updating the language itself already triggers the notification check,
let’s just skip calling `maybe_notify` here in that case.
2022-05-26 19:05:16 +00:00
Georges Basile Stavracas Neto
6f2875e467 region: Replace "Login Screen" toggle button by section
Rework the panel to have 2 groups: the user's language and
format; and the login screen's language and format. Remove
the now unused bottom label explainig the login screen.

Special-casing of single user systems is still present.

Related: https://gitlab.gnome.org/GNOME/gnome-control-center/-/issues/1587
2022-02-07 07:03:42 -03:00
Georges Basile Stavracas Neto
6ed208221f region: Switch formats row to AdwActionRow 2022-02-07 07:03:42 -03:00
Georges Basile Stavracas Neto
ae93012543 region: Switch language row to AdwActionRow 2022-02-07 07:03:42 -03:00
Georges Basile Stavracas Neto
01e7544827 region: Move logout message to an infobar
As per mockups. Also adjust the wording of the info bar label.
2022-02-07 07:03:37 -03:00
Georges Basile Stavracas Neto
ddf6ca9952 region: Port to GTK4
An uneventful port.
2021-12-14 22:34:21 -03:00
Felipe Erias Morandeira
1d952d4ebd region: replace the "Login Screen" button
...on the title bar with joined toggles (like in Background panel) for a
clearer UI.

Note 2020-08-26: This patch has been in Endless OS since 2014. It seems
  like a good UX change, so I'm proposing it upstream with some minor
  changes. - mwleeds
2021-08-02 12:03:40 +12:00
Mario Sanchez Prada
92da5b6783 region: update the locale format along with the language when it changes
Not doing this will lead to (probably undesired) inconsistencies when
changing the language, since many locale-dependant strings will still be
rendered considering the previous language format (e.g. days of the week).

Note 2020-08-26: This patch has been in Endless OS since 2015, proposing
  it upstream. - mwleeds
2021-01-10 21:01:20 +00:00
Ian Douglas Scott
9366de52cd region: "Language" and "Format" headers and descriptions 2020-12-18 07:55:41 -08:00
Ian Douglas Scott
8996ffac88 Move input sources from region panel to keyboard panel 2020-12-18 07:55:41 -08:00
Ian Douglas Scott
c3c5d724bd region: move input source ListBox code into it's own class 2020-09-14 22:07:36 +00:00
Robert Ancell
93b14a4339 panel: Move shared GCancellable code into panel class
Make the panel class provide a cancellable that will be cancelled when the panel
is destroyed. Panel implementations can use this and not have to mangage the
cancellable themselves. Consolidate cases where panels had multiple cancellables
that were all being used for this behaviour.
2020-02-03 09:36:24 +13:00
Benjamin Berg
7631faa88f region: Explicitly update LC_* even when matching LANG
localed will not update the LC_* variables if they are not given. This
means that should the user switch the formats away from LANG and then
back, they will not be reset appropriately.

Simply always setting the variables even if the match will fix this.
2019-10-17 00:32:34 +00:00
Philip Chimento
412472c16d region: Fix crash in keyboard layout population
The previous code would crash if 'variants' was null and 'layouts' had
more than one element in it.
2019-09-12 18:10:20 +00:00
Michael Catanzaro
a22da99aaf Replace unsafe setlocale() use with uselocale()
setlocale() is not threadsafe except when used only to query the locale
without changing it. Let's use uselocale() instead, which changes the
locale only on the calling thread. Much better.
2019-07-03 17:15:33 -05:00
Georges Basile Stavracas Neto
75f150d5a2 shell: Add position to cc_shell_embed_widget_in_header()
So we can control where the widget should be added to. The
main window only supports left and right positions.

https://gitlab.gnome.org/GNOME/gnome-control-center/issues/528
2019-05-21 12:59:36 -03:00
Robert Ancell
d34bbda386 region: Fix input source options not being applied.
This was broken in a86cf1eca2 (3.32) when the input options dialog was converted
into a GtkPopover. Previously two GSettings objects were used, with one set to
'delay-apply' mode. The input source option didn't apply the changes.

The 'delay-apply' mode is from the original commit d3852fc831, however code was
simplified in b3199dd to only set one setting. This meant that the delay is no
longer necessary.

Fixes #440
2019-04-09 14:14:31 +12:00
Robert Ancell
03f516174d region: Stop input list being scrollable
The new add row should always be visibile and this list is not likely
to contain many rows. The panel is scrollable so this handles this edge case.
2019-02-04 13:56:41 +00:00
Robert Ancell
18007a17c1 region: Make rows reorderable with drag and drop
Drop toolbar - all functionality is now in rows.

This matches the new designs in
https://gitlab.gnome.org/Teams/Design/settings-mockups/blob/master/region-and-language/region-and-language.png
2019-02-04 13:56:41 +00:00
Robert Ancell
4d5626d066 region: Convert add input button to a row
This matches the new designs in
https://gitlab.gnome.org/Teams/Design/settings-mockups/blob/master/region-and-language/region-and-language.png
2019-02-04 13:56:41 +00:00
Robert Ancell
a193417b32 region: Reduce size of input rows
This matches the new designs in
https://gitlab.gnome.org/Teams/Design/settings-mockups/blob/master/region-and-language/region-and-language.png
2019-02-04 13:56:41 +00:00
Robert Ancell
0a70d5ab34 region: Move input settings button inside each row
This matches the new designs in
https://gitlab.gnome.org/Teams/Design/settings-mockups/blob/master/region-and-language/region-and-language.png
2019-02-04 13:56:41 +00:00
Robert Ancell
7a9d2b83df region: Move show layout button inside each row
This matches the new designs in
https://gitlab.gnome.org/Teams/Design/settings-mockups/blob/master/region-and-language/region-and-language.png
2019-02-04 13:56:41 +00:00
Robert Ancell
d4683a9ddd region: Move remove button inside each row
This matches the new designs in
https://gitlab.gnome.org/Teams/Design/settings-mockups/blob/master/region-and-language/region-and-language.png
2019-02-04 13:56:41 +00:00
Robert Ancell
9285c4392e region: Use CcInputRow type in RowData 2019-02-04 13:56:40 +00:00
Robert Ancell
4f6e897b58 region: Use g_signal_connect_object for all signal handlers
This ensures they wont be called when the handling object is destroyed.
Also connect all in "swapped" form for improved readability.
2018-11-05 11:07:58 +00:00
Robert Ancell
9c655bfba0 region: Create classes for input sources 2018-10-24 04:50:29 +00:00
Robert Ancell
1ea0f875ee region: Update CcInputChooser GTK+ code
- Move more code into the .ui file
- Don't save the dialog between runs - it's cheap to generate on demand
- Hold references on data passed to dialog
- Connect signals in "swapped" form
- Use standard naming format for signal callbacks
2018-10-17 22:34:52 +00:00
Robert Ancell
b76baab697 region: Refactor input modification code to be async safe.
The previous code had a number of issues:
- It used a shared 'op' enum value for the operation - a second operation would
  overwrite this.
- It acted on the row selected at the time the operation was requested - this
  could have changed by the time the operation occurred.

Solved by passing all the required data though the async methods.
2018-10-11 22:30:38 +00:00
Robert Ancell
70fe645502 region: Tidy up GtkWidget variables
- Use correct types for each widget
- Put variables together in alphabetical order in the class
- Drop unused IDs
- Rename .ui file to match .c file
2018-10-10 23:04:10 +00:00
Andrea Azzarone
88ca2fcdc4 region: Autodisconnect IBusBus "connected" handler
Use g_signal_connect_object to ensure handler is not run after object is
destroyed.

Fixes: GNOME/gnome-control-center#223
2018-10-08 13:09:10 +01:00
Robert Ancell
a2daee0c7f region: Use GtkTemplate for input chooser dialog 2018-09-19 16:31:47 +02:00
Robert Ancell
5d167f024f region: Simplify placeholder input row
Instead of adding/removing a row, create one in the .ui file and show/hide it.
2018-09-17 09:37:45 +02:00
Robert Ancell
a86cf1eca2 region: Use a GtkPopover instead of GtkDialog for input options
As per design:
https://wiki.gnome.org/Design/SystemSettings/RegionAndLanguage
2018-09-14 15:47:36 +00:00
Robert Ancell
66981da275 region: Make full widget for input rows
The row widgets are not full GtkWidgets. This means they are harder
to understand, use g_object_set_data which looses type safety and
cause the one .c file to be overly large.

Update this code to use a CcInputRow widget that uses GTK+ best
practice.
2018-09-11 10:40:27 +12:00
Robert Ancell
37d02369b7 region: Cancel async permission requests when panel is closed 2018-09-10 15:45:31 +00:00
Robert Ancell
d4340c4efc region: Fix language section not being marked insensitive
This is due to the widget not being extracted from region.ui and was introduced
in 5c418b8983.
2018-09-10 14:55:57 +00:00
Robert Ancell
0bdeb39319 region: Replace tab characters with spaces 2018-09-10 14:49:32 +00:00
Robert Ancell
b718a20713 region: Don't leak GFile objects
Creating the restart file leaked GFile objects. It also stored the path in the
object, which is unnecessary as it can just be generated on demand.

This leak has was introduced when the feature was in
db551f1c5d
2018-09-10 14:43:04 +00:00
Robert Ancell
f036b3a706 region: Remove duplicate cancellable code
There was a GCancellable used for IBus operations that was generated each time
an operation was done. The cancellable was only used to cancel such operations
when the panel is closed. We can just use the shared cancellable for this.
2018-09-10 15:51:53 +12:00
Georges Basile Stavracas Neto
fc29c0c5a8 Revert "region: Cache D-Bus proxy"
This reverts commit 10dfbb526e.
2018-08-27 12:56:20 +00:00
Robert Ancell
148e4c8fd0 common: Use GtkTemplate for the language chooser dialog 2018-07-18 22:39:32 +00:00
Robert Ancell
0f60dd1b71 region: Use GtkTemplate for format chooser dialog 2018-07-14 16:14:57 +00:00
Robert Ancell
556388f373 region: Fix small memory leak
Was introduced in 79e00c3
2018-07-02 21:52:03 +00:00
Robert Ancell
9a7850a7aa region: Move callbacks into .ui file 2018-06-03 00:41:58 +00:00
Georges Basile Stavracas Neto
d357f1de9e region: Remove unused variable 2018-05-30 17:42:07 -03:00
Robert Ancell
5c418b8983 region: Use GtkTemplate 2018-05-29 11:38:39 +12:00
Robert Ancell
5be47a16a5 region: Replace GObject boilerplace with G_DECLARE_TYPE 2018-05-29 11:27:04 +12:00