application: Support dark style preference

Depend on libhandy 1.5.0.
This commit is contained in:
Alexander Mikhaylenko
2021-12-11 17:25:49 +05:00
parent d6d087bcd8
commit 7144300a49
3 changed files with 10 additions and 5 deletions
+6 -4
View File
@@ -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);
}
}
+3
View File
@@ -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);