[gnome-weather/wip/cdavis/dark-style-pref: 2/2] Opt-in to libhandy dark style preference




commit daa0f6b7c2437279cf11760f6e1bfb82ada288cc
Author: Christopher Davis <christopherdavis gnome org>
Date:   Fri Sep 24 21:16:39 2021 -0700

    Opt-in to libhandy dark style preference

 src/app/main.js  | 4 ++++
 src/misc/util.js | 5 +++--
 2 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/app/main.js b/src/app/main.js
index 8292215..fafd18d 100644
--- a/src/app/main.js
+++ b/src/app/main.js
@@ -94,6 +94,10 @@ const Application = GObject.registerClass(
 
         Util.loadStyleSheet('/org/gnome/Weather/application.css');
 
+        Handy.StyleManager
+            .get_default()
+            .set_color_scheme(Handy.StyleManager.PREFER_LIGHT);
+
         this.world = GWeather.Location.get_world();
         this.model = new World.WorldModel(this.world, true);
         this.currentLocationController = new CurrentLocationController.CurrentLocationController(this.model);
diff --git a/src/misc/util.js b/src/misc/util.js
index 54538d9..bd00d83 100644
--- a/src/misc/util.js
+++ b/src/misc/util.js
@@ -28,6 +28,7 @@ const Gdk = imports.gi.Gdk;
 const Gio = imports.gi.Gio;
 const GLib = imports.gi.GLib;
 const Gtk = imports.gi.Gtk;
+const Handy = imports.gi.Handy;
 const System = imports.system;
 const GWeather = imports.gi.GWeather;
 
@@ -210,5 +211,5 @@ function getTempString(info) {
 }
 
 function isDarkTheme() {
-    return Gtk.Settings.get_default().gtk_theme_name.endsWith('-dark');
-}
\ No newline at end of file
+    return Handy.StyleManager.get_default().dark;
+}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]