comparison src/sys/glib/dark_theme.cc @ 236:4d461ef7d424

HUGE UPDATE: convert build system to autotools why? because cmake sucks :)
author Paper <mrpapersonic@gmail.com>
date Fri, 19 Jan 2024 00:24:02 -0500
parents ff0061e75f0f
children c130f47f6f48
comparison
equal deleted inserted replaced
235:593108b3d555 236:4d461ef7d424
4 #include <iostream> 4 #include <iostream>
5 5
6 namespace glib { 6 namespace glib {
7 7
8 bool IsInDarkTheme() { 8 bool IsInDarkTheme() {
9 GSettings* settings = g_settings_new("org.gnome.desktop.interface"); 9 GSettings* settings = ::g_settings_new("org.gnome.desktop.interface");
10 if (!settings) 10 if (!settings)
11 return false; 11 return false;
12 12
13 GVariant* val = g_settings_get_value(settings, "color-scheme"); 13 GVariant* val = ::g_settings_get_value(settings, "color-scheme");
14 if (!val) 14 if (!val)
15 return false; 15 return false;
16 16
17 const gchar* str; 17 const gchar* str;
18 g_variant_get(val, "&s", &str); /* should not be freed */ 18 ::g_variant_get(val, "&s", &str); /* should not be freed */
19 if (!str) /* how */ 19 if (!str) /* how */
20 return false; 20 return false;
21 21
22 bool success = !std::strcmp(str, "prefer-dark"); 22 bool success = !std::strcmp(str, "prefer-dark");
23 23
24 /* unref these */ 24 /* unref these */
25 g_variant_unref(val); 25 ::g_variant_unref(val);
26 g_object_unref(settings); 26 ::g_object_unref(settings);
27 27
28 return success; 28 return success;
29 } 29 }
30 30
31 } 31 }