[gnome-shell/wip/sass] main: Add support for -high-contrast theme variants
- From: Jakub Steiner <jimmac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/sass] main: Add support for -high-contrast theme variants
- Date: Thu, 8 Jan 2015 10:06:29 +0000 (UTC)
commit 3cb61dabc4fdbfd5841c476aa8eb3f3dcb24e428
Author: Florian Müllner <fmuellner gnome org>
Date: Sat Nov 29 13:37:19 2014 +0000
main: Add support for -high-contrast theme variants
While the default Shell style is fairly decent with regard to
accessibility requirements, having the ability to tweak certain
aspects where the regular style works less well is still useful.
For this purpose, try to load a -high-contrast theme variant of
the default stylesheet when a high-contrast theme is requested
(as determined by the GTK+ theme name).
https://bugzilla.gnome.org/show_bug.cgi?id=740447
js/ui/main.js | 30 +++++++++++++++++++++++-------
1 files changed, 23 insertions(+), 7 deletions(-)
---
diff --git a/js/ui/main.js b/js/ui/main.js
index 36d7591..0b22a36 100644
--- a/js/ui/main.js
+++ b/js/ui/main.js
@@ -4,6 +4,7 @@ const Clutter = imports.gi.Clutter;
const Gdk = imports.gi.Gdk;
const Gio = imports.gi.Gio;
const GLib = imports.gi.GLib;
+const Gtk = imports.gi.Gtk;
const Lang = imports.lang;
const Mainloop = imports.mainloop;
const Meta = imports.gi.Meta;
@@ -75,7 +76,8 @@ let _cssStylesheet = null;
let _a11ySettings = null;
function _sessionUpdated() {
- _loadDefaultStylesheet();
+ if (sessionMode.isPrimary)
+ _loadDefaultStylesheet();
wm.setCustomKeybindingHandler('panel-main-menu',
Shell.KeyBindingMode.NORMAL |
@@ -109,6 +111,8 @@ function start() {
sessionMode = new SessionMode.SessionMode();
sessionMode.connect('updated', _sessionUpdated);
+ Gtk.Settings.get_default().connect('notify::gtk-theme-name',
+ _loadDefaultStylesheet);
_initializeUI();
shellDBusService = new ShellDBus.GnomeShell();
@@ -225,24 +229,36 @@ function _initializeUI() {
});
}
-function _getDefaultStylesheet() {
+function _getStylesheet(name) {
let stylesheet;
- stylesheet = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/' + sessionMode.stylesheetName);
+ stylesheet = Gio.File.new_for_uri('resource:///org/gnome/shell/theme/' + name);
if (stylesheet.query_exists(null))
return stylesheet;
- stylesheet = Gio.File.new_for_path(global.datadir + '/theme/' + sessionMode.stylesheetName);
+ stylesheet = Gio.File.new_for_path(global.datadir + '/theme/' + name);
if (stylesheet.query_exists(null))
return stylesheet;
return null;
}
-function _loadDefaultStylesheet() {
- if (!sessionMode.isPrimary)
- return;
+function _getDefaultStylesheet() {
+ let stylesheet = null;
+ let name = sessionMode.stylesheetName;
+ // Look for a high-contrast variant first when using GTK+'s HighContrast
+ // theme
+ if (Gtk.Settings.get_default().gtk_theme_name == 'HighContrast')
+ stylesheet = _getStylesheet(name.replace('.css', '-high-contrast.css'));
+
+ if (stylesheet == null)
+ stylesheet = _getStylesheet(sessionMode.stylesheetName);
+
+ return stylesheet;
+}
+
+function _loadDefaultStylesheet() {
let stylesheet = _getDefaultStylesheet();
if (_defaultCssStylesheet && _defaultCssStylesheet.equal(stylesheet))
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]