/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-11-20 20:20:53 UTC
  • mto: This revision was merged to the branch mainline in revision 53.
  • Revision ID: gustav.hartvigsson@gmail.com-20141120202053-ew2o6942d9uuyuzs
* made the UserButton work in tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
  return _default_settings_object;
32
32
}
33
33
 
 
34
/** @enum
 
35
 */
 
36
const KILL_ON_CLOSE = {
 
37
  /** 
 
38
   * Default value, will show the close dialogue on clicking the close button
 
39
   * in the main window.
 
40
   */
 
41
  UNKNOWN: -1, 
 
42
  /** Will not exist the app on close of main window */
 
43
  NO: 0,
 
44
  /** Will exit on close of main window */
 
45
  YES: 1
 
46
}
 
47
 
34
48
/** @class
35
49
 * NO NOT CREATE INSTANCES FROM THIS OBJECT, USE THE get_settings () FUNCTION!
36
50
 */
50
64
     * @return void
51
65
     */
52
66
    'change': {
53
 
      param_types: [GObject.TYPE_STRING, GObject.TYPE_BOOLEAN]
 
67
      param_types: [GObject.TYPE_STRING, GObject.TYPE_INT]
54
68
    }
55
69
  },
56
70
  
74
88
    
75
89
    this._settings_file = Gio.File.new_for_path (this._settings_file_path);
76
90
    
77
 
    /* Then we check that the file exists. If the file doen not ekist we
 
91
    /* Then we check that the file exists. If the file does not exists we
78
92
     * construct some sane default values.
79
93
     */
80
94
    if (!GLib.file_test (this._settings_file_path, GLib.FileTest.EXISTS)) {
92
106
            only_show_avatar: false
93
107
          },
94
108
          use_dark: false,
95
 
          first_run: true
 
109
          first_run: true,
 
110
          kill_on_close: KILL_ON_CLOSE.UNKNOWN
96
111
        }
97
112
      };
98
113
      // DEBUG:
186
201
          ret_val = false;
187
202
        }
188
203
        break;
 
204
      case "main.kill_on_close":
 
205
        if (typeof value == "boolean") {
 
206
          this._settings.main.window_close_kill = value;
 
207
        } else {
 
208
          print (
 
209
            "The setting \"main.kill_on_close\" must be a boolean.");
 
210
          ret_val = false;
 
211
        }
 
212
        break;
189
213
      case "main.privacy.show_full_name":
190
214
        if (typeof value == "boolean") {
191
215
          this._settings.main.privacy.show_full_name = value;
196
220
        }
197
221
        break;
198
222
      case "main.privacy.only_show_avatar":
199
 
        if (typeof value == "boolean") {
 
223
        if (typeof value == "number") {
200
224
          this._settings.main.privacy.only_show_avatar = value;
201
225
        } else {
202
226
          print (
203
 
            "The setting \"main.privacy.only_show_avatar\" must be a boolean.");
 
227
            "The setting \"main.privacy.only_show_avatar\" must be a number.");
204
228
          ret_val = false;
205
229
        }
206
230
        break;
212
236
    }
213
237
    
214
238
    
215
 
    /* Becouse, reasons. */
 
239
    /* Because, reasons. */
216
240
    if (ret_val) {
217
241
      this.emit ("change", setting, value);
218
242
    }