Permalink
Browse files

Fixing up payload returns so they are cloned objects and not modifyin…

…g the original object. Fixing GET payload to match wiki spec for both partially filled and null schema requests. Adding a test file for GET payloads
  • Loading branch information...
1 parent 625b6ea commit 31218df5130f80413fd67c16ccee162dd2212ef4 @sgithens sgithens committed Apr 25, 2012
@@ -25,26 +25,33 @@ https://github.com/gpii/universal/LICENSE.txt
gpii.gsettings = gpii.gsettings || {};
gpii.gsettings.get = function(settingsarray) {
- var togo = settings; // TODO deep clone this
- for (var i = 0; i < settingsarray.length; i++) {
- var settings = settingsarray[i];
+ var togo = fluid.copy(settingsarray);
+ for (var i = 0; i < togo.length; i++) {
+ var settings = togo[i];
for (var schemaId in settings) {
+ if (settings[schemaId] === null) {
+ var keys = nodeGSettings.get_gsetting_keys(schemaId);
+ settings[schemaId] = {};
+ for (var k = 0; k < keys.length; k++) {
+ var key = keys[k];
+ settings[schemaId][key] = nodeGSettings.get_gsetting(schemaId,key);
+ }
+ }
for (var settingKey in settings[schemaId]) {
settings[schemaId][settingKey] = nodeGSettings.get_gsetting(schemaId,settingKey);
}
}
}
- return settings;
+ return togo;
};
gpii.gsettings.set = function(settingsarray) {
- var togo = settingsarray; //TODO deep clone this
- for (var i = 0; i < settingsarray.length; i++) {
- var settings = settingsarray[i];
+ var togo = fluid.copy(settingsarray);
+ for (var i = 0; i < togo.length; i++) {
+ var settings = togo[i];
for (var schemaId in settings) {
for (var settingKey in settings[schemaId].settings) {
var value = settings[schemaId].settings[settingKey];
- //util.puts("Going to set: "+schemaId+" : "+settingKey+" : "+value+"\n");
var oldValue = nodeGSettings.get_gsetting(schemaId,settingKey);
nodeGSettings.set_gsetting(schemaId,settingKey,value);
settings[schemaId].settings[settingKey] = {
@@ -0,0 +1,17 @@
+[{
+ "org.gnome.desktop.a11y.magnifier": {
+ "cross-hairs-clip": null,
+ "cross-hairs-color": null,
+ "cross-hairs-length": null,
+ "cross-hairs-opacity": null,
+ "cross-hairs-thickness": null,
+ "lens-mode": null,
+ "mag-factor": null,
+ "mouse-tracking": null,
+ "screen-position": null,
+ "scroll-at-edges": null,
+ "show-cross-hairs": null
+ }
+}, {
+ "org.gnome.desktop.a11y.keyboard": null
+}]

0 comments on commit 31218df

Please sign in to comment.