/gpump/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/gpump/trunk

« back to all changes in this revision

Viewing changes to src/settings_data.js

  • Committer: Gustav Hartvigsson
  • Date: 2014-12-15 21:45:36 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20141215214536-ty17fg5rq06clphg
* Code cleanup
* fixed a Gtk warning (by hooking up the parameters thingy)
* Hooked up "quit on exit" in the references UI.
  * added a popover to set it for the first time...
    This way of doing it is not so good, I think I will have
    to re-do how "quit on exit" is handled.
* Switched the order of the fealds in the return map in the
  SettingsData.get_setting.
  This should, hypothetically, make it posible to use the the ret
  data as is.
  This shoold probably be be redone to just return undefined.

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
 
34
34
/** @enum
35
35
 */
36
 
const KILL_ON_CLOSE = {
 
36
const QUIT_ON_CLOSE = {
37
37
  /** 
38
38
   * Default value, will show the close dialogue on clicking the close button
39
39
   * in the main window.
40
40
   */
41
 
  UNKNOWN: -1, 
 
41
  UNKNOWN: -1,
42
42
  /** Will not exist the app on close of main window */
43
43
  NO: 0,
44
44
  /** Will exit on close of main window */
107
107
          },
108
108
          use_dark: false,
109
109
          first_run: true,
110
 
          kill_on_close: KILL_ON_CLOSE.UNKNOWN
 
110
          quit_on_close: QUIT_ON_CLOSE.UNKNOWN
111
111
        }
112
112
      };
113
113
      // DEBUG:
201
201
          ret_val = false;
202
202
        }
203
203
        break;
204
 
      case "main.kill_on_close":
205
 
        if (typeof value == "boolean") {
206
 
          this._settings.main.window_close_kill = value;
 
204
      case "main.quit_on_close":
 
205
        if (typeof value == "number") {
 
206
          this._settings.main.quit_on_close = value;
207
207
        } else {
208
208
          print (
209
 
            "The setting \"main.kill_on_close\" must be a boolean.");
 
209
            "The setting \"main.quit_on_close\" must be a number.");
210
210
          ret_val = false;
211
211
        }
212
212
        break;
220
220
        }
221
221
        break;
222
222
      case "main.privacy.only_show_avatar":
223
 
        if (typeof value == "number") {
 
223
        if (typeof value == "boolean") {
224
224
          this._settings.main.privacy.only_show_avatar = value;
225
225
        } else {
226
226
          print (
227
 
            "The setting \"main.privacy.only_show_avatar\" must be a number.");
 
227
            "The setting \"main.privacy.only_show_avatar\" must be a boolean.");
228
228
          ret_val = false;
229
229
        }
230
230
        break;
258
258
   */
259
259
  get_setting: function (setting) {
260
260
    let ret_data = {
261
 
      ok: true,
262
 
      data: undefined
 
261
      data: undefined,
 
262
      ok: true
263
263
    };
264
264
    
265
265
    if (typeof setting != "string") {
293
293
      case "main.privacy.only_show_avatar":
294
294
        ret_data.data = this._settings.main.privacy.only_show_avatar;
295
295
        break;
 
296
      case "main.quit_on_close":
 
297
        ret_data.data = this._settings.main.quit_on_close;
 
298
        break;
296
299
      default:
297
300
        ret_data.ok = false;
298
301
        print ("ERROR: The setting \"" + setting + "\" does not exist.");