Merge lp:~mterry/unity-greeter/multi-prompts into lp:unity-greeter

Proposed by Michael Terry
Status: Merged
Merged at revision: 489
Proposed branch: lp:~mterry/unity-greeter/multi-prompts
Merge into: lp:unity-greeter
Prerequisite: lp:~mterry/unity-greeter/widget-refactor
Diff against target: 139 lines (+33/-12)
4 files modified
src/fadable.vala (+0/-1)
src/prompt-box.vala (+23/-4)
src/unity-greeter.vala (+8/-6)
src/user-list.vala (+2/-1)
To merge this branch: bzr merge lp:~mterry/unity-greeter/multi-prompts
Reviewer Review Type Date Requested Status
Ken VanDine Approve
Review via email: mp+103357@code.launchpad.net

Description of the change

Support multiple prompts at the same time from lightdm. Doesn't look great yet, because we don't push other names in the scroll list out of the way when the dash box gets larger. But that isn't a regression, and will be fixed in a future branch.

To test, look at the "Two Prompts" user in test mode.

To post a comment you must log in.
Revision history for this message
Ken VanDine (ken-vandine) wrote :

Looks good!

review: Approve
Revision history for this message
Robert Ancell (robert-ancell) wrote :

Merged now. Since Ken had checked it I was happy for you to push this, I didn't notice that the merge request wasn't set to approved. In the future just merge when getting one good review.

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

Oh whoops. This branch was co-dependent on https://code.launchpad.net/~mterry/lightdm/multi-prompt/+merge/103321 which didn't land. So it shouldn't have been merged. I'll unmerge it.

I should have left a comment here to that effect.

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

Actually, most of this branch is obsolete now with maza. A lot of the fixes got put there. The only other change was the final merging of responses, which will need a new branch anyway.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/fadable.vala'
2--- src/fadable.vala 2012-04-24 19:47:29 +0000
3+++ src/fadable.vala 2012-04-24 19:47:29 +0000
4@@ -59,7 +59,6 @@
5 alpha = progress;
6 if (progress == 1.0)
7 {
8- widget.grab_focus ();
9 done ();
10 }
11 }
12
13=== modified file 'src/prompt-box.vala'
14--- src/prompt-box.vala 2012-04-24 19:47:29 +0000
15+++ src/prompt-box.vala 2012-04-24 19:47:29 +0000
16@@ -208,11 +208,18 @@
17
18 private void foreach_prompt_widget (Gtk.Callback cb)
19 {
20- foreach (var w in box_grid.get_children ())
21+ var prompt_widgets = new List<Gtk.Widget> ();
22+
23+ var i = 0;
24+ Gtk.Widget c;
25+ while ((c = box_grid.get_child_at (COL_ENTRIES_START, ROW_ENTRIES_START + i)) != null)
26 {
27- if (w.get_data<Gtk.Widget> ("prompt-box-widget") != null)
28- cb (w);
29+ prompt_widgets.append (c);
30+ i++;
31 }
32+
33+ foreach (var w in prompt_widgets)
34+ cb (w);
35 }
36
37 public void clear ()
38@@ -315,7 +322,19 @@
39
40 private void entry_activate_cb (Gtk.Entry entry)
41 {
42- respond (entry.text);
43+ string response = null;
44+ foreach_prompt_widget ((w) =>
45+ {
46+ if (w is Gtk.Entry)
47+ {
48+ var e = w as Gtk.Entry;
49+ if (response != null)
50+ response += "\n" + e.text;
51+ else
52+ response = e.text;
53+ }
54+ });
55+ respond (response);
56 }
57
58 public void add_button (string text, string? accessible_text)
59
60=== modified file 'src/unity-greeter.vala'
61--- src/unity-greeter.vala 2012-04-24 19:47:29 +0000
62+++ src/unity-greeter.vala 2012-04-24 19:47:29 +0000
63@@ -388,9 +388,6 @@
64 if (text == "login:")
65 text = _("Username:");
66 user_list.show_prompt (text, type == LightDM.PromptType.SECRET);
67-
68- /* Clear messages on the next prompt */
69- clear_messages = true;
70 }
71
72 private void background_loaded_cb (ParamSpec pspec)
73@@ -466,6 +463,7 @@
74 /* Show an error if one wasn't provided */
75 if (clear_messages)
76 user_list.clear_messages ();
77+ clear_messages = false;
78 if (!user_list.have_messages ())
79 user_list.show_message (_("Invalid password, please try again"), true);
80
81@@ -508,8 +506,6 @@
82 /* Reset manual username */
83 user_list.manual_username = null;
84
85- clear_messages = false;
86-
87 if (test_mode)
88 {
89 test_username = null;
90@@ -565,7 +561,7 @@
91 show_prompt_cb (_("Password:"), LightDM.PromptType.SECRET);
92 break;
93 case "two-prompts":
94- show_prompt_cb (_("Favorite Color:"), LightDM.PromptType.QUESTION);
95+ show_prompt_cb (_("Favorite Color (blue):"), LightDM.PromptType.QUESTION);
96 show_prompt_cb (_("Password:"), LightDM.PromptType.SECRET);
97 break;
98 default:
99@@ -586,6 +582,8 @@
100
101 private void respond_to_prompt_cb (string text)
102 {
103+ clear_messages = true;
104+
105 if (test_mode)
106 {
107 debug ("response %s", text);
108@@ -658,6 +656,10 @@
109 show_message_cb ("Account is locked", LightDM.MessageType.ERROR);
110 authentication_complete_cb ();
111 break;
112+ case "two-prompts":
113+ test_is_authenticated = text == "blue\npassword";
114+ authentication_complete_cb ();
115+ break;
116 default:
117 test_is_authenticated = text == "password";
118 authentication_complete_cb ();
119
120=== modified file 'src/user-list.vala'
121--- src/user-list.vala 2012-04-24 19:47:29 +0000
122+++ src/user-list.vala 2012-04-24 19:47:29 +0000
123@@ -289,7 +289,7 @@
124 public void show_prompt (string text, bool secret = false)
125 {
126 string accessible_text = null;
127- if (selected_entry != null && selected_entry.name != null)
128+ if (selected_entry != null && selected_entry.label != null)
129 accessible_text = _("Enter password for %s").printf (selected_entry.label);
130 selected_entry.prompt_box.add_prompt (text, accessible_text, secret);
131
132@@ -625,6 +625,7 @@
133 user_displayed_done ();
134 mode = Mode.LOGIN;
135 login_box.set_base (selected_entry.prompt_box);
136+ focus_prompt ();
137 }
138
139 private void select_entry (UserEntry entry, double direction)

Subscribers

People subscribed via source and target branches