[gnome-shell/wip/carlosg/cleanup-gtk-usage: 39/40] main: Use GSettings instead of GtkSettings



commit 0cd06a8c5fe6a09d9806ede4cc6727e0378315d9
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Nov 27 14:59:09 2018 +0100

    main: Use GSettings instead of GtkSettings
    
    Cut a middle man by listening to dconf settings directly, and stop relying
    on XSettings for it.

 js/ui/main.js | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/main.js b/js/ui/main.js
index 6e2122273..84aefe7d5 100644
--- a/js/ui/main.js
+++ b/js/ui/main.js
@@ -88,6 +88,7 @@ let _cssStylesheet = null;
 let _a11ySettings = null;
 let _themeResource = null;
 let _oskResource = null;
+let _interfaceSettings = null;
 
 function _sessionUpdated() {
     if (sessionMode.isPrimary)
@@ -127,8 +128,9 @@ function start() {
 
     sessionMode = new SessionMode.SessionMode();
     sessionMode.connect('updated', _sessionUpdated);
-    Gtk.Settings.get_default().connect('notify::gtk-theme-name',
-                                       _loadDefaultStylesheet);
+
+    _interfaceSettings = new Gio.Settings({ schema_id: 'org.gnome.desktop.interface' });
+    _interfaceSettings.connect('changed::gtk-theme', _loadDefaultStylesheet);
     Gtk.IconTheme.get_default().add_resource_path('/org/gnome/shell/theme/icons');
     _initializeUI();
 
@@ -279,7 +281,7 @@ function _getDefaultStylesheet() {
 
     // Look for a high-contrast variant first when using GTK+'s HighContrast
     // theme
-    if (Gtk.Settings.get_default().gtk_theme_name == 'HighContrast')
+    if (_interfaceSettings.get_string('gtk-theme') == 'HighContrast')
         stylesheet = _getStylesheet(name.replace('.css', '-high-contrast.css'));
 
     if (stylesheet == null)


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