diff options
author | Marvin W <git@larma.de> | 2020-05-05 13:20:36 +0200 |
---|---|---|
committer | Marvin W <git@larma.de> | 2020-06-23 17:00:11 +0200 |
commit | 1f506cec428e9d5fb5a9340e954c8786c154a48f (patch) | |
tree | a8a595f86a6d82eb5e388dbc6afde489ac894178 | |
parent | c6173db98305ad8292e3fb17d4261f44cbba4040 (diff) | |
download | dino-1f506cec428e9d5fb5a9340e954c8786c154a48f.tar.gz dino-1f506cec428e9d5fb5a9340e954c8786c154a48f.zip |
Do not use GNOME specific setting for 24 hours
-rw-r--r-- | main/src/ui/util/helper.vala | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/main/src/ui/util/helper.vala b/main/src/ui/util/helper.vala index d5b5a2bb..f36eac5e 100644 --- a/main/src/ui/util/helper.vala +++ b/main/src/ui/util/helper.vala @@ -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); } +private static uint8 is24h = 0; public static bool is_24h_format() { - GLib.Settings settings = new GLib.Settings("org.gnome.desktop.interface"); - string settings_format = settings.get_string("clock-format"); - string p_format = (new DateTime.now_utc()).format("%p"); - return settings_format == "24h" || p_format == " "; + if (is24h == 0) { + string p_format = (new DateTime.now_utc()).format("%p"); + is24h = p_format.strip() == "" ? 1 : -1; + } + return is24h == 1; } public static Regex get_url_regex() { |