[gnome-calendar/wip/exalm/dark: 2/3] application: Support dark style preference
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar/wip/exalm/dark: 2/3] application: Support dark style preference
- Date: Sat, 11 Dec 2021 15:40:06 +0000 (UTC)
commit 7144300a49c0e62f000726ab8a8d9f16eb9715c9
Author: Alexander Mikhaylenko <alexm gnome org>
Date: Sat Dec 11 17:25:03 2021 +0500
application: Support dark style preference
Depend on libhandy 1.5.0.
meson.build | 2 +-
src/core/gcal-night-light-monitor.c | 10 ++++++----
src/gui/gcal-application.c | 3 +++
3 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/meson.build b/meson.build
index 7bc38e55..43b80e41 100644
--- a/meson.build
+++ b/meson.build
@@ -164,7 +164,7 @@ libedataserver_dep = dependency('libedataserver-1.2', version: '>= 3.17.1')
libecal_dep = dependency('libecal-2.0', version: '>= 3.33.2')
libsoup_dep = dependency('libsoup-2.4')
libdazzle_dep = dependency('libdazzle-1.0', version: '>= 3.33.1')
-libhandy_dep = dependency('libhandy-1', version: '>= 1.0.0')
+libhandy_dep = dependency('libhandy-1', version: '>= 1.5.0')
glib_dep = dependency('glib-2.0', version: '>= 2.67.5')
gtk_dep = dependency('gtk+-3.0', version: '>= 3.22.20')
gio_dep = dependency('gio-2.0', version: '>= 2.58.0')
diff --git a/src/core/gcal-night-light-monitor.c b/src/core/gcal-night-light-monitor.c
index 293cc687..481a1219 100644
--- a/src/core/gcal-night-light-monitor.c
+++ b/src/core/gcal-night-light-monitor.c
@@ -67,10 +67,12 @@ on_night_light_proxy_properties_changed_cb (GcalNightLightMonitor *self,
activev = g_dbus_proxy_get_cached_property (proxy, "NightLightActive");
active = g_variant_get_boolean (activev);
- g_object_set (gtk_settings_get_default (),
- "gtk-application-prefer-dark-theme",
- active,
- NULL);
+ if (active)
+ hdy_style_manager_set_color_scheme (hdy_style_manager_get_default (),
+ HDY_COLOR_SCHEME_PREFER_DARK);
+ else
+ hdy_style_manager_set_color_scheme (hdy_style_manager_get_default (),
+ HDY_COLOR_SCHEME_PREFER_LIGHT);
}
}
diff --git a/src/gui/gcal-application.c b/src/gui/gcal-application.c
index 5d680723..0bd32816 100644
--- a/src/gui/gcal-application.c
+++ b/src/gui/gcal-application.c
@@ -362,6 +362,9 @@ gcal_application_startup (GApplication *app)
/* initialize libhandy */
hdy_init();
+ hdy_style_manager_set_color_scheme (hdy_style_manager_get_default (),
+ HDY_COLOR_SCHEME_PREFER_LIGHT);
+
/* Startup the manager */
gcal_context_startup (self->context);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]