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



commit d0d4c05fc26c39a27a3e17456153a7a3fc0d8d51
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 e28a25657..d66d1b8b0 100644
--- a/js/ui/main.js
+++ b/js/ui/main.js
@@ -87,6 +87,7 @@ let _cssStylesheet = null;
 let _a11ySettings = null;
 let _themeResource = null;
 let _oskResource = null;
+let _interfaceSettings = null;
 
 function _sessionUpdated() {
     if (sessionMode.isPrimary)
@@ -126,8 +127,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();
 
@@ -276,7 +278,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]