Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is_12h: Make Granite use defaults from desktop settings #525

Open
marbetschar opened this issue Sep 10, 2021 · 1 comment
Open

is_12h: Make Granite use defaults from desktop settings #525

marbetschar opened this issue Sep 10, 2021 · 1 comment
Labels
Needs Design Waiting for input from the UX team Priority: Wishlist Not a bug; but a new feature or enhancement

Comments

@marbetschar
Copy link
Member

Problem

There are quite a lot of places on the desktop where we'd like to display a time to the user. To use the correct format we can use Granite.DateTime.get_default_time_format.

However, this function does not provide a reasonable default value for its is_12h argument because its hard coded. But in user facing cases we want to respect the time setting of the user so there are a bunch of cases where we need to retrieve the setting and pass the correct value to Granite. Namely Tasks, Calendar and Mail - potentially others:

https://github.com/search?q=org%3Aelementary+get_default_time_format&type=code

Proposal

The example above is specific to one case, but maybe there are other similar things I'm missing here? If there is more to this than the 24h time format, then it would be beneficial to tell granite it should use the user settings instead of having them hard wired in the code. If the 24h time format is the only one, then it would be great to have its default set to whatever the user is expecting.

Prior Art

  • I've seen there is Granite.Settings - but I'm not sure if that can be used for this case: https://valadoc.org/granite/Granite.Settings.html
  • Granite itself already implements a (private) helper function for detecting the right default value for the 24h format:

    granite/lib/DateTime.vala

    Lines 98 to 102 in 7190ee8

    private static bool is_clock_format_12h () {
    var h24_settings = new GLib.Settings ("org.gnome.desktop.interface");
    var format = h24_settings.get_string ("clock-format");
    return (format.contains ("12h"));
    }
@marbetschar marbetschar added Priority: Wishlist Not a bug; but a new feature or enhancement Needs Design Waiting for input from the UX team labels Sep 10, 2021
@marbetschar marbetschar changed the title Make Granite use defaults from desktop settings whenever possible is_12h: Make Granite use defaults from desktop settings Sep 10, 2021
@marbetschar
Copy link
Member Author

marbetschar commented Sep 10, 2021

Related to #522 and #527

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Design Waiting for input from the UX team Priority: Wishlist Not a bug; but a new feature or enhancement
Projects
None yet
Development

No branches or pull requests

1 participant