elementary / initial-setup

New user setup app designed for elementary OS
https://elementary.io
GNU General Public License v3.0
36 stars 12 forks source link

Set 24h format based on language #84

Closed meisenzahl closed 2 years ago

meisenzahl commented 4 years ago

I'm working on a solution to resolve #70

I still have to find a way to change the GLib.Settings for another user.

danirabbit commented 3 years ago

I guess it's probably a shorter list of locales that want 12 hrs than 24 hrs right?

And I think it's probably more highly correlated to physical location than language. For example for Spanish it appears that Spain would use 24hr but Mexico would use 12hr. From Wikipedia it looks like the list of 12-hr using countries are:

meisenzahl commented 3 years ago

The location is currently not configurable. Is this a design decision?

Is the time zone set based on the current location (libgeoclue)?

The time format could then be set automatically using the same logic.

danirabbit commented 3 years ago

No, it's just a missing feature. I agree we could have a screen to set the timezone and format and on this screen we could use GeoClue to try to guess defaults, but that depends on having working internet. so maybe we also need a screen to select a wireless network if internet is not already connected

meisenzahl commented 3 years ago

I added a screen to set the timezone. @danrabbit what's your opinion on setting the clock format based on timezone?

meisenzahl commented 3 years ago

List of countries using 12 hour format

@danrabbit I didn't find the link to the wikipedia article you mentioned. Could you provide the link for reference?

tintou commented 3 years ago

You don't need to hardcode the list of countries to get the 12h/24h, you can check if the current locale is using 12h by default by checking if Posix.nl_langinfo (Posix.NLItem.T_FMT) contains %r or %l or %I.

meisenzahl commented 3 years ago

@tintou thanks for your feedback. This allowed me to simplify the code.

Do you know if it is possible to change the GLib.Settings for another user?

danirabbit commented 3 years ago

@meisenzahl I guess what we probably want to do is write to accounts service and use the settings daemon to keep things in sync like we do with keyboard input methods

meisenzahl commented 3 years ago

set_timezone (), set_clock_format () and set_keyboard_layout () in MainWindow should all be implemented as async methods. @danrabbit is there a common way in Vala to chain async methods?

cassidyjames commented 3 years ago

@meisenzahl could you resolve conflicts here?

meisenzahl commented 3 years ago

@cassidyjames done 🙂️

marbetschar commented 2 years ago

@meisenzahl any chance you got some time you resolve the conflicts here ... again? :sweat_smile:

meisenzahl commented 2 years ago

@marbetschar done ✔️

marbetschar commented 2 years ago

@meisenzahl can you clarify how this can be tested? I compiled and started the freshly compiled app from a logged in user with 24h clock running sudo io.elementary.initial-setup. Then I selected US / New York during the initial setup as location. After the test user was added, I logged out and logged in again using the test user - but the clock is still set to 24h format.

meisenzahl commented 2 years ago

@marbetschar this only works in conjunction with https://github.com/elementary/settings-daemon/pull/10

But I have not tested this for a long time. It might be broken...

jeremypw commented 2 years ago

set_timezone (), set_clock_format () and set_keyboard_layout () in MainWindow should all be implemented as async methods. @danrabbit is there a common way in Vala to chain async methods?

You can chain async methods by using the yield keyword.

danirabbit commented 2 years ago

@meisenzahl apologies for asking you to resolve conflicts here yet again :sweat_smile: Now that we have the network view merged this should be unblocked

meisenzahl commented 2 years ago

@danrabbit done :heavy_check_mark:

danirabbit commented 2 years ago

Pushed to a branch on the project so it's easier to collab: https://github.com/elementary/initial-setup/pull/142