Merge lp:~dbarth/unity-greeter/remote-login-only into lp:unity-greeter

Proposed by David Barth
Status: Merged
Approved by: Michael Terry
Approved revision: 929
Merged at revision: 941
Proposed branch: lp:~dbarth/unity-greeter/remote-login-only
Merge into: lp:unity-greeter
Diff against target: 287 lines (+134/-35)
5 files modified
src/greeter-list.vala (+10/-6)
src/user-list.vala (+55/-24)
tests/test-list.vala (+1/-0)
tests/test.vala (+60/-1)
tests/unity-greeter.vala (+8/-4)
To merge this branch: bzr merge lp:~dbarth/unity-greeter/remote-login-only
Reviewer Review Type Date Requested Status
Michael Terry (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+178007@code.launchpad.net

Commit message

Let the greeter display only the remote login entry, without adding a fallback manual login option.

Description of the change

Let the greeter display only the remote login entry, without adding a fallback manual login option.

See the unit tests for the configuration details, ie:
greeter-show-manual-login=false
greeter-hide-users=true
greeter-allow-guest=false
greeter-show-remote-login=true

Note that if the remote login service becomes unavailable, the manual login entry will re-appear, and vice-versa.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
928. By David Barth

fix the test for gdk3 on saucy

929. By David Barth

indention fixes

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:929
http://jenkins.qa.ubuntu.com/job/unity-greeter-ci/3/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-greeter-saucy-amd64-ci/3

Click here to trigger a rebuild:
http://s-jenkins:8080/job/unity-greeter-ci/3/rebuild

review: Approve (continuous-integration)
Revision history for this message
Michael Terry (mterry) wrote :

19 + else if (index < entries.length ())
20 + index++;

Why the change from selecting previous index to selecting next index after removing an entry?

162 +

This whitespace change in tests/test-list.vala can be dropped.

197 + /* don't go too fast, otherwise the lastest gdk3 will lose control... */
198 + Posix.sleep(1);

Ick. Did you try a call to process_events()? That might have the same effect, without an actual sleep.

211 + GLib.assert (list.num_entries() == 1);
212 + GLib.assert (list.selected_entry.id == "*remote_directory*http://crazyurl.com");

These lines (among others) seem differently indented than the surrounding area.

Besides those, seems fine and appropriate. Thanks!

review: Needs Fixing
Revision history for this message
David Barth (dbarth) wrote :

Le 02/08/2013 20:50, Michael Terry a écrit :
> Review: Needs Fixing
>
> 19 + else if (index < entries.length ())
> 20 + index++;
>
> Why the change from selecting previous index to selecting next index after removing an entry?
The comment explains it: we switch to either the previous line (by
default) if there exists a previous line, or if not, we change to the
next one. The code now works in cases where the line we remove is the
first line in the list, not just the last one as has been the case so far.

>
> 162 +
>
> This whitespace change in tests/test-list.vala can be dropped.
ok
>
> 197 + /* don't go too fast, otherwise the lastest gdk3 will lose control... */
> 198 + Posix.sleep(1);
>
> Ick. Did you try a call to process_events()? That might have the same effect, without an actual sleep.
I did, but gtk3/vala on saucy can get satisfied with just that :/
gtk3/vala on raring is fine without it... Otherwise, you get gtk3 to
complain about losing the last reference to an undeleted widget. I
assume this is a temporary regression in saucy.

> 211 + GLib.assert (list.num_entries() == 1);
> 212 + GLib.assert (list.selected_entry.id == "*remote_directory*http://crazyurl.com");
>
> These lines (among others) seem differently indented than the surrounding area.
I re-tabbed all of the lines I could see, hopefully for good now.

David

Revision history for this message
Michael Terry (mterry) wrote :

Sure, seems fine. Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/greeter-list.vala'
--- src/greeter-list.vala 2013-07-08 11:35:39 +0000
+++ src/greeter-list.vala 2013-08-01 15:02:04 +0000
@@ -444,18 +444,22 @@
444 entry.destroy ();444 entry.destroy ();
445 entries.remove (entry);445 entries.remove (entry);
446446
447 /* Show a manual login if no users */447 /* Select another entry if the selected one was removed */
448 if (!have_entries ())
449 add_manual_entry ();
450
451 /* Select previous entry if the selected one was removed */
452 if (entry == selected_entry)448 if (entry == selected_entry)
453 {449 {
454 if (index >= entries.length () && index > 0)450 if (index >= entries.length () && index > 0)
455 index--;451 index--;
456 select_entry (entries.nth_data (index), -1.0);452 else if (index < entries.length ())
453 index++;
454
455 if (entries.nth_data (index) != null)
456 select_entry (entries.nth_data (index), -1.0);
457 }457 }
458458
459 /* Show a manual login if no users and no remote login entry */
460 if (!have_entries () && !UnityGreeter.singleton.show_remote_login_hint ())
461 add_manual_entry ();
462
459 queue_draw ();463 queue_draw ();
460 }464 }
461465
462466
=== modified file 'src/user-list.vala'
--- src/user-list.vala 2013-02-13 04:25:47 +0000
+++ src/user-list.vala 2013-08-01 15:02:04 +0000
@@ -124,8 +124,11 @@
124124
125 fill_list ();125 fill_list ();
126126
127 entry_selected.connect (entry_selected_cb);127 if (selected_entry != null)
128 entry_selected_cb (selected_entry.id);128 {
129 entry_selected.connect (entry_selected_cb);
130 entry_selected_cb (selected_entry.id);
131 }
129132
130 connect_to_lightdm ();133 connect_to_lightdm ();
131134
@@ -150,6 +153,10 @@
150 {153 {
151 remote_login_server_list = new List<RemoteServer?> ();154 remote_login_server_list = new List<RemoteServer?> ();
152 remove_entries_with_prefix ("*remote_login");155 remove_entries_with_prefix ("*remote_login");
156
157 /* If we have no entries at all, we should show manual */
158 if (!always_show_manual)
159 add_manual_entry ();
153 }160 }
154161
155 private async void query_directory_servers ()162 private async void query_directory_servers ()
@@ -249,6 +256,12 @@
249 it = it.next;256 it = it.next;
250 }257 }
251 }258 }
259
260 /* Remove manual option unless specified */
261 if (remote_directory_server_list.length() > 0 && !always_show_manual) {
262 debug ("removing manual login since we have a remote login entry");
263 remove_entry ("*other");
264 }
252 }265 }
253266
254 private PromptBox create_prompt_for_login_server (RemoteServer remote_server)267 private PromptBox create_prompt_for_login_server (RemoteServer remote_server)
@@ -341,6 +354,12 @@
341 {354 {
342 remove_remote_servers ();355 remove_remote_servers ();
343 remote_login_service = null;356 remote_login_service = null;
357
358 /* provide a fallback manual login option */
359 if (UnityGreeter.singleton.hide_users_hint ()) {
360 add_manual_entry();
361 set_active_entry ("*other");
362 }
344 }363 }
345364
346 private async void remote_directory_respond_cb ()365 private async void remote_directory_respond_cb ()
@@ -1099,31 +1118,43 @@
1099 {1118 {
1100 }1119 }
11011120
1102 while (add_test_entry ());1121 if (!UnityGreeter.singleton.hide_users_hint())
1103 offer_guest = true;1122 while (add_test_entry ());
1104 always_show_manual = true;1123
1124 /* add a manual entry if the list of entries is empty initially */
1125 if (n_test_entries <= 0)
1126 {
1127 add_manual_entry();
1128 set_active_entry ("*other");
1129 n_test_entries++;
1130 }
1131
1132 offer_guest = UnityGreeter.singleton.has_guest_account_hint();
1133 always_show_manual = UnityGreeter.singleton.show_manual_login_hint();
11051134
1106 key_press_event.connect (test_key_press_cb);1135 key_press_event.connect (test_key_press_cb);
11071136
1108 Timeout.add (1000, () =>1137 if (UnityGreeter.singleton.show_remote_login_hint())
1109 {1138 Timeout.add (1000, () =>
1110 RemoteServer[] test_server_list = {};1139 {
1111 RemoteServer remote_server = RemoteServer ();1140 RemoteServer[] test_server_list = {};
1112 remote_server.type = "uccs";1141 RemoteServer remote_server = RemoteServer ();
1113 remote_server.name = "Remote Login";1142 remote_server.type = "uccs";
1114 remote_server.url = "http://crazyurl.com";1143 remote_server.name = "Remote Login";
1115 remote_server.last_used_server = false;1144 remote_server.url = "http://crazyurl.com";
1116 remote_server.fields = {};1145 remote_server.last_used_server = false;
1117 RemoteServerField field1 = RemoteServerField ();1146 remote_server.fields = {};
1118 field1.type = "email";1147 RemoteServerField field1 = RemoteServerField ();
1119 RemoteServerField field2 = RemoteServerField ();1148 field1.type = "email";
1120 field2.type = "password";1149 RemoteServerField field2 = RemoteServerField ();
1121 remote_server.fields = {field1, field2};1150 field2.type = "password";
11221151 remote_server.fields = {field1, field2};
1123 test_server_list += remote_server;1152
1124 set_remote_directory_servers (test_server_list);1153 test_server_list += remote_server;
1125 return false;1154 set_remote_directory_servers (test_server_list);
1126 });1155
1156 return false;
1157 });
11271158
1128 var last_user = UnityGreeter.singleton.get_state ("last-user");1159 var last_user = UnityGreeter.singleton.get_state ("last-user");
1129 if (last_user != null)1160 if (last_user != null)
11301161
=== modified file 'tests/test-list.vala'
--- tests/test-list.vala 2012-09-04 13:35:33 +0000
+++ tests/test-list.vala 2013-08-01 15:02:04 +0000
@@ -15,4 +15,5 @@
15 {15 {
16 return mode == Mode.SCROLLING;16 return mode == Mode.SCROLLING;
17 }17 }
18
18}19}
19\ No newline at end of file20\ No newline at end of file
2021
=== modified file 'tests/test.vala'
--- tests/test.vala 2013-06-20 18:17:28 +0000
+++ tests/test.vala 2013-08-01 15:02:04 +0000
@@ -145,7 +145,7 @@
145 // Wait until remote login appears145 // Wait until remote login appears
146 scroll_to_remote_login (list);146 scroll_to_remote_login (list);
147147
148 GLib.assert (list.num_entries() == 30);148 GLib.assert (list.num_entries() > 0);
149149
150 // Make sure we are at the beginning of the list150 // Make sure we are at the beginning of the list
151 do_scroll (list, GreeterList.ScrollTarget.START);151 do_scroll (list, GreeterList.ScrollTarget.START);
@@ -688,6 +688,63 @@
688 mw.hide ();688 mw.hide ();
689 }689 }
690690
691 public static void remote_login_only ()
692 {
693 UnityGreeter.singleton.test_mode = true;
694 UnityGreeter.singleton.session_started = false;
695
696 /* this configuration should result in the list containing only the remote login entry,
697 without any fallback manual entry */
698 UnityGreeter.singleton._hide_users_hint = true;
699 UnityGreeter.singleton._show_remote_login_hint = true;
700 UnityGreeter.singleton._has_guest_account_hint = false;
701 UnityGreeter.singleton._show_manual_login_hint = false;
702
703 MainWindow mw = setup ();
704 TestList list = mw.stack.top () as TestList;
705
706 /* don't go too fast, otherwise the lastest gdk3 will lose control... */
707 Posix.sleep(1);
708
709 /* Wait for Remote Login to appear */
710 bool rl_appeared = false;
711 for (int i=0; i<100 && !rl_appeared; i++)
712 {
713 do_scroll (list, GreeterList.ScrollTarget.END);
714 process_events ();
715 if (list.selected_entry.id == "*remote_directory*http://crazyurl.com")
716 rl_appeared = true;
717 }
718
719 GLib.assert (rl_appeared);
720 GLib.assert (list.num_entries() == 1);
721 GLib.assert (list.selected_entry.id == "*remote_directory*http://crazyurl.com");
722
723 mw.hide ();
724 }
725
726 public static void manual_login_fallback ()
727 {
728 UnityGreeter.singleton.test_mode = true;
729 UnityGreeter.singleton.session_started = false;
730
731 /* this configuration should result in the list containing at least a manual entry */
732 UnityGreeter.singleton._hide_users_hint = true;
733 UnityGreeter.singleton._show_remote_login_hint = false;
734 UnityGreeter.singleton._has_guest_account_hint = false;
735 UnityGreeter.singleton._show_manual_login_hint = true;
736
737 MainWindow mw = setup ();
738 TestList list = mw.stack.top () as TestList;
739
740 /* verify if the manual entry has been added as a fallback mechanism */
741 GLib.assert (list.num_entries() == 1);
742 GLib.assert (list.selected_entry.id == "*other");
743
744 mw.hide ();
745 }
746
747
691 static void setup_gsettings()748 static void setup_gsettings()
692 {749 {
693 try750 try
@@ -740,6 +797,8 @@
740 GLib.Test.add_func ("/Email Autocomplete", email_autocomplete);797 GLib.Test.add_func ("/Email Autocomplete", email_autocomplete);
741 GLib.Test.add_func ("/Greeter Communication", greeter_communcation);798 GLib.Test.add_func ("/Greeter Communication", greeter_communcation);
742 GLib.Test.add_func ("/Unsupported server type", unsupported_server_type);799 GLib.Test.add_func ("/Unsupported server type", unsupported_server_type);
800 GLib.Test.add_func ("/Remote Login Only", remote_login_only);
801 GLib.Test.add_func ("/Manual Login Fallback", manual_login_fallback);
743802
744 return GLib.Test.run();803 return GLib.Test.run();
745 }804 }
746805
=== modified file 'tests/unity-greeter.vala'
--- tests/unity-greeter.vala 2013-02-20 16:17:42 +0000
+++ tests/unity-greeter.vala 2013-08-01 15:02:04 +0000
@@ -73,24 +73,28 @@
73 return "";73 return "";
74 }74 }
7575
76 public bool _show_manual_login_hint = true;
76 public bool show_manual_login_hint ()77 public bool show_manual_login_hint ()
77 {78 {
78 return false;79 return _show_manual_login_hint;
79 }80 }
8081
82 public bool _show_remote_login_hint = true;
81 public bool show_remote_login_hint ()83 public bool show_remote_login_hint ()
82 {84 {
83 return true;85 return _show_remote_login_hint;
84 }86 }
8587
88 public bool _hide_users_hint = false;
86 public bool hide_users_hint ()89 public bool hide_users_hint ()
87 {90 {
88 return false;91 return _hide_users_hint;
89 }92 }
9093
94 public bool _has_guest_account_hint = true;
91 public bool has_guest_account_hint ()95 public bool has_guest_account_hint ()
92 {96 {
93 return false;97 return _has_guest_account_hint;
94 }98 }
9599
96 public void start_session (string? session, Background bg)100 public void start_session (string? session, Background bg)

Subscribers

People subscribed via source and target branches