Do not use GNOME specific setting for 24 hours

This commit is contained in:
Marvin W 2020-05-05 13:20:36 +02:00
parent c6173db983
commit 1f506cec42
No known key found for this signature in database
GPG key ID: 072E9235DB996F2A

View file

@ -246,11 +246,13 @@ public static bool is_dark_theme(Gtk.Widget widget) {
return (bg.red > 0.5 && bg.green > 0.5 && bg.blue > 0.5); return (bg.red > 0.5 && bg.green > 0.5 && bg.blue > 0.5);
} }
private static uint8 is24h = 0;
public static bool is_24h_format() { public static bool is_24h_format() {
GLib.Settings settings = new GLib.Settings("org.gnome.desktop.interface"); if (is24h == 0) {
string settings_format = settings.get_string("clock-format");
string p_format = (new DateTime.now_utc()).format("%p"); string p_format = (new DateTime.now_utc()).format("%p");
return settings_format == "24h" || p_format == " "; is24h = p_format.strip() == "" ? 1 : -1;
}
return is24h == 1;
} }
public static Regex get_url_regex() { public static Regex get_url_regex() {