Merge lp:~aacid/unity-greeter/no_servers_configured into lp:unity-greeter

Proposed by Albert Astals Cid
Status: Merged
Merged at revision: 523
Proposed branch: lp:~aacid/unity-greeter/no_servers_configured
Merge into: lp:unity-greeter
Prerequisite: lp:~aacid/unity-greeter/lightdm_api_change
Diff against target: 187 lines (+98/-33)
2 files modified
src/session-list.vala (+2/-0)
src/user-list.vala (+96/-33)
To merge this branch: bzr merge lp:~aacid/unity-greeter/no_servers_configured
Reviewer Review Type Date Requested Status
Michael Terry (community) Approve
Review via email: mp+120805@code.launchpad.net

This proposal supersedes a proposal from 2012-08-22.

Description of the change

Add the dialog the spec says we have to show when credentials are right but no servers are configured

To post a comment you must log in.
Revision history for this message
Michael Terry (mterry) wrote :

Ugh, this dialog is very different from anything else unity-greeter can do. Can it be made a separate slide-in list like the SessionChooser?

Also, remote-login-dialog.png needs to be added and referenced correctly from the code. See other png loading in the code.

review: Needs Fixing
Revision history for this message
Albert Astals Cid (aacid) wrote :

The spec says we have to show a dialog, speak with mpt/ted about it.

The .png doesn't exist yet (there's a bug about it), but i'll look at how the other loading is done and use it.

Revision history for this message
Ted Gould (ted) wrote :

Well, that's a bit untrue. For instance if you do Switch Off.. you see a similar dialog. So there are dialogs in various parts of the greeter, they're just all out of the standard flow. This one is too.

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

Also, the help icon seems out of place (too colorful). Is that a hold-in temporary icon?

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

But yeah, seems sound besides the icons.

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

Oh and two more nits:
1) The cancel button has the default keyboard focus. Should probably be Set Up.
2) Set Up should use a proper ellipses: …

Revision history for this message
Albert Astals Cid (aacid) wrote :

About the help icon, it's the stock help icon of the theme, so i assumed it'd be fine. I've asked around to our designers what they think about it, will report back when they answer.

Revision history for this message
Albert Astals Cid (aacid) wrote :

Talked to designers and they agree with you we need a new icon, created a bug for tracking it and changed the code to load a custom icon instead of the theme one.

Revision history for this message
Albert Astals Cid (aacid) wrote :

Ok, besides the icons missing i think everything should be fine, it'd be cool if you could give it a final review and merge it if there's nothing missing :-)

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

Besides the missing icons, I do see one last thing:

get_badge() is going to keep loading that help icon. We have a cache of those in SessionList for performance reasons. Probably better to add a recognized session in SessionList.get_badge_name() that does "remote-login" -> "remote_login_badge.png" and then call SessionList.get_badge for it. That will automatically cache it as needed.

525. By Albert Astals Cid

Add the "remote-login" help badge to the session list cache so we don't have to load it everytime as suggested by mterry

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

BTW, I've noticed that the original remote-login branch caused an annoying regression. With enable-remote-login enabled, and if you're using an actual installed unity-greeter (i.e. not test mode), as soon as the Remote Login option appears, focus leaves the existing entry. With the effect that right after the greeter appears, you lose focus. Not part of this specific branch review, but wanted to mention it here before I went EOD.

Revision history for this message
Albert Astals Cid (aacid) wrote :

The focus thing should be fixed in https://code.launchpad.net/~aacid/unity-greeter/keep_focus_on_adding_entries/+merge/121142 (I also added a timeout for the Remote Login stuff in test mode so i could easily reproduce the error there too)

Was there anything else missing in this review?

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

Still just the two images.

Revision history for this message
Albert Astals Cid (aacid) wrote :

Oh, i thought we were commiting this without the images because the Feature Freeze is much before the UI Freeze so we needed to meet the Feature Freeze with code but could wait a few days/weeks for the UI Freeze to get the icons.

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

I changed the badge to the "unknown" badge and commented out the dialog icon for now. Otherwise the badge wouldn't show at all, and we want that to be at least functional until we get icons.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/session-list.vala'
2--- src/session-list.vala 2012-08-03 13:49:20 +0000
3+++ src/session-list.vala 2012-08-23 15:32:20 +0000
4@@ -125,6 +125,8 @@
5 return "kde_badge.png";
6 case "xterm":
7 return "recovery_console_badge.png";
8+ case "remote-login":
9+ return "remote_login_help.png";
10 default:
11 return null;
12 }
13
14=== modified file 'src/user-list.vala'
15--- src/user-list.vala 2012-08-22 14:24:18 +0000
16+++ src/user-list.vala 2012-08-23 15:32:20 +0000
17@@ -192,6 +192,7 @@
18 var e = new PromptBox (list_name);
19 e.label = remote_server.name;
20 e.respond.connect (remote_directory_respond_cb);
21+ e.show_options.connect (show_remote_account_dialog);
22 add_entry (e);
23
24 remote_directory_server_list.append (remote_server);
25@@ -381,18 +382,25 @@
26 }
27 if (login_success)
28 {
29- string last_used_server_list_name = "";
30- foreach (RemoteServer remote_server in server_list)
31- {
32- var e = create_prompt_for_login_server (remote_server);
33- if (remote_server.last_used_server)
34- last_used_server_list_name = e.id;
35- }
36- if (last_used_server_list_name != "")
37- set_active_entry (last_used_server_list_name);
38- else
39- set_active_first_entry_with_prefix ("*remote_login");
40 password_field.did_respond = false;
41+ if (server_list.length == 0)
42+ {
43+ show_remote_account_dialog();
44+ }
45+ else
46+ {
47+ string last_used_server_list_name = "";
48+ foreach (RemoteServer remote_server in server_list)
49+ {
50+ var e = create_prompt_for_login_server (remote_server);
51+ if (remote_server.last_used_server)
52+ last_used_server_list_name = e.id;
53+ }
54+ if (last_used_server_list_name != "")
55+ set_active_entry (last_used_server_list_name);
56+ else
57+ set_active_first_entry_with_prefix ("*remote_login");
58+ }
59 }
60 else
61 {
62@@ -426,6 +434,58 @@
63 }
64 }
65
66+ private void show_remote_account_dialog ()
67+ {
68+ Gtk.Dialog d = new Gtk.Dialog();
69+ d.set_position(Gtk.WindowPosition.CENTER_ALWAYS);
70+ string label1_text;
71+ if (offer_guest)
72+ {
73+ d.add_button(_("Cancel"), 0);
74+ Gtk.Widget b = d.add_button(_("Set Up…"), 1);
75+ b.grab_focus();
76+ label1_text = _("<b>You need an Ubuntu Remote Login\naccount to use this service. Would you\nlike to set up an account now?</b>");
77+ }
78+ else
79+ {
80+ d.add_button(_("OK"), 0);
81+ label1_text = _("<b>You need an Ubuntu Remote Login\naccount to use this service. Visit\nuccs.canonical.com to set up an account.</b>");
82+ }
83+
84+ Gtk.HBox hb = new Gtk.HBox(false, 10);
85+ Gtk.Image im = new Gtk.Image.from_file(Path.build_filename (Config.PKGDATADIR, "remote_login_dialog.png", null));
86+ im.set_alignment(0.5f, 0);
87+ Gtk.VBox vb = new Gtk.VBox(false, 10);
88+ hb.pack_start(im, true, true, 5);
89+ hb.pack_end(vb, true, true, 5);
90+
91+ Gtk.Label l1 = new Gtk.Label(null);
92+ l1.set_markup(label1_text);
93+ l1.set_alignment(0, 0.5f);
94+ Gtk.Label l2 = new Gtk.Label(_("If you have an account on an RDP or\nCitrix server, Remote Login lets you run\napplications from that server."));
95+ l2.set_alignment(0, 0.5f);
96+ vb.pack_start(l1);
97+ vb.pack_end(l2);
98+
99+ d.get_content_area().pack_start(hb);
100+
101+ d.show_all();
102+ d.response.connect((id) => {
103+ if (id == 1)
104+ {
105+ var config_session = "uccsconfigure";
106+ if (is_supported_remote_session(config_session))
107+ {
108+#if HAVE_REMOTE_LIGHTDM
109+ UnityGreeter.greeter.authenticate_remote (config_session, "");
110+#endif
111+ }
112+ }
113+ d.destroy();
114+ });
115+ d.run();
116+ }
117+
118 private bool change_background_timeout_cb ()
119 {
120 string new_background_file;
121@@ -750,15 +810,33 @@
122 }
123 else
124 {
125- return null;
126- }
127+ if (selected_entry.id.has_prefix ("*remote_directory"))
128+ return SessionList.get_badge ("remote-login");
129+ else
130+ return null;
131+ }
132+ }
133+
134+ private bool is_supported_remote_session (string session_name)
135+ {
136+ bool found = false;
137+#if HAVE_REMOTE_LIGHTDM
138+ foreach (var session in LightDM.get_remote_sessions ())
139+ {
140+ if (session.name == session_name)
141+ {
142+ found = true;
143+ break;
144+ }
145+ }
146+#endif
147+ return found;
148 }
149
150 protected override string get_lightdm_session ()
151 {
152 if (selected_entry.id.has_prefix ("*remote_login"))
153 {
154-#if HAVE_REMOTE_LIGHTDM
155 var url = url_from_remote_loding_server_list_name (selected_entry.id);
156 unowned List<RemoteServer?> it = remote_login_server_list;
157 var answer = "";
158@@ -771,25 +849,10 @@
159 }
160 it = it.next;
161 }
162- // Check answer is one of the supported types
163- if (answer != "")
164- {
165- bool found = false;
166- foreach (var session in LightDM.get_remote_sessions ())
167- {
168- if (session.name == answer)
169- {
170- found = true;
171- break;
172- }
173- }
174- if (!found)
175- answer = "";
176- }
177- return answer;
178-#else
179- return "";
180-#endif
181+ if (is_supported_remote_session(answer))
182+ return answer;
183+ else
184+ return "";
185 }
186 else
187 return session;

Subscribers

People subscribed via source and target branches