Merge lp:~elementary-pantheon/pantheon-greeter/file-per-class-loginoptions into lp:~elementary-pantheon/pantheon-greeter/trunk

Proposed by Danielle Foré
Status: Merged
Approved by: Felipe Escoto
Approved revision: 488
Merged at revision: 489
Proposed branch: lp:~elementary-pantheon/pantheon-greeter/file-per-class-loginoptions
Merge into: lp:~elementary-pantheon/pantheon-greeter/trunk
Diff against target: 339 lines (+184/-128)
4 files modified
src/LoginOptions/GuestLogin.vala (+44/-0)
src/LoginOptions/LoginOption.vala (+19/-128)
src/LoginOptions/ManualLogin.vala (+45/-0)
src/LoginOptions/UserLogin.vala (+76/-0)
To merge this branch: bzr merge lp:~elementary-pantheon/pantheon-greeter/file-per-class-loginoptions
Reviewer Review Type Date Requested Status
elementary Pantheon team Pending
Review via email: mp+306704@code.launchpad.net

Commit message

* Split PantheonUser.vala into one file per class
* Rename PantheonUser.vala to its class name: LoginOption.vala

Description of the change

Still trying to make this codebase make sense. Moved each of these classes into their own file and then named the original file after its class. Moved them into a folder since these are like items

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added directory 'src/LoginOptions'
2=== added file 'src/LoginOptions/GuestLogin.vala'
3--- src/LoginOptions/GuestLogin.vala 1970-01-01 00:00:00 +0000
4+++ src/LoginOptions/GuestLogin.vala 2016-09-25 14:28:08 +0000
5@@ -0,0 +1,44 @@
6+/*
7+* Copyright (c) 2016 elementary LLC. (http://launchpad.net/pantheon-greeter)
8+*
9+* This program is free software; you can redistribute it and/or
10+* modify it under the terms of the GNU General Public
11+* License as published by the Free Software Foundation; either
12+* version 2 of the License, or (at your option) any later version.
13+*
14+* This program is distributed in the hope that it will be useful,
15+* but WITHOUT ANY WARRANTY; without even the implied warranty of
16+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17+* General Public License for more details.
18+*
19+* You should have received a copy of the GNU General Public
20+* License along with this program; if not, write to the
21+* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22+* Boston, MA 02111-1307, USA.
23+*
24+*/
25+
26+public class GuestLogin : LoginOption {
27+
28+ public GuestLogin (int index) {
29+ base (index);
30+ }
31+
32+ public override bool is_guest {
33+ get {
34+ return true;
35+ }
36+ }
37+
38+ public override string name {
39+ get {
40+ return "?pantheon greeter guest?";
41+ }
42+ }
43+
44+ public override string display_name {
45+ get {
46+ return _("Guest session");
47+ }
48+ }
49+}
50
51=== renamed file 'src/PantheonUser.vala' => 'src/LoginOptions/LoginOption.vala'
52--- src/PantheonUser.vala 2016-04-13 00:49:19 +0000
53+++ src/LoginOptions/LoginOption.vala 2016-09-25 14:28:08 +0000
54@@ -1,23 +1,22 @@
55-// -*- Mode: vala; indent-tabs-mode: nil; tab-width: 4 -*-
56-/***
57- BEGIN LICENSE
58-
59- Copyright (C) 2011-2014 elementary Developers
60-
61- This program is free software: you can redistribute it and/or modify it
62- under the terms of the GNU Lesser General Public License version 3, as published
63- by the Free Software Foundation.
64-
65- This program is distributed in the hope that it will be useful, but
66- WITHOUT ANY WARRANTY; without even the implied warranties of
67- MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
68- PURPOSE. See the GNU General Public License for more details.
69-
70- You should have received a copy of the GNU General Public License along
71- with this program. If not, see <http://www.gnu.org/licenses/>
72-
73- END LICENSE
74-***/
75+/*
76+* Copyright (c) 2011-2016 elementary LLC. (http://launchpad.net/pantheon-greeter)
77+*
78+* This program is free software; you can redistribute it and/or
79+* modify it under the terms of the GNU General Public
80+* License as published by the Free Software Foundation; either
81+* version 2 of the License, or (at your option) any later version.
82+*
83+* This program is distributed in the hope that it will be useful,
84+* but WITHOUT ANY WARRANTY; without even the implied warranty of
85+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
86+* General Public License for more details.
87+*
88+* You should have received a copy of the GNU General Public
89+* License along with this program; if not, write to the
90+* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
91+* Boston, MA 02111-1307, USA.
92+*
93+*/
94
95 public abstract class LoginOption : Object {
96
97@@ -131,111 +130,3 @@
98 }
99 }
100 }
101-
102-public class GuestLogin : LoginOption {
103-
104- public GuestLogin (int index) {
105- base (index);
106- }
107-
108- public override bool is_guest {
109- get {
110- return true;
111- }
112- }
113-
114- public override string name {
115- get {
116- return "?pantheon greeter guest?";
117- }
118- }
119-
120- public override string display_name {
121- get {
122- return _("Guest session");
123- }
124- }
125-}
126-
127-public class ManualLogin : LoginOption {
128-
129- public ManualLogin (int index) {
130- base (index);
131- }
132-
133- public override string name {
134- get {
135- return "?pantheon greeter manual?";
136- }
137- }
138-
139- public override string display_name {
140- get {
141- return _("Manual Login");
142- }
143- }
144-
145- // We want that the LoginBox makes a Entry for the username.
146- public override bool provides_login_name {
147- get {
148- return false;
149- }
150- }
151-}
152-
153-public class UserLogin : LoginOption {
154-
155- public LightDM.User lightdm_user { get; private set; }
156-
157- public UserLogin (int index, LightDM.User user) {
158- base (index);
159- this.lightdm_user = user;
160- avatar_ready = false;
161- }
162-
163- public override string background {
164- get {
165- return lightdm_user.background;
166- }
167- }
168-
169- public override string display_name {
170- get {
171- return lightdm_user.display_name;
172- }
173- }
174-
175- public override string name {
176- get {
177- return lightdm_user.name;
178- }
179- }
180-
181- public override bool logged_in {
182- get {
183- return lightdm_user.logged_in;
184- }
185- }
186-
187- public override string session {
188- get {
189- return lightdm_user.session;
190- }
191- }
192-
193- public override async void load_avatar () {
194- try {
195- File file = File.new_for_path (lightdm_user.image);
196- InputStream stream = yield file.read_async (GLib.Priority.DEFAULT);
197- var buf = new Gdk.Pixbuf.from_stream_at_scale (stream, 96, 96, true);
198- avatar = buf;
199- } catch (Error e) {
200- message ("Using default-avatar instead of " + lightdm_user.image);
201- }
202- Idle.add (() => {
203- avatar_ready = true;
204- avatar_updated ();
205- return false;
206- });
207- }
208-}
209
210=== added file 'src/LoginOptions/ManualLogin.vala'
211--- src/LoginOptions/ManualLogin.vala 1970-01-01 00:00:00 +0000
212+++ src/LoginOptions/ManualLogin.vala 2016-09-25 14:28:08 +0000
213@@ -0,0 +1,45 @@
214+/*
215+* Copyright (c) 2016 elementary LLC. (http://launchpad.net/pantheon-greeter)
216+*
217+* This program is free software; you can redistribute it and/or
218+* modify it under the terms of the GNU General Public
219+* License as published by the Free Software Foundation; either
220+* version 2 of the License, or (at your option) any later version.
221+*
222+* This program is distributed in the hope that it will be useful,
223+* but WITHOUT ANY WARRANTY; without even the implied warranty of
224+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
225+* General Public License for more details.
226+*
227+* You should have received a copy of the GNU General Public
228+* License along with this program; if not, write to the
229+* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
230+* Boston, MA 02111-1307, USA.
231+*
232+*/
233+
234+public class ManualLogin : LoginOption {
235+
236+ public ManualLogin (int index) {
237+ base (index);
238+ }
239+
240+ public override string name {
241+ get {
242+ return "?pantheon greeter manual?";
243+ }
244+ }
245+
246+ public override string display_name {
247+ get {
248+ return _("Manual Login");
249+ }
250+ }
251+
252+ // We want that the LoginBox makes a Entry for the username.
253+ public override bool provides_login_name {
254+ get {
255+ return false;
256+ }
257+ }
258+}
259
260=== added file 'src/LoginOptions/UserLogin.vala'
261--- src/LoginOptions/UserLogin.vala 1970-01-01 00:00:00 +0000
262+++ src/LoginOptions/UserLogin.vala 2016-09-25 14:28:08 +0000
263@@ -0,0 +1,76 @@
264+/*
265+* Copyright (c) 2016 elementary LLC. (http://launchpad.net/pantheon-greeter)
266+*
267+* This program is free software; you can redistribute it and/or
268+* modify it under the terms of the GNU General Public
269+* License as published by the Free Software Foundation; either
270+* version 2 of the License, or (at your option) any later version.
271+*
272+* This program is distributed in the hope that it will be useful,
273+* but WITHOUT ANY WARRANTY; without even the implied warranty of
274+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
275+* General Public License for more details.
276+*
277+* You should have received a copy of the GNU General Public
278+* License along with this program; if not, write to the
279+* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
280+* Boston, MA 02111-1307, USA.
281+*
282+*/
283+
284+public class UserLogin : LoginOption {
285+
286+ public LightDM.User lightdm_user { get; private set; }
287+
288+ public UserLogin (int index, LightDM.User user) {
289+ base (index);
290+ this.lightdm_user = user;
291+ avatar_ready = false;
292+ }
293+
294+ public override string background {
295+ get {
296+ return lightdm_user.background;
297+ }
298+ }
299+
300+ public override string display_name {
301+ get {
302+ return lightdm_user.display_name;
303+ }
304+ }
305+
306+ public override string name {
307+ get {
308+ return lightdm_user.name;
309+ }
310+ }
311+
312+ public override bool logged_in {
313+ get {
314+ return lightdm_user.logged_in;
315+ }
316+ }
317+
318+ public override string session {
319+ get {
320+ return lightdm_user.session;
321+ }
322+ }
323+
324+ public override async void load_avatar () {
325+ try {
326+ File file = File.new_for_path (lightdm_user.image);
327+ InputStream stream = yield file.read_async (GLib.Priority.DEFAULT);
328+ var buf = new Gdk.Pixbuf.from_stream_at_scale (stream, 96, 96, true);
329+ avatar = buf;
330+ } catch (Error e) {
331+ message ("Using default-avatar instead of " + lightdm_user.image);
332+ }
333+ Idle.add (() => {
334+ avatar_ready = true;
335+ avatar_updated ();
336+ return false;
337+ });
338+ }
339+}

Subscribers

People subscribed via source and target branches