Merge lp:~robert-ancell/unity-greeter/hidden-accounts into lp:unity-greeter

Proposed by Robert Ancell
Status: Merged
Merged at revision: 1181
Proposed branch: lp:~robert-ancell/unity-greeter/hidden-accounts
Merge into: lp:unity-greeter
Diff against target: 155 lines (+78/-3)
5 files modified
data/com.canonical.unity-greeter.gschema.xml (+4/-0)
src/greeter-list.vala (+1/-1)
src/main-window.vala (+19/-1)
src/settings.vala (+1/-0)
src/user-list.vala (+53/-1)
To merge this branch: bzr merge lp:~robert-ancell/unity-greeter/hidden-accounts
Reviewer Review Type Date Requested Status
David Barth (community) Approve
Robert Ancell Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+212765@code.launchpad.net

Commit message

Add option to hide certain users until alt+ctrl+shift is pressed

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Robert Ancell (robert-ancell) :
review: Approve
Revision history for this message
David Barth (dbarth) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/com.canonical.unity-greeter.gschema.xml'
2--- data/com.canonical.unity-greeter.gschema.xml 2014-02-18 21:33:56 +0000
3+++ data/com.canonical.unity-greeter.gschema.xml 2014-03-26 04:41:56 +0000
4@@ -90,5 +90,9 @@
5 <default>['ug-accessibility', 'com.canonical.indicator.keyboard', 'com.canonical.indicator.session', 'com.canonical.indicator.datetime', 'com.canonical.indicator.power', 'com.canonical.indicator.sound', 'application']</default>
6 <summary>Which indicators to load</summary>
7 </key>
8+ <key name="hidden-users" type="as">
9+ <default>[]</default>
10+ <summary>List of usernames that are hidden until a special key combination is hit</summary>
11+ </key>
12 </schema>
13 </schemalist>
14
15=== modified file 'src/greeter-list.vala'
16--- src/greeter-list.vala 2014-03-12 03:19:13 +0000
17+++ src/greeter-list.vala 2014-03-26 04:41:56 +0000
18@@ -374,7 +374,7 @@
19 {
20 foreach (var e in entries)
21 {
22- if (!e.id.has_prefix ("*"))
23+ if (e.id != "*other")
24 return true;
25 }
26 return false;
27
28=== modified file 'src/main-window.vala'
29--- src/main-window.vala 2014-02-27 04:53:21 +0000
30+++ src/main-window.vala 2014-03-26 04:41:56 +0000
31@@ -20,7 +20,6 @@
32
33 public class MainWindow : Gtk.Window
34 {
35- public UserList user_list;
36 public MenuBar menubar;
37
38 private List<Monitor> monitors;
39@@ -283,6 +282,25 @@
40 {
41 var top = stack.top ();
42
43+ if (stack.top () is UserList)
44+ {
45+ var user_list = stack.top () as UserList;
46+ if (!user_list.show_hidden_users)
47+ {
48+ var shift_mask = Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.MOD1_MASK;
49+ var control_mask = Gdk.ModifierType.SHIFT_MASK | Gdk.ModifierType.MOD1_MASK;
50+ var alt_mask = Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.SHIFT_MASK;
51+ if (((event.keyval == Gdk.Key.Shift_L || event.keyval == Gdk.Key.Shift_R) && (event.state & shift_mask) == shift_mask) ||
52+ ((event.keyval == Gdk.Key.Control_L || event.keyval == Gdk.Key.Control_R) && (event.state & control_mask) == control_mask) ||
53+ ((event.keyval == Gdk.Key.Alt_L || event.keyval == Gdk.Key.Alt_R) && (event.state & alt_mask) == alt_mask))
54+ {
55+ debug ("Hidden user key combination detected");
56+ user_list.show_hidden_users = true;
57+ return true;
58+ }
59+ }
60+ }
61+
62 switch (event.keyval)
63 {
64 case Gdk.KEY_Escape:
65
66=== modified file 'src/settings.vala'
67--- src/settings.vala 2014-02-18 21:33:56 +0000
68+++ src/settings.vala 2014-03-26 04:41:56 +0000
69@@ -39,6 +39,7 @@
70 public static const string KEY_SCREEN_READER = "screen-reader";
71 public static const string KEY_PLAY_READY_SOUND = "play-ready-sound";
72 public static const string KEY_INDICATORS = "indicators";
73+ public static const string KEY_HIDDEN_USERS = "hidden-users";
74
75 public static bool get_boolean (string key)
76 {
77
78=== modified file 'src/user-list.vala'
79--- src/user-list.vala 2014-03-12 03:19:13 +0000
80+++ src/user-list.vala 2014-03-26 04:41:56 +0000
81@@ -64,6 +64,50 @@
82 /* User to authenticate against */
83 private string ?authenticate_user = null;
84
85+ private bool show_hidden_users_ = false;
86+ public bool show_hidden_users
87+ {
88+ set
89+ {
90+ show_hidden_users_ = value;
91+
92+ if (UnityGreeter.singleton.test_mode)
93+ {
94+ if (value)
95+ add_user ("hidden", "Hidden User", null, false, false, null);
96+ else
97+ remove_entry ("hidden");
98+ return;
99+ }
100+
101+ var hidden_users = UGSettings.get_strv (UGSettings.KEY_HIDDEN_USERS);
102+ if (!value)
103+ {
104+ foreach (var username in hidden_users)
105+ remove_entry (username);
106+ return;
107+ }
108+
109+ var users = LightDM.UserList.get_instance ();
110+ foreach (var user in users.users)
111+ {
112+ foreach (var username in hidden_users)
113+ {
114+ if (user.name == username)
115+ {
116+ debug ("Showing hidden user %s", username);
117+ user_added_cb (user);
118+ }
119+ }
120+ }
121+ }
122+
123+ get
124+ {
125+ return show_hidden_users_;
126+ }
127+ }
128+
129 private string _default_session = "ubuntu";
130 public string default_session
131 {
132@@ -968,7 +1012,7 @@
133 }
134
135 /* If we have no entries at all, we should show manual */
136- if (!have_entries () && !always_show_manual)
137+ if (!have_entries ())
138 add_manual_entry ();
139
140 var last_user = UnityGreeter.singleton.get_state ("last-user");
141@@ -983,6 +1027,14 @@
142 {
143 debug ("Adding/updating user %s (%s)", user.name, user.real_name);
144
145+ if (!show_hidden_users)
146+ {
147+ var hidden_users = UGSettings.get_strv (UGSettings.KEY_HIDDEN_USERS);
148+ foreach (var username in hidden_users)
149+ if (username == user.name)
150+ return;
151+ }
152+
153 var label = user.real_name;
154 if (user.real_name == "")
155 label = user.name;

Subscribers

People subscribed via source and target branches