/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-06-09 12:46:36 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20140609124636-swulk259dubsefgt
* finnished the getter and setter for the settings. Still untested.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 
16
16
/**
17
17
 * Please use this function when getting the settings data object. It is not
18
 
 * good to have multiple instances of the settings data object, it may
19
 
 * cause problems down the line.
 
18
 * good to 
20
19
 */
21
20
function get_settings () {
22
21
  if (!_default_settings_object) {
24
23
  }
25
24
  return _default_settings_object;
26
25
}
27
 
 
28
26
/**
29
27
 * NO NOT CREATE INSTANCES FROM THIS OBJECT, USE THE get_settings () FUNCTION!
30
28
 */
194
192
    if (typeof setting != "string") {
195
193
      print ("ERROR: The \"setting\" parameter must be a string.");
196
194
      ret_data.ok = false;
197
 
      return ret_data;
 
195
      return ret_data.ok;
198
196
    }
199
197
    
200
198
    switch (setting) {
235
233
   * Commits changes to the settings object to file.
236
234
   */
237
235
  commit_to_file: function () {
238
 
    print (JSON.stringify (this._settings, null, 2).toString () );
239
 
      
240
 
      let file_stream = this._settings_file.replace (null,
241
 
                                                    false,
242
 
                                                    Gio.FileCreateFlags.PRIVATE,
243
 
                                                    null);
244
 
      file_stream.write_all (JSON.stringify (
245
 
          this._settings, null, 2).toString (), null);
246
 
      
247
 
      file_stream.close (null);
 
236
    
248
237
  }
249
238
  
250
 
  // End of class.
251
239
});
252
240
 
253
241