bzr branch
http://gegoxaren.bato24.eu/bzr/gpump/trunk
52.1.9
by Gustav Hartvigsson
* Woops! |
1 |
/* This file is part of GPump, a Pump.io client.
|
2 |
*
|
|
3 |
* GPump (THE SOFTWARE) is made available under the terms and conditions of the
|
|
4 |
* GNU Lesser General Public Licence 3.0. A copy of the licence can be read
|
|
5 |
* in the file lgpl-3.0.txt in the root of this project.
|
|
6 |
*/
|
|
7 |
||
8 |
||
9 |
const Secret = imports.gi.Secret; |
|
10 |
const Lang = imports.lang; |
|
11 |
||
12 |
||
13 |
let _default_account_data_object = null; |
|
14 |
||
15 |
/** @file
|
|
16 |
* More information on what is going on here can be found here:
|
|
17 |
* https://developer.gnome.org/libsecret/unstable/js-examples.html
|
|
18 |
*/
|
|
19 |
||
20 |
/** @function
|
|
21 |
* Get the default AccountData object.
|
|
22 |
*/
|
|
23 |
function get_account_data () { |
|
24 |
if (!_default_account_data_object) { |
|
25 |
_default_account_data_object = new AccountData (); |
|
26 |
} |
|
27 |
return _default_account_data_object; |
|
28 |
}
|
|
29 |
||
30 |
/**
|
|
31 |
* The libsecret schema.
|
|
32 |
*/
|
|
33 |
const GPUMP_SECRET_SCHEMA = new Secret.Schema ({ |
|
34 |
name: "org.gego.gpump.tokens", |
|
35 |
flags: Secret.SchemaFlags.NONE, |
|
36 |
attributes: { |
|
37 |
"NickName": Secret.SchemaAttributeType.STRING, // The nickname of the user |
|
38 |
"Server": Secret.SchemaAttributeType.STRING, // The server |
|
39 |
"DisplayName": Secret.SchemaAttributeType.STRING |
|
40 |
} |
|
41 |
});
|
|
42 |
||
43 |
/** @class
|
|
44 |
* Class to hold the the account intformation.
|
|
45 |
*
|
|
46 |
* Do not create instances of this object, use the get_account_data function
|
|
47 |
* instad.
|
|
48 |
*/
|
|
49 |
const AccountData = Lang.Class ({ |
|
50 |
Name: "AccountData", |
|
51 |
|
|
52 |
_init: function () { |
|
53 |
|
|
54 |
|
|
55 |
} |
|
56 |
});
|