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

Proposed by Albert Astals Cid on 2012-08-22
Status: Superseded
Proposed branch: lp:~aacid/unity-greeter/no_servers_configured
Merge into: lp:unity-greeter
Diff against target: 189 lines (+103/-15)
3 files modified
configure.ac (+2/-0)
src/Makefile.am (+3/-0)
src/user-list.vala (+98/-15)
To merge this branch: bzr merge lp:~aacid/unity-greeter/no_servers_configured
Reviewer Review Type Date Requested Status
Unity Greeter Development Team 2012-08-22 Pending
Review via email: mp+120736@code.launchpad.net

This proposal has been superseded by a proposal from 2012-08-22.

Commit Message

Add the dialog when credentials are right but no servers are configured

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.
513. By Albert Astals Cid on 2012-08-22

Move to a separate function

514. By Albert Astals Cid on 2012-08-22

Add a "HELP" icon to the "*remote_directory" entries that shows the same dialog you get when you have no uccs servers setup

515. By Albert Astals Cid on 2012-08-22

Merge bzr+ssh://bazaar.launchpad.net/~aacid/unity-greeter/lightdm_api_change/

516. By Albert Astals Cid on 2012-08-22

Split code from get_lightdm_session and create is_supported_remote_session

517. By Albert Astals Cid on 2012-08-22

Merge++

518. By Albert Astals Cid on 2012-08-22

Start uccsconfigure in the "Set up..." button

519. By Albert Astals Cid on 2012-08-23

Use proper ellipsis

520. By Albert Astals Cid on 2012-08-23

Compile (or at least use the same way of api the other call to remote_authenticate uses :D)

521. By Albert Astals Cid on 2012-08-23

Set the focus on the "Set Up..." button as suggested by mterry

522. By Albert Astals Cid on 2012-08-23

Load the icon properly (even if it does not exist yet)

523. By Albert Astals Cid on 2012-08-23

Do not use a stop help icon but a stock one (which we don't have yet)

524. By Albert Astals Cid on 2012-08-23

Add _ here too

525. By Albert Astals Cid on 2012-08-23

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

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'configure.ac'
2--- configure.ac 2012-08-20 09:09:07 +0000
3+++ configure.ac 2012-08-22 15:04:44 +0000
4@@ -30,6 +30,8 @@
5 INDICATORDIR=`$PKG_CONFIG --variable=indicatordir indicator3-0.4`
6 AC_SUBST(INDICATORDIR)
7
8+AC_CHECK_LIB(lightdm-gobject-1, lightdm_get_remote_sessions, AC_SUBST(HAVE_REMOTE_LIGHTDM_FLAGS, ["-D HAVE_REMOTE_LIGHTDM"]))
9+
10 dnl ###########################################################################
11 dnl Internationalization
12 dnl ###########################################################################
13
14=== modified file 'src/Makefile.am'
15--- src/Makefile.am 2012-08-21 18:58:51 +0000
16+++ src/Makefile.am 2012-08-22 15:04:44 +0000
17@@ -42,6 +42,7 @@
18
19 unity_greeter_VALAFLAGS = \
20 --pkg posix \
21+ $(HAVE_REMOTE_LIGHTDM_FLAGS) \
22 --pkg gtk+-3.0 \
23 --pkg gdk-x11-3.0 \
24 --pkg gio-unix-2.0 \
25@@ -54,5 +55,7 @@
26 unity_greeter_LDADD = \
27 $(UNITY_GREETER_LIBS)
28
29+unity_greeter_vala.stamp: $(top_srcdir)/config.h
30+
31 DISTCLEANFILES = \
32 Makefile.in
33
34=== modified file 'src/user-list.vala'
35--- src/user-list.vala 2012-08-22 10:27:22 +0000
36+++ src/user-list.vala 2012-08-22 15:04:44 +0000
37@@ -192,6 +192,7 @@
38 var e = new PromptBox (list_name);
39 e.label = remote_server.name;
40 e.respond.connect (remote_directory_respond_cb);
41+ e.show_options.connect (show_remote_account_dialog);
42 add_entry (e);
43
44 remote_directory_server_list.append (remote_server);
45@@ -381,18 +382,25 @@
46 }
47 if (login_success)
48 {
49- string last_used_server_list_name = "";
50- foreach (RemoteServer remote_server in server_list)
51- {
52- var e = create_prompt_for_login_server (remote_server);
53- if (remote_server.last_used_server)
54- last_used_server_list_name = e.id;
55- }
56- if (last_used_server_list_name != "")
57- set_active_entry (last_used_server_list_name);
58- else
59- set_active_first_entry_with_prefix ("*remote_login");
60 password_field.did_respond = false;
61+ if (server_list.length == 0)
62+ {
63+ show_remote_account_dialog();
64+ }
65+ else
66+ {
67+ string last_used_server_list_name = "";
68+ foreach (RemoteServer remote_server in server_list)
69+ {
70+ var e = create_prompt_for_login_server (remote_server);
71+ if (remote_server.last_used_server)
72+ last_used_server_list_name = e.id;
73+ }
74+ if (last_used_server_list_name != "")
75+ set_active_entry (last_used_server_list_name);
76+ else
77+ set_active_first_entry_with_prefix ("*remote_login");
78+ }
79 }
80 else
81 {
82@@ -419,11 +427,64 @@
83 }
84 else
85 {
86- UnityGreeter.greeter.authenticate ();
87+#if HAVE_REMOTE_LIGHTDM
88+ UnityGreeter.greeter.authenticate_remote (get_lightdm_session(), null);
89+#endif
90 remote_login_service.set_last_used_server (currently_browsing_server_url, url_from_remote_loding_server_list_name (selected_entry.id));
91 }
92 }
93
94+ private void show_remote_account_dialog ()
95+ {
96+ Gtk.Dialog d = new Gtk.Dialog();
97+ d.set_position(Gtk.WindowPosition.CENTER_ALWAYS);
98+ string label1_text;
99+ if (offer_guest)
100+ {
101+ d.add_button(_("Cancel"), 0);
102+ d.add_button(_("Set Up..."), 1);
103+ label1_text = _("<b>You need an Ubuntu Remote Login\naccount to use this service. Would you\nlike to set up an account now?</b>");
104+ }
105+ else
106+ {
107+ d.add_button(_("OK"), 0);
108+ label1_text = _("<b>You need an Ubuntu Remote Login\naccount to use this service. Visit\nuccs.canonical.com to set up an account.</b>");
109+ }
110+
111+ Gtk.HBox hb = new Gtk.HBox(false, 10);
112+ Gtk.Image im = new Gtk.Image.from_file("remote-login-dialog.png");
113+ im.set_alignment(0.5f, 0);
114+ Gtk.VBox vb = new Gtk.VBox(false, 10);
115+ hb.pack_start(im, true, true, 5);
116+ hb.pack_end(vb, true, true, 5);
117+
118+ Gtk.Label l1 = new Gtk.Label(null);
119+ l1.set_markup(label1_text);
120+ l1.set_alignment(0, 0.5f);
121+ 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."));
122+ l2.set_alignment(0, 0.5f);
123+ vb.pack_start(l1);
124+ vb.pack_end(l2);
125+
126+ d.get_content_area().pack_start(hb);
127+
128+ d.show_all();
129+ d.response.connect((id) => {
130+ if (id == 1)
131+ {
132+ var config_session = "uccsconfigure";
133+ if (is_supported_remote_session(config_session))
134+ {
135+#if HAVE_REMOTE_LIGHTDM
136+ UnityGreeter.greeter.authenticate_remote (config_session);
137+#endif
138+ }
139+ }
140+ d.destroy();
141+ });
142+ d.run();
143+ }
144+
145 private bool change_background_timeout_cb ()
146 {
147 string new_background_file;
148@@ -748,8 +809,27 @@
149 }
150 else
151 {
152- return null;
153- }
154+ if (selected_entry.id.has_prefix ("*remote_directory"))
155+ return render_icon(Gtk.Stock.HELP, Gtk.IconSize.BUTTON, null);
156+ else
157+ return null;
158+ }
159+ }
160+
161+ private bool is_supported_remote_session (string session_name)
162+ {
163+ bool found = false;
164+#if HAVE_REMOTE_LIGHTDM
165+ foreach (var session in LightDM.get_remote_sessions ())
166+ {
167+ if (session.name == session_name)
168+ {
169+ found = true;
170+ break;
171+ }
172+ }
173+#endif
174+ return found;
175 }
176
177 protected override string get_lightdm_session ()
178@@ -768,7 +848,10 @@
179 }
180 it = it.next;
181 }
182- return answer;
183+ if (is_supported_remote_session(answer))
184+ return answer;
185+ else
186+ return "";
187 }
188 else
189 return session;

Subscribers

People subscribed via source and target branches