elementary / granite

Library that extends GTK with common widgets and utilities
https://elementary.io
GNU Lesser General Public License v3.0
289 stars 61 forks source link

is_12h: Make Granite use defaults from desktop settings #525

Open marbetschar opened 3 years ago

marbetschar commented 3 years ago

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

marbetschar commented 3 years ago

Related to https://github.com/elementary/granite/issues/522 and https://github.com/elementary/granite/pull/527