This repository has been archived by the owner on May 22, 2019. It is now read-only.
/
LightDMObjects.js
273 lines (244 loc) · 5 KB
/
LightDMObjects.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
/*
* Copyright © 2015-2016 Antergos
*
* LightDMObjects.js
*
* This file is part of lightdm-webkit2-greeter
*
* lightdm-webkit2-greeter is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License,
* or any later version.
*
* lightdm-webkit2-greeter is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* The following additional terms are in effect as per Section 7 of the license:
*
* The preservation of all legal notices and author attributions in
* the material or in the Appropriate Legal Notices displayed
* by works containing it is required.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* The global window object.
*
* @name window
* @type {object}
* @global
*/
/**
* The greeter's Theme JavaScript API.
*
* @namespace LightDM
*/
/**
* Interface for object that holds info about a session. Session objects are not
* created by the theme's code, but rather by the [`LightDM.Greeter`](#dl-LightDM-Greeter) class.
*
* @memberOf LightDM
*/
class Session {
constructor( { comment, key, name } ) {
this._comment = comment;
this._key = key;
this._name = name;
}
/**
* The name for the session.
* @type {string}
* @readonly
*/
get name() {
return this._name;
}
/**
* The key for the session.
* @type {string}
* @readonly
*/
get key() {
return this._key;
}
/**
* The comment for the session.
* @type {string}
* @readonly
*/
get comment() {
return this._comment;
}
}
/**
* Interface for object that holds info about a language on the system. Language objects are not
* created by the theme's code, but rather by the [`LightDM.Greeter`](#dl-LightDM-Greeter) class.
*
* @memberOf LightDM
*/
class Language {
constructor( { code, name, territory } ) {
this._code = code;
this._name = name;
this._territory = territory;
}
/**
* The code for the language.
* @type {string}
* @readonly
*/
get code() {
return this._code;
}
/**
* The name for the layout.
* @type {string}
* @readonly
*/
get name() {
return this._name;
}
/**
* The territory for the language.
* @type {string}
* @readonly
*/
get territory() {
return this._territory;
}
}
/**
* Interface for object that holds info about a keyboard layout on the system. Language
* objects are not created by the theme's code, but rather by the [`LightDM.Greeter`](#dl-LightDM-Greeter) class.
*
* @memberOf LightDM
*/
class Layout {
constructor( { description, name, short_description } ) {
this._description = description;
this._name = name;
this._short_description = short_description;
}
/**
* The description for the layout.
* @type {string}
* @readonly
*/
get description() {
return this._description;
}
/**
* The name for the layout.
* @type {string}
* @readonly
*/
get name() {
return this._name;
}
/**
* The territory for the layout.
* @type {string}
* @readonly
*/
get short_description() {
return this._short_description;
}
}
/**
* Interface for object that holds info about a user account on the system. User
* objects are not created by the theme's code, but rather by the [`LightDM.Greeter`](#dl-LightDM-Greeter) class.
*
* @memberOf LightDM
*/
class User {
constructor( user_info ) {
Object.keys(user_info).forEach( key => {
this[`_${key}`] = user_info[key];
} );
}
/**
* The display name for the user.
* @type {string}
* @readonly
*/
get display_name() {
return this._display_name;
}
/**
* The language for the user.
* @type {string}
* @readonly
*/
get language() {
return this._language;
}
/**
* The keyboard layout for the user.
* @type {string}
* @readonly
*/
get layout() {
return this._layout;
}
/**
* The image for the user.
* @type {string}
* @readonly
*/
get image() {
return this._image;
}
/**
* The home_directory for the user.
* @type {string}
* @readonly
*/
get home_directory() {
return this._home_directory;
}
/**
* The username for the user.
* @type {string}
* @readonly
*/
get username() {
return this._username;
}
/**
* Whether or not the user is currently logged in.
* @type {boolean}
* @readonly
*/
get logged_in() {
return this._logged_in;
}
/**
* The last session that the user logged into.
* @type {string|null}
* @readonly
*/
get session() {
return this._session;
}
/**
* ***Deprecated!*** See {@link LightDM.User#username}.
* @deprecated
* @type {string}
* @readonly
*/
get name() {
return this._name;
}
/**
* ***Deprecated!*** See {@link LightDM.User#display_name}.
* @deprecated
* @type {string}
* @readonly
*/
get real_name() {
return this._real_name;
}
}