[gnome-shell] status/a11y: invert connection to changes and initial read
- From: Giovanni Campagna <gcampagna src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] status/a11y: invert connection to changes and initial read
- Date: Fri, 27 Mar 2015 20:13:57 +0000 (UTC)
commit 49fe0335ee1d00a1df2b898368a30832522f10b4
Author: Giovanni Campagna <gcampagna gnome org>
Date: Fri Mar 20 12:42:51 2015 -0700
status/a11y: invert connection to changes and initial read
If there is no signal connected to changed, get_value() will
not subscribe to notifications and we might miss changes.
https://bugzilla.gnome.org/show_bug.cgi?id=746509
js/ui/status/accessibility.js | 68 +++++++++++++++++++++--------------------
1 files changed, 35 insertions(+), 33 deletions(-)
---
diff --git a/js/ui/status/accessibility.js b/js/ui/status/accessibility.js
index 5047a28..4ecbc8d 100644
--- a/js/ui/status/accessibility.js
+++ b/js/ui/status/accessibility.js
@@ -119,23 +119,46 @@ const ATIndicator = new Lang.Class({
_buildItem: function(string, schema, key) {
let settings = new Gio.Settings({ schema_id: schema });
+ settings.connect('changed::'+key, Lang.bind(this, function() {
+ widget.setToggleState(settings.get_boolean(key));
+
+ this._queueSyncMenuVisibility();
+ }));
+
let widget = this._buildItemExtended(string,
settings.get_boolean(key),
settings.is_writable(key),
function(enabled) {
return settings.set_boolean(key, enabled);
});
- settings.connect('changed::'+key, Lang.bind(this, function() {
- widget.setToggleState(settings.get_boolean(key));
-
- this._queueSyncMenuVisibility();
- }));
return widget;
},
_buildHCItem: function() {
let interfaceSettings = new Gio.Settings({ schema_id: DESKTOP_INTERFACE_SCHEMA });
let wmSettings = new Gio.Settings({ schema_id: WM_SCHEMA });
+ interfaceSettings.connect('changed::' + KEY_GTK_THEME, Lang.bind(this, function() {
+ let value = interfaceSettings.get_string(KEY_GTK_THEME);
+ if (value == HIGH_CONTRAST_THEME) {
+ highContrast.setToggleState(true);
+ } else {
+ highContrast.setToggleState(false);
+ gtkTheme = value;
+ }
+
+ this._queueSyncMenuVisibility();
+ }));
+ interfaceSettings.connect('changed::' + KEY_ICON_THEME, function() {
+ let value = interfaceSettings.get_string(KEY_ICON_THEME);
+ if (value != HIGH_CONTRAST_THEME)
+ iconTheme = value;
+ });
+ wmSettings.connect('changed::' + KEY_WM_THEME, function() {
+ let value = wmSettings.get_string(KEY_WM_THEME);
+ if (value != HIGH_CONTRAST_THEME)
+ wmTheme = value;
+ });
+
let gtkTheme = interfaceSettings.get_string(KEY_GTK_THEME);
let iconTheme = interfaceSettings.get_string(KEY_ICON_THEME);
let wmTheme = wmSettings.get_string(KEY_WM_THEME);
@@ -161,32 +184,18 @@ const ATIndicator = new Lang.Class({
wmSettings.reset(KEY_WM_THEME);
}
});
- interfaceSettings.connect('changed::' + KEY_GTK_THEME, Lang.bind(this, function() {
- let value = interfaceSettings.get_string(KEY_GTK_THEME);
- if (value == HIGH_CONTRAST_THEME) {
- highContrast.setToggleState(true);
- } else {
- highContrast.setToggleState(false);
- gtkTheme = value;
- }
-
- this._queueSyncMenuVisibility();
- }));
- interfaceSettings.connect('changed::' + KEY_ICON_THEME, function() {
- let value = interfaceSettings.get_string(KEY_ICON_THEME);
- if (value != HIGH_CONTRAST_THEME)
- iconTheme = value;
- });
- wmSettings.connect('changed::' + KEY_WM_THEME, function() {
- let value = wmSettings.get_string(KEY_WM_THEME);
- if (value != HIGH_CONTRAST_THEME)
- wmTheme = value;
- });
return highContrast;
},
_buildFontItem: function() {
let settings = new Gio.Settings({ schema_id: DESKTOP_INTERFACE_SCHEMA });
+ settings.connect('changed::' + KEY_TEXT_SCALING_FACTOR, Lang.bind(this, function() {
+ let factor = settings.get_double(KEY_TEXT_SCALING_FACTOR);
+ let active = (factor > 1.0);
+ widget.setToggleState(active);
+
+ this._queueSyncMenuVisibility();
+ }));
let factor = settings.get_double(KEY_TEXT_SCALING_FACTOR);
let initial_setting = (factor > 1.0);
@@ -200,13 +209,6 @@ const ATIndicator = new Lang.Class({
else
settings.reset(KEY_TEXT_SCALING_FACTOR);
});
- settings.connect('changed::' + KEY_TEXT_SCALING_FACTOR, Lang.bind(this, function() {
- let factor = settings.get_double(KEY_TEXT_SCALING_FACTOR);
- let active = (factor > 1.0);
- widget.setToggleState(active);
-
- this._queueSyncMenuVisibility();
- }));
return widget;
}
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]