103
103
set_setting: function (setting, value) {
104
104
if (typeof setting != "string") {
105
print ("ERROR: The \"setting\" paramenter must be a string... Exiting.");
105
print ("ERROR: The \"setting\" parameter must be a string.");
110
if (typeof value == "number") {
111
this._settings.ui.x = value;
113
print ("The setting \"ui.x\" must be a number.");
117
if (typeof value == "number") {
118
this._settings.ui.y = value;
120
print ("The setting \"ui.y\" must be a number.");
124
if (typeof value == "number") {
125
this._settings.ui.h = value;
127
print ("The setting \"ui.h\" must be a number.");
131
if (typeof value == "number") {
132
this._settings.ui.w = value;
134
print ("The setting \"ui.w\" must be a number.");
137
case "main.use_dark":
138
if (typeof value == "boolean") {
139
this._settings.main.use_dark = value;
141
print ("The setting \"main.use_dark\" must be a boolean.");
144
case "main.first_run":
145
if (typeof value == "boolean") {
146
this._settings.main.first_run = value;
148
print ("The setting \"main.first_run\" must be a boolean.");
151
case "main.privacy.show_full_name":
152
if (typeof value == "boolean") {
153
this._settings.main.privacy.show_full_name = value;
156
"The setting \"main.privacy.show_full_name\" must be a boolean.");
159
case "main.privacy.only_show_avatar":
160
if (typeof value == "boolean") {
161
this._settings.main.privacy.only_show_avatar = value;
164
"The setting \"main.privacy.only_show_avatar\" must be a boolean.");
169
print ("ERROR: The setting \"" + setting + "\" does not exist.");
112
178
* Gets a value from the settings object.
114
* returns a complex object with two fealds: ok and data.
116
* If ok is false something went wrong and the data feald will be undefined.
118
* If ok is true everything is ok and the data feald will be set to the value.
180
* returns a complex object with two field: ok and data.
182
* If ok is false something went wrong and the data field will be undefined.
184
* If ok is true everything is ok and the data field will be set to the value.
120
186
get_setting: function (setting) {
192
if (typeof setting != "string") {
193
print ("ERROR: The \"setting\" parameter must be a string.");
200
ret_data.data = this._settings.ui.x;
203
ret_data.data = this._settings.ui.y;
206
ret_data.data = this._settings.ui.h;
209
ret_data.data = this._settings.ui.w;
211
case "main.use_dark":
212
ret_data.data = this._settings.main.use_dark;
214
case "main.first_run":
215
ret_data.data = this._settings.main.first_run;
217
case "main.privacy.show_full_name":
218
ret_data.data = this._settings.main.privacy.show_full_name;
220
case "main.privacy.only_show_avatar":
221
ret_data.data = this._settings.main.privacy.only_show_avatar;
225
print ("ERROR: The setting \"" + setting + "\" does not exist.");