Browse files

Merge branch 'kaspers-gsettings-array-fix'

* kaspers-gsettings-array-fix:
  Kasper's fix to gsettingsBridge for new payload structure without array wrapper.
  • Loading branch information...
2 parents 160f4ef + 3ba3a13 commit 7a9a968ef1d0700a63bc37f27d13d061e83d14be @colinbdclark colinbdclark committed Jun 7, 2012
View
68 node_modules/gsettingsBridge/gsettings_bridge.js
@@ -25,54 +25,48 @@ https://github.com/gpii/universal/LICENSE.txt
gpii.gsettings = gpii.gsettings || {};
gpii.gsettings.get = function(settingsarray) {
- var togo = fluid.copy(settingsarray);
- for (var i = 0; i < togo.length; i++) {
- var app = togo[i];
- for (var appId in app) {
- for (var j = 0; j < app[appId].length; j++) {
- var schemaId = app[appId][j].options.schema;
- var settings = app[appId][j].settings;
- if (settings === null) {
- var keys = nodeGSettings.get_gsetting_keys(schemaId);
- app[appId][j].settings = {};
- for (var k = 0; k < keys.length; k++) {
- var key = keys[k];
- app[appId][j].settings[key] = nodeGSettings.get_gsetting(schemaId,key);
- }
+ var app = fluid.copy(settingsarray);
+ for (var appId in app) {
+ for (var j = 0; j < app[appId].length; j++) {
+ var schemaId = app[appId][j].options.schema;
+ var settings = app[appId][j].settings;
+ if (settings === null) {
+ var keys = nodeGSettings.get_gsetting_keys(schemaId);
+ app[appId][j].settings = {};
+ for (var k = 0; k < keys.length; k++) {
+ var key = keys[k];
+ app[appId][j].settings[key] = nodeGSettings.get_gsetting(schemaId,key);
}
- else {
- for (var settingKey in settings) {
- settings[settingKey] = nodeGSettings.get_gsetting(schemaId,settingKey);
- }
-
+ }
+ else {
+ for (var settingKey in settings) {
+ settings[settingKey] = nodeGSettings.get_gsetting(schemaId,settingKey);
}
+
}
}
}
- return togo;
+ return app;
};
gpii.gsettings.set = function(settingsarray) {
- var togo = fluid.copy(settingsarray);
- for (var i = 0; i < togo.length; i++) {
- var app = togo[i];
- for (var appId in app) {
- for (var j = 0; j < app[appId].length; j++) {
- var schemaId = app[appId][j].options.schema;
- var settings = app[appId][j].settings;
- for (var settingKey in settings) {
- var value = settings[settingKey];
- var oldValue = nodeGSettings.get_gsetting(schemaId,settingKey);
- nodeGSettings.set_gsetting(schemaId,settingKey,value);
- settings[settingKey] = {
- "oldValue": oldValue,
- "newValue": value
- };
- }
+ var app = fluid.copy(settingsarray);
+ for (var appId in app) {
+ for (var j = 0; j < app[appId].length; j++) {
+ var schemaId = app[appId][j].options.schema;
+ var settings = app[appId][j].settings;
+ for (var settingKey in settings) {
+ var value = settings[settingKey];
+ var oldValue = nodeGSettings.get_gsetting(schemaId,settingKey);
+ nodeGSettings.set_gsetting(schemaId,settingKey,value);
+ settings[settingKey] = {
+ "oldValue": oldValue,
+ "newValue": value
+ };
}
}
}
- return togo;
+ return app;
}
})();
View
38 node_modules/gsettingsBridge/tests/data/com.gnome.builtin.magnification.example-GET.json
@@ -1,21 +1,19 @@
-[
- {
- "com.gnome.builtin.magnification": [
- {
- "settings": {
- "cross-hairs-clip": false,
- "cross-hairs-color": "#ff0020"
- },
- "options": {
- "schema": "org.gnome.desktop.a11y.magnifier"
- }
- },
- {
- "settings": null,
- "options": {
- "schema": "org.gnome.desktop.a11y.mouse"
- }
+{
+ "com.gnome.builtin.magnification": [
+ {
+ "settings": {
+ "cross-hairs-clip": false,
+ "cross-hairs-color": "#ff0020"
+ },
+ "options": {
+ "schema": "org.gnome.desktop.a11y.magnifier"
}
- ]
- }
-]
+ },
+ {
+ "settings": null,
+ "options": {
+ "schema": "org.gnome.desktop.a11y.mouse"
+ }
+ }
+ ]
+}
View
42 node_modules/gsettingsBridge/tests/data/com.gnome.builtin.magnification.example.json
@@ -1,23 +1,21 @@
-[
- {
- "com.gnome.builtin.magnification": [
- {
- "settings": {
- "cross-hairs-clip": true,
- "cross-hairs-color": "#ff0020"
- },
- "options": {
- "schema": "org.gnome.desktop.a11y.magnifier"
- }
- },
- {
- "settings": {
- "dwell-threshold": 11
- },
- "options": {
- "schema": "org.gnome.desktop.a11y.mouse"
- }
+{
+ "com.gnome.builtin.magnification": [
+ {
+ "settings": {
+ "cross-hairs-clip": true,
+ "cross-hairs-color": "#ff0020"
+ },
+ "options": {
+ "schema": "org.gnome.desktop.a11y.magnifier"
}
- ]
- }
-]
+ },
+ {
+ "settings": {
+ "dwell-threshold": 11
+ },
+ "options": {
+ "schema": "org.gnome.desktop.a11y.mouse"
+ }
+ }
+ ]
+}
View
4 node_modules/gsettingsBridge/tests/data/gmag-get-test.json
@@ -1,4 +1,4 @@
-[{
+{
"org.gnome.desktop.a11y.magnifier": {
"cross-hairs-clip": null,
"cross-hairs-color": null,
@@ -14,4 +14,4 @@
}
}, {
"org.gnome.desktop.a11y.keyboard": null
-}]
+}
View
4 node_modules/gsettingsBridge/tests/data/gmag-orig.json
@@ -1,4 +1,4 @@
-[{
+{
"org.gnome.desktop.a11y.magnifier": {
"settings": {
"cross-hairs-clip": false,
@@ -16,4 +16,4 @@
"options": {
}
}
-}]
+}
View
4 node_modules/gsettingsBridge/tests/data/gmag-test1.json
@@ -1,4 +1,4 @@
-[{
+{
"org.gnome.desktop.a11y.magnifier": {
"cross-hairs-clip": false,
"cross-hairs-color": "#ff0000",
@@ -12,4 +12,4 @@
"scroll-at-edges": false,
"show-cross-hairs": false
}
-}]
+}

0 comments on commit 7a9a968

Please sign in to comment.