Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge remote-tracking branch 'sgithens/cleanup'

* sgithens/cleanup:
  Updating to new payloads with schemas in the option blocks.
  Fixing if/else branch
  Fixing up payload returns so they are cloned objects and not modifying 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...
commit 0dcaeeb9ed677e333df53b3c525adc8384a7f15e 2 parents eb829ba + 0cf9681
@colinbdclark colinbdclark authored
View
58 node_modules/gsettingsBridge/gsettings_bridge.js
@@ -25,32 +25,50 @@ 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];
- for (var schemaId in settings) {
- for (var settingKey in settings[schemaId]) {
- settings[schemaId][settingKey] = nodeGSettings.get_gsetting(schemaId,settingKey);
+ 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);
+ }
+ }
+ else {
+ for (var settingKey in settings) {
+ settings[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];
- 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] = {
- "oldValue": oldValue,
- "newValue": value
- };
+ 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
+ };
+ }
}
}
}
View
21 node_modules/gsettingsBridge/tests/data/com.gnome.builtin.magnification.example-GET.json
@@ -0,0 +1,21 @@
+[
+ {
+ "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
23 node_modules/gsettingsBridge/tests/data/com.gnome.builtin.magnification.example.json
@@ -0,0 +1,23 @@
+[
+ {
+ "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
17 node_modules/gsettingsBridge/tests/data/gmag-get-test.json
@@ -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
+}]
Please sign in to comment.
Something went wrong with that request. Please try again.