Merge lp:~robert-ancell/unity-greeter/end-session-dialog into lp:unity-greeter
- end-session-dialog
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Michael Terry |
Approved revision: | 1031 |
Merged at revision: | 1013 |
Proposed branch: | lp:~robert-ancell/unity-greeter/end-session-dialog |
Merge into: | lp:unity-greeter |
Diff against target: |
820 lines (+575/-17) 12 files modified
configure.ac (+1/-1) data/Makefile.am (+13/-0) debian/changelog (+7/-0) po/POTFILES.in (+1/-1) po/POTFILES.skip (+1/-0) src/Makefile.am (+1/-0) src/fixes.vapi (+6/-0) src/main-window.vala (+75/-14) src/settings-daemon.vala (+36/-0) src/shutdown-dialog.vala (+381/-0) src/unity-greeter.vala (+51/-0) tests/Makefile.am (+2/-1) |
To merge this branch: | bzr merge lp:~robert-ancell/unity-greeter/end-session-dialog |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Michael Terry (community) | Approve | ||
Review via email: mp+193880@code.launchpad.net |
This proposal supersedes a proposal from 2013-10-21.
Commit message
Use Unity style shutdown dialogs
Handle hardware power button in greeter
Description of the change
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1018
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
FAILED: Continuous integration, rev:1020
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
PASSED: Continuous integration, rev:1022
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Michael Terry (mterry) wrote : Posted in a previous version of this proposal | # |
So we talked about this on IRC. Sounds like it needs at least keyboard navigation before landing. Also mentioned was the use of a well-known DBus name vs unique.
Michael Terry (mterry) wrote : Posted in a previous version of this proposal | # |
Whoops, forgot to set status.
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
PASSED: Continuous integration, rev:1029
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Robert Ancell (robert-ancell) wrote : | # |
Should be good now - can you re-review?
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal | # |
PASSED: Continuous integration, rev:1031
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:1031
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:1031
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Michael Terry (mterry) wrote : | # |
Works better for me now, thanks!
PS Jenkins bot (ps-jenkins) : | # |
Preview Diff
1 | === modified file 'configure.ac' | |||
2 | --- configure.ac 2013-10-02 17:46:49 +0000 | |||
3 | +++ configure.ac 2013-11-05 04:29:38 +0000 | |||
4 | @@ -2,7 +2,7 @@ | |||
5 | 2 | 2 | ||
6 | 3 | dnl Process this file with autoconf to produce a configure script. | 3 | dnl Process this file with autoconf to produce a configure script. |
7 | 4 | 4 | ||
9 | 5 | AC_INIT(unity-greeter, 13.10.3) | 5 | AC_INIT(unity-greeter, 14.04.0) |
10 | 6 | AC_CONFIG_MACRO_DIR(m4) | 6 | AC_CONFIG_MACRO_DIR(m4) |
11 | 7 | AM_INIT_AUTOMAKE | 7 | AM_INIT_AUTOMAKE |
12 | 8 | AM_PROG_CC_C_O | 8 | AM_PROG_CC_C_O |
13 | 9 | 9 | ||
14 | === modified file 'data/Makefile.am' | |||
15 | --- data/Makefile.am 2012-10-18 14:45:57 +0000 | |||
16 | +++ data/Makefile.am 2013-11-05 04:29:38 +0000 | |||
17 | @@ -9,13 +9,26 @@ | |||
18 | 9 | arrow_left.png \ | 9 | arrow_left.png \ |
19 | 10 | arrow_right.png \ | 10 | arrow_right.png \ |
20 | 11 | cof.png \ | 11 | cof.png \ |
21 | 12 | dialog_close_highlight.png \ | ||
22 | 13 | dialog_close.png \ | ||
23 | 12 | gnome_badge.png \ | 14 | gnome_badge.png \ |
24 | 15 | hibernate_highlight.png \ | ||
25 | 16 | hibernate.png \ | ||
26 | 13 | kde_badge.png \ | 17 | kde_badge.png \ |
27 | 14 | logo.png \ | 18 | logo.png \ |
28 | 15 | message.png \ | 19 | message.png \ |
29 | 16 | recovery_console_badge.png \ | 20 | recovery_console_badge.png \ |
30 | 17 | remote_login_help.png \ | 21 | remote_login_help.png \ |
31 | 22 | restart_highlight.png \ | ||
32 | 23 | restart.png \ | ||
33 | 18 | shadow.png \ | 24 | shadow.png \ |
34 | 25 | shutdown_highlight.png \ | ||
35 | 26 | shutdown.png \ | ||
36 | 27 | suspend_highlight.png \ | ||
37 | 28 | suspend.png \ | ||
38 | 29 | switcher_corner.png \ | ||
39 | 30 | switcher_left.png \ | ||
40 | 31 | switcher_top.png \ | ||
41 | 19 | ubuntu_badge.png \ | 32 | ubuntu_badge.png \ |
42 | 20 | unknown_badge.png | 33 | unknown_badge.png |
43 | 21 | 34 | ||
44 | 22 | 35 | ||
45 | === added file 'data/dialog_close.png' | |||
46 | 23 | Binary files data/dialog_close.png 1970-01-01 00:00:00 +0000 and data/dialog_close.png 2013-11-05 04:29:38 +0000 differ | 36 | Binary files data/dialog_close.png 1970-01-01 00:00:00 +0000 and data/dialog_close.png 2013-11-05 04:29:38 +0000 differ |
47 | === added file 'data/dialog_close_highlight.png' | |||
48 | 24 | Binary files data/dialog_close_highlight.png 1970-01-01 00:00:00 +0000 and data/dialog_close_highlight.png 2013-11-05 04:29:38 +0000 differ | 37 | Binary files data/dialog_close_highlight.png 1970-01-01 00:00:00 +0000 and data/dialog_close_highlight.png 2013-11-05 04:29:38 +0000 differ |
49 | === added file 'data/hibernate.png' | |||
50 | 25 | Binary files data/hibernate.png 1970-01-01 00:00:00 +0000 and data/hibernate.png 2013-11-05 04:29:38 +0000 differ | 38 | Binary files data/hibernate.png 1970-01-01 00:00:00 +0000 and data/hibernate.png 2013-11-05 04:29:38 +0000 differ |
51 | === added file 'data/hibernate_highlight.png' | |||
52 | 26 | Binary files data/hibernate_highlight.png 1970-01-01 00:00:00 +0000 and data/hibernate_highlight.png 2013-11-05 04:29:38 +0000 differ | 39 | Binary files data/hibernate_highlight.png 1970-01-01 00:00:00 +0000 and data/hibernate_highlight.png 2013-11-05 04:29:38 +0000 differ |
53 | === added file 'data/restart.png' | |||
54 | 27 | Binary files data/restart.png 1970-01-01 00:00:00 +0000 and data/restart.png 2013-11-05 04:29:38 +0000 differ | 40 | Binary files data/restart.png 1970-01-01 00:00:00 +0000 and data/restart.png 2013-11-05 04:29:38 +0000 differ |
55 | === added file 'data/restart_highlight.png' | |||
56 | 28 | Binary files data/restart_highlight.png 1970-01-01 00:00:00 +0000 and data/restart_highlight.png 2013-11-05 04:29:38 +0000 differ | 41 | Binary files data/restart_highlight.png 1970-01-01 00:00:00 +0000 and data/restart_highlight.png 2013-11-05 04:29:38 +0000 differ |
57 | === added file 'data/shutdown.png' | |||
58 | 29 | Binary files data/shutdown.png 1970-01-01 00:00:00 +0000 and data/shutdown.png 2013-11-05 04:29:38 +0000 differ | 42 | Binary files data/shutdown.png 1970-01-01 00:00:00 +0000 and data/shutdown.png 2013-11-05 04:29:38 +0000 differ |
59 | === added file 'data/shutdown_highlight.png' | |||
60 | 30 | Binary files data/shutdown_highlight.png 1970-01-01 00:00:00 +0000 and data/shutdown_highlight.png 2013-11-05 04:29:38 +0000 differ | 43 | Binary files data/shutdown_highlight.png 1970-01-01 00:00:00 +0000 and data/shutdown_highlight.png 2013-11-05 04:29:38 +0000 differ |
61 | === added file 'data/suspend.png' | |||
62 | 31 | Binary files data/suspend.png 1970-01-01 00:00:00 +0000 and data/suspend.png 2013-11-05 04:29:38 +0000 differ | 44 | Binary files data/suspend.png 1970-01-01 00:00:00 +0000 and data/suspend.png 2013-11-05 04:29:38 +0000 differ |
63 | === added file 'data/suspend_highlight.png' | |||
64 | 32 | Binary files data/suspend_highlight.png 1970-01-01 00:00:00 +0000 and data/suspend_highlight.png 2013-11-05 04:29:38 +0000 differ | 45 | Binary files data/suspend_highlight.png 1970-01-01 00:00:00 +0000 and data/suspend_highlight.png 2013-11-05 04:29:38 +0000 differ |
65 | === added file 'data/switcher_corner.png' | |||
66 | 33 | Binary files data/switcher_corner.png 1970-01-01 00:00:00 +0000 and data/switcher_corner.png 2013-11-05 04:29:38 +0000 differ | 46 | Binary files data/switcher_corner.png 1970-01-01 00:00:00 +0000 and data/switcher_corner.png 2013-11-05 04:29:38 +0000 differ |
67 | === added file 'data/switcher_left.png' | |||
68 | 34 | Binary files data/switcher_left.png 1970-01-01 00:00:00 +0000 and data/switcher_left.png 2013-11-05 04:29:38 +0000 differ | 47 | Binary files data/switcher_left.png 1970-01-01 00:00:00 +0000 and data/switcher_left.png 2013-11-05 04:29:38 +0000 differ |
69 | === added file 'data/switcher_top.png' | |||
70 | 35 | Binary files data/switcher_top.png 1970-01-01 00:00:00 +0000 and data/switcher_top.png 2013-11-05 04:29:38 +0000 differ | 48 | Binary files data/switcher_top.png 1970-01-01 00:00:00 +0000 and data/switcher_top.png 2013-11-05 04:29:38 +0000 differ |
71 | === modified file 'debian/changelog' | |||
72 | --- debian/changelog 2013-10-03 13:59:34 +0000 | |||
73 | +++ debian/changelog 2013-11-05 04:29:38 +0000 | |||
74 | @@ -1,3 +1,10 @@ | |||
75 | 1 | unity-greeter (14.04.0-0ubuntu1) UNRELEASED; urgency=low | ||
76 | 2 | |||
77 | 3 | * Use Unity style shutdown dialogs | ||
78 | 4 | * Handle hardware power button in greeter | ||
79 | 5 | |||
80 | 6 | -- Robert Ancell <robert.ancell@canonical.com> Mon, 21 Oct 2013 17:15:38 +1300 | ||
81 | 7 | |||
82 | 1 | unity-greeter (13.10.3-0ubuntu1) saucy; urgency=low | 8 | unity-greeter (13.10.3-0ubuntu1) saucy; urgency=low |
83 | 2 | 9 | ||
84 | 3 | [ William Hua ] | 10 | [ William Hua ] |
85 | 4 | 11 | ||
86 | === modified file 'po/POTFILES.in' | |||
87 | --- po/POTFILES.in 2012-11-08 15:48:14 +0000 | |||
88 | +++ po/POTFILES.in 2013-11-05 04:29:38 +0000 | |||
89 | @@ -19,8 +19,8 @@ | |||
90 | 19 | src/session-list.vala | 19 | src/session-list.vala |
91 | 20 | src/settings-daemon.vala | 20 | src/settings-daemon.vala |
92 | 21 | src/settings.vala | 21 | src/settings.vala |
93 | 22 | src/shutdown-dialog.vala | ||
94 | 22 | src/toggle-box.vala | 23 | src/toggle-box.vala |
95 | 23 | src/unity-greeter.vala | 24 | src/unity-greeter.vala |
96 | 24 | src/user-list.vala | 25 | src/user-list.vala |
97 | 25 | src/user-prompt-box.vala | 26 | src/user-prompt-box.vala |
98 | 26 | |||
99 | 27 | 27 | ||
100 | === modified file 'po/POTFILES.skip' | |||
101 | --- po/POTFILES.skip 2012-11-08 15:48:14 +0000 | |||
102 | +++ po/POTFILES.skip 2013-11-05 04:29:38 +0000 | |||
103 | @@ -17,6 +17,7 @@ | |||
104 | 17 | src/session-list.c | 17 | src/session-list.c |
105 | 18 | src/settings-daemon.c | 18 | src/settings-daemon.c |
106 | 19 | src/settings.c | 19 | src/settings.c |
107 | 20 | src/shutdown-dialog.c | ||
108 | 20 | src/toggle-box.c | 21 | src/toggle-box.c |
109 | 21 | src/unity-greeter.c | 22 | src/unity-greeter.c |
110 | 22 | src/user-list.c | 23 | src/user-list.c |
111 | 23 | 24 | ||
112 | === modified file 'src/Makefile.am' | |||
113 | --- src/Makefile.am 2013-10-17 22:09:16 +0000 | |||
114 | +++ src/Makefile.am 2013-11-05 04:29:38 +0000 | |||
115 | @@ -27,6 +27,7 @@ | |||
116 | 27 | remote-login-service.vala \ | 27 | remote-login-service.vala \ |
117 | 28 | settings.vala \ | 28 | settings.vala \ |
118 | 29 | settings-daemon.vala \ | 29 | settings-daemon.vala \ |
119 | 30 | shutdown-dialog.vala \ | ||
120 | 30 | toggle-box.vala \ | 31 | toggle-box.vala \ |
121 | 31 | unity-greeter.vala \ | 32 | unity-greeter.vala \ |
122 | 32 | user-list.vala \ | 33 | user-list.vala \ |
123 | 33 | 34 | ||
124 | === modified file 'src/fixes.vapi' | |||
125 | --- src/fixes.vapi 2013-10-24 12:27:03 +0000 | |||
126 | +++ src/fixes.vapi 2013-11-05 04:29:38 +0000 | |||
127 | @@ -33,12 +33,16 @@ | |||
128 | 33 | public const int KEY_Page_Down; | 33 | public const int KEY_Page_Down; |
129 | 34 | public const int KEY_Up; | 34 | public const int KEY_Up; |
130 | 35 | public const int KEY_Down; | 35 | public const int KEY_Down; |
131 | 36 | public const int KEY_Left; | ||
132 | 37 | public const int KEY_Right; | ||
133 | 36 | public const int KEY_KP_Home; | 38 | public const int KEY_KP_Home; |
134 | 37 | public const int KEY_KP_End; | 39 | public const int KEY_KP_End; |
135 | 38 | public const int KEY_KP_Page_Up; | 40 | public const int KEY_KP_Page_Up; |
136 | 39 | public const int KEY_KP_Page_Down; | 41 | public const int KEY_KP_Page_Down; |
137 | 40 | public const int KEY_KP_Up; | 42 | public const int KEY_KP_Up; |
138 | 41 | public const int KEY_KP_Down; | 43 | public const int KEY_KP_Down; |
139 | 44 | public const int KEY_KP_Left; | ||
140 | 45 | public const int KEY_KP_Right; | ||
141 | 42 | public const int KEY_F10; | 46 | public const int KEY_F10; |
142 | 43 | public const int KEY_0; | 47 | public const int KEY_0; |
143 | 44 | public const int KEY_g; | 48 | public const int KEY_g; |
144 | @@ -47,10 +51,12 @@ | |||
145 | 47 | public const int KEY_m; | 51 | public const int KEY_m; |
146 | 48 | public const int KEY_M; | 52 | public const int KEY_M; |
147 | 49 | public const int KEY_s; | 53 | public const int KEY_s; |
148 | 54 | public const int KEY_z; | ||
149 | 50 | public const int KEY_plus; | 55 | public const int KEY_plus; |
150 | 51 | public const int KEY_minus; | 56 | public const int KEY_minus; |
151 | 52 | public const int KEY_equal; | 57 | public const int KEY_equal; |
152 | 53 | public const int CONTROL_MASK; | 58 | public const int CONTROL_MASK; |
153 | 59 | public const int KEY_PowerOff; | ||
154 | 54 | } | 60 | } |
155 | 55 | 61 | ||
156 | 56 | namespace Gtk | 62 | namespace Gtk |
157 | 57 | 63 | ||
158 | === modified file 'src/main-window.vala' | |||
159 | --- src/main-window.vala 2013-02-08 15:53:16 +0000 | |||
160 | +++ src/main-window.vala 2013-11-05 04:29:38 +0000 | |||
161 | @@ -24,10 +24,12 @@ | |||
162 | 24 | public MenuBar menubar; | 24 | public MenuBar menubar; |
163 | 25 | 25 | ||
164 | 26 | private List<Monitor> monitors; | 26 | private List<Monitor> monitors; |
165 | 27 | private Monitor active_monitor; | ||
166 | 27 | private Background background; | 28 | private Background background; |
167 | 28 | private Gtk.Box login_box; | 29 | private Gtk.Box login_box; |
168 | 29 | private Gtk.Box hbox; | 30 | private Gtk.Box hbox; |
169 | 30 | private Gtk.Button back_button; | 31 | private Gtk.Button back_button; |
170 | 32 | private ShutdownDialog? shutdown_dialog = null; | ||
171 | 31 | 33 | ||
172 | 32 | public ListStack stack; | 34 | public ListStack stack; |
173 | 33 | 35 | ||
174 | @@ -245,9 +247,16 @@ | |||
175 | 245 | 247 | ||
176 | 246 | private void move_to_monitor (Monitor monitor) | 248 | private void move_to_monitor (Monitor monitor) |
177 | 247 | { | 249 | { |
178 | 250 | active_monitor = monitor; | ||
179 | 248 | login_box.set_size_request (monitor.width, monitor.height); | 251 | login_box.set_size_request (monitor.width, monitor.height); |
180 | 249 | background.set_active_monitor (monitor); | 252 | background.set_active_monitor (monitor); |
181 | 250 | background.move (login_box, monitor.x, monitor.y); | 253 | background.move (login_box, monitor.x, monitor.y); |
182 | 254 | |||
183 | 255 | if (shutdown_dialog != null) | ||
184 | 256 | { | ||
185 | 257 | shutdown_dialog.set_size_request (monitor.width, monitor.height); | ||
186 | 258 | background.move (shutdown_dialog, monitor.x, monitor.y); | ||
187 | 259 | } | ||
188 | 251 | } | 260 | } |
189 | 252 | 261 | ||
190 | 253 | private void add_user_list () | 262 | private void add_user_list () |
191 | @@ -266,36 +275,88 @@ | |||
192 | 266 | switch (event.keyval) | 275 | switch (event.keyval) |
193 | 267 | { | 276 | { |
194 | 268 | case Gdk.KEY_Escape: | 277 | case Gdk.KEY_Escape: |
197 | 269 | top.cancel_authentication (); | 278 | if (login_box.sensitive) |
198 | 270 | break; | 279 | top.cancel_authentication (); |
199 | 280 | if (shutdown_dialog != null) | ||
200 | 281 | shutdown_dialog.cancel (); | ||
201 | 282 | return true; | ||
202 | 271 | case Gdk.KEY_Page_Up: | 283 | case Gdk.KEY_Page_Up: |
203 | 272 | case Gdk.KEY_KP_Page_Up: | 284 | case Gdk.KEY_KP_Page_Up: |
206 | 273 | top.scroll (GreeterList.ScrollTarget.START); | 285 | if (login_box.sensitive) |
207 | 274 | break; | 286 | top.scroll (GreeterList.ScrollTarget.START); |
208 | 287 | return true; | ||
209 | 275 | case Gdk.KEY_Page_Down: | 288 | case Gdk.KEY_Page_Down: |
210 | 276 | case Gdk.KEY_KP_Page_Down: | 289 | case Gdk.KEY_KP_Page_Down: |
213 | 277 | top.scroll (GreeterList.ScrollTarget.END); | 290 | if (login_box.sensitive) |
214 | 278 | break; | 291 | top.scroll (GreeterList.ScrollTarget.END); |
215 | 292 | return true; | ||
216 | 279 | case Gdk.KEY_Up: | 293 | case Gdk.KEY_Up: |
217 | 280 | case Gdk.KEY_KP_Up: | 294 | case Gdk.KEY_KP_Up: |
220 | 281 | top.scroll (GreeterList.ScrollTarget.UP); | 295 | if (login_box.sensitive) |
221 | 282 | break; | 296 | top.scroll (GreeterList.ScrollTarget.UP); |
222 | 297 | return true; | ||
223 | 283 | case Gdk.KEY_Down: | 298 | case Gdk.KEY_Down: |
224 | 284 | case Gdk.KEY_KP_Down: | 299 | case Gdk.KEY_KP_Down: |
227 | 285 | top.scroll (GreeterList.ScrollTarget.DOWN); | 300 | if (login_box.sensitive) |
228 | 286 | break; | 301 | top.scroll (GreeterList.ScrollTarget.DOWN); |
229 | 302 | return true; | ||
230 | 303 | case Gdk.KEY_Left: | ||
231 | 304 | case Gdk.KEY_KP_Left: | ||
232 | 305 | if (shutdown_dialog != null) | ||
233 | 306 | shutdown_dialog.focus_prev (); | ||
234 | 307 | return true; | ||
235 | 308 | case Gdk.KEY_Right: | ||
236 | 309 | case Gdk.KEY_KP_Right: | ||
237 | 310 | if (shutdown_dialog != null) | ||
238 | 311 | shutdown_dialog.focus_next (); | ||
239 | 312 | return true; | ||
240 | 287 | case Gdk.KEY_F10: | 313 | case Gdk.KEY_F10: |
242 | 288 | menubar.select_first (false); | 314 | if (login_box.sensitive) |
243 | 315 | menubar.select_first (false); | ||
244 | 316 | return true; | ||
245 | 317 | case Gdk.KEY_PowerOff: | ||
246 | 318 | show_shutdown_dialog (ShutdownDialogType.SHUTDOWN); | ||
247 | 319 | return true; | ||
248 | 320 | case Gdk.KEY_z: | ||
249 | 321 | if (UnityGreeter.singleton.test_mode && (event.state & Gdk.ModifierType.MOD1_MASK) != 0) | ||
250 | 322 | { | ||
251 | 323 | show_shutdown_dialog (ShutdownDialogType.SHUTDOWN); | ||
252 | 324 | return true; | ||
253 | 325 | } | ||
254 | 289 | break; | 326 | break; |
255 | 290 | default: | ||
256 | 291 | return base.key_press_event (event); | ||
257 | 292 | } | 327 | } |
258 | 293 | 328 | ||
260 | 294 | return true; | 329 | return base.key_press_event (event); |
261 | 295 | } | 330 | } |
262 | 296 | 331 | ||
263 | 297 | public void set_keyboard_state () | 332 | public void set_keyboard_state () |
264 | 298 | { | 333 | { |
265 | 299 | menubar.set_keyboard_state (); | 334 | menubar.set_keyboard_state (); |
266 | 300 | } | 335 | } |
267 | 336 | |||
268 | 337 | public void show_shutdown_dialog (ShutdownDialogType type) | ||
269 | 338 | { | ||
270 | 339 | if (shutdown_dialog != null) | ||
271 | 340 | shutdown_dialog.destroy (); | ||
272 | 341 | |||
273 | 342 | /* Stop input to login box */ | ||
274 | 343 | login_box.sensitive = false; | ||
275 | 344 | |||
276 | 345 | shutdown_dialog = new ShutdownDialog (type); | ||
277 | 346 | shutdown_dialog.visible = true; | ||
278 | 347 | shutdown_dialog.close.connect (close_shutdown_dialog); | ||
279 | 348 | background.add (shutdown_dialog); | ||
280 | 349 | move_to_monitor (active_monitor); | ||
281 | 350 | } | ||
282 | 351 | |||
283 | 352 | public void close_shutdown_dialog () | ||
284 | 353 | { | ||
285 | 354 | if (shutdown_dialog == null) | ||
286 | 355 | return; | ||
287 | 356 | |||
288 | 357 | shutdown_dialog.destroy (); | ||
289 | 358 | shutdown_dialog = null; | ||
290 | 359 | |||
291 | 360 | login_box.sensitive = true; | ||
292 | 361 | } | ||
293 | 301 | } | 362 | } |
294 | 302 | 363 | ||
295 | === modified file 'src/settings-daemon.vala' | |||
296 | --- src/settings-daemon.vala 2013-01-30 20:31:38 +0000 | |||
297 | +++ src/settings-daemon.vala 2013-11-05 04:29:38 +0000 | |||
298 | @@ -19,6 +19,8 @@ | |||
299 | 19 | 19 | ||
300 | 20 | public class SettingsDaemon : Object | 20 | public class SettingsDaemon : Object |
301 | 21 | { | 21 | { |
302 | 22 | private int logind_inhibit_fd = -1; | ||
303 | 23 | |||
304 | 22 | public async void start () | 24 | public async void start () |
305 | 23 | { | 25 | { |
306 | 24 | configure (); | 26 | configure (); |
307 | @@ -64,6 +66,40 @@ | |||
308 | 64 | require gnome-session and it's Presence DBus interface to be run. */ | 66 | require gnome-session and it's Presence DBus interface to be run. */ |
309 | 65 | GLib.Bus.own_name (GLib.BusType.SESSION, "org.gnome.ScreenSaver", | 67 | GLib.Bus.own_name (GLib.BusType.SESSION, "org.gnome.ScreenSaver", |
310 | 66 | GLib.BusNameOwnerFlags.NONE); | 68 | GLib.BusNameOwnerFlags.NONE); |
311 | 69 | |||
312 | 70 | /* The media-keys plugin inhibits the power key, but we don't want | ||
313 | 71 | all the other keys doing things. So inhibit it ourselves */ | ||
314 | 72 | /* NOTE: We are using the synchronous method here since there is a bug in Vala/GLib in that | ||
315 | 73 | * g_dbus_connection_call_with_unix_fd_list_finish and g_dbus_proxy_call_with_unix_fd_list_finish | ||
316 | 74 | * don't have the GAsyncResult as the second argument. | ||
317 | 75 | * https://bugzilla.gnome.org/show_bug.cgi?id=688907 | ||
318 | 76 | */ | ||
319 | 77 | try | ||
320 | 78 | { | ||
321 | 79 | var b = Bus.get_sync (BusType.SYSTEM); | ||
322 | 80 | UnixFDList fd_list; | ||
323 | 81 | var result = b.call_with_unix_fd_list_sync ("org.freedesktop.login1", | ||
324 | 82 | "/org/freedesktop/login1", | ||
325 | 83 | "org.freedesktop.login1.Manager", | ||
326 | 84 | "Inhibit", | ||
327 | 85 | new Variant ("(ssss)", | ||
328 | 86 | "handle-power-key", | ||
329 | 87 | Environment.get_user_name (), | ||
330 | 88 | "Unity Greeter handling keypresses", | ||
331 | 89 | "block"), | ||
332 | 90 | new VariantType ("(h)"), | ||
333 | 91 | DBusCallFlags.NONE, | ||
334 | 92 | -1, | ||
335 | 93 | null, | ||
336 | 94 | out fd_list); | ||
337 | 95 | int32 index = -1; | ||
338 | 96 | result.get ("(h)", &index); | ||
339 | 97 | logind_inhibit_fd = fd_list.get (index); | ||
340 | 98 | } | ||
341 | 99 | catch (Error e) | ||
342 | 100 | { | ||
343 | 101 | warning ("Failed to inhibit power keys: %s", e.message); | ||
344 | 102 | } | ||
345 | 67 | } | 103 | } |
346 | 68 | 104 | ||
347 | 69 | private void set_plugin_enabled (string schema_name, bool enabled) | 105 | private void set_plugin_enabled (string schema_name, bool enabled) |
348 | 70 | 106 | ||
349 | === added file 'src/shutdown-dialog.vala' | |||
350 | --- src/shutdown-dialog.vala 1970-01-01 00:00:00 +0000 | |||
351 | +++ src/shutdown-dialog.vala 2013-11-05 04:29:38 +0000 | |||
352 | @@ -0,0 +1,381 @@ | |||
353 | 1 | /* -*- Mode: Vala; indent-tabs-mode: nil; tab-width: 4 -*- | ||
354 | 2 | * | ||
355 | 3 | * Copyright (C) 2013 Canonical Ltd | ||
356 | 4 | * | ||
357 | 5 | * This program is free software: you can redistribute it and/or modify | ||
358 | 6 | * it under the terms of the GNU General Public License version 3 as | ||
359 | 7 | * published by the Free Software Foundation. | ||
360 | 8 | * | ||
361 | 9 | * This program is distributed in the hope that it will be useful, | ||
362 | 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
363 | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
364 | 12 | * GNU General Public License for more details. | ||
365 | 13 | * | ||
366 | 14 | * You should have received a copy of the GNU General Public License | ||
367 | 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
368 | 16 | * | ||
369 | 17 | * Authors: Robert Ancell <robert.ancell@canonical.com> | ||
370 | 18 | */ | ||
371 | 19 | |||
372 | 20 | public enum ShutdownDialogType | ||
373 | 21 | { | ||
374 | 22 | LOGOUT, | ||
375 | 23 | SHUTDOWN, | ||
376 | 24 | RESTART | ||
377 | 25 | } | ||
378 | 26 | |||
379 | 27 | public class ShutdownDialog : Gtk.Fixed | ||
380 | 28 | { | ||
381 | 29 | public signal void close (); | ||
382 | 30 | |||
383 | 31 | private Cairo.ImageSurface? corner_surface = null; | ||
384 | 32 | private Cairo.ImageSurface? left_surface = null; | ||
385 | 33 | private Cairo.ImageSurface? top_surface = null; | ||
386 | 34 | private Cairo.Pattern? corner_pattern = null; | ||
387 | 35 | private Cairo.Pattern? left_pattern = null; | ||
388 | 36 | private Cairo.Pattern? top_pattern = null; | ||
389 | 37 | |||
390 | 38 | private const int BORDER_SIZE = 30; | ||
391 | 39 | private const int CLOSE_OFFSET = 3; | ||
392 | 40 | |||
393 | 41 | private Gtk.Box vbox; | ||
394 | 42 | private DialogButton close_button; | ||
395 | 43 | private Gtk.Box button_box; | ||
396 | 44 | |||
397 | 45 | public ShutdownDialog (ShutdownDialogType type) | ||
398 | 46 | { | ||
399 | 47 | vbox = new Gtk.Box (Gtk.Orientation.VERTICAL, 10); | ||
400 | 48 | vbox.visible = true; | ||
401 | 49 | add (vbox); | ||
402 | 50 | |||
403 | 51 | vbox.border_width = 20; | ||
404 | 52 | |||
405 | 53 | var title_label = new Gtk.Label (_("Shutdown")); | ||
406 | 54 | title_label.override_font (Pango.FontDescription.from_string ("Ubuntu Light 15")); | ||
407 | 55 | title_label.override_color (Gtk.StateFlags.NORMAL, { 1.0f, 1.0f, 1.0f, 1.0f }); | ||
408 | 56 | title_label.set_alignment (0.0f, 0.5f); | ||
409 | 57 | vbox.pack_start (title_label, false, false, 0); | ||
410 | 58 | |||
411 | 59 | string text; | ||
412 | 60 | if (type == ShutdownDialogType.SHUTDOWN) | ||
413 | 61 | text = _("Goodbye. Would you like to…"); | ||
414 | 62 | else | ||
415 | 63 | { | ||
416 | 64 | text = _("Are you sure you want to shut down the computer?"); | ||
417 | 65 | title_label.visible = true; | ||
418 | 66 | } | ||
419 | 67 | var label = new Gtk.Label (text); | ||
420 | 68 | label.set_line_wrap (true); | ||
421 | 69 | label.override_font (Pango.FontDescription.from_string ("Ubuntu Light 12")); | ||
422 | 70 | label.override_color (Gtk.StateFlags.NORMAL, { 1.0f, 1.0f, 1.0f, 1.0f }); | ||
423 | 71 | label.set_alignment (0.0f, 0.5f); | ||
424 | 72 | label.visible = true; | ||
425 | 73 | vbox.pack_start (label, false, false, 0); | ||
426 | 74 | |||
427 | 75 | button_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 20); | ||
428 | 76 | button_box.visible = true; | ||
429 | 77 | vbox.pack_start (button_box, false, false, 0); | ||
430 | 78 | |||
431 | 79 | if (type == ShutdownDialogType.SHUTDOWN) | ||
432 | 80 | { | ||
433 | 81 | if (LightDM.get_can_suspend ()) | ||
434 | 82 | { | ||
435 | 83 | var button = add_button (_("Suspend"), Path.build_filename (Config.PKGDATADIR, "suspend.png"), Path.build_filename (Config.PKGDATADIR, "suspend_highlight.png")); | ||
436 | 84 | button.clicked.connect (() => | ||
437 | 85 | { | ||
438 | 86 | try | ||
439 | 87 | { | ||
440 | 88 | LightDM.suspend (); | ||
441 | 89 | close (); | ||
442 | 90 | } | ||
443 | 91 | catch (Error e) | ||
444 | 92 | { | ||
445 | 93 | warning ("Failed to suspend: %s", e.message); | ||
446 | 94 | } | ||
447 | 95 | }); | ||
448 | 96 | } | ||
449 | 97 | |||
450 | 98 | if (LightDM.get_can_hibernate ()) | ||
451 | 99 | { | ||
452 | 100 | var button = add_button (_("Hibernate"), Path.build_filename (Config.PKGDATADIR, "hibernate.png"), Path.build_filename (Config.PKGDATADIR, "hibernate_highlight.png")); | ||
453 | 101 | button.clicked.connect (() => | ||
454 | 102 | { | ||
455 | 103 | try | ||
456 | 104 | { | ||
457 | 105 | LightDM.hibernate (); | ||
458 | 106 | close (); | ||
459 | 107 | } | ||
460 | 108 | catch (Error e) | ||
461 | 109 | { | ||
462 | 110 | warning ("Failed to hibernate: %s", e.message); | ||
463 | 111 | } | ||
464 | 112 | }); | ||
465 | 113 | } | ||
466 | 114 | } | ||
467 | 115 | |||
468 | 116 | if (LightDM.get_can_restart ()) | ||
469 | 117 | { | ||
470 | 118 | var button = add_button (_("Restart"), Path.build_filename (Config.PKGDATADIR, "restart.png"), Path.build_filename (Config.PKGDATADIR, "restart_highlight.png")); | ||
471 | 119 | button.clicked.connect (() => | ||
472 | 120 | { | ||
473 | 121 | try | ||
474 | 122 | { | ||
475 | 123 | LightDM.restart (); | ||
476 | 124 | close (); | ||
477 | 125 | } | ||
478 | 126 | catch (Error e) | ||
479 | 127 | { | ||
480 | 128 | warning ("Failed to restart: %s", e.message); | ||
481 | 129 | } | ||
482 | 130 | }); | ||
483 | 131 | } | ||
484 | 132 | |||
485 | 133 | if (LightDM.get_can_shutdown ()) | ||
486 | 134 | { | ||
487 | 135 | var button = add_button (_("Shutdown"), Path.build_filename (Config.PKGDATADIR, "shutdown.png"), Path.build_filename (Config.PKGDATADIR, "shutdown_highlight.png")); | ||
488 | 136 | button.clicked.connect (() => | ||
489 | 137 | { | ||
490 | 138 | try | ||
491 | 139 | { | ||
492 | 140 | LightDM.shutdown (); | ||
493 | 141 | close (); | ||
494 | 142 | } | ||
495 | 143 | catch (Error e) | ||
496 | 144 | { | ||
497 | 145 | warning ("Failed to shutdown: %s", e.message); | ||
498 | 146 | } | ||
499 | 147 | }); | ||
500 | 148 | } | ||
501 | 149 | |||
502 | 150 | close_button = new DialogButton (Path.build_filename (Config.PKGDATADIR, "dialog_close.png"), Path.build_filename (Config.PKGDATADIR, "dialog_close_highlight.png")); | ||
503 | 151 | close_button.can_focus = false; | ||
504 | 152 | close_button.clicked.connect (() => { close (); }); | ||
505 | 153 | close_button.visible = true; | ||
506 | 154 | add (close_button); | ||
507 | 155 | } | ||
508 | 156 | |||
509 | 157 | public void focus_next () | ||
510 | 158 | { | ||
511 | 159 | (get_toplevel () as Gtk.Window).move_focus (Gtk.DirectionType.TAB_FORWARD); | ||
512 | 160 | } | ||
513 | 161 | |||
514 | 162 | public void focus_prev () | ||
515 | 163 | { | ||
516 | 164 | (get_toplevel () as Gtk.Window).move_focus (Gtk.DirectionType.TAB_BACKWARD); | ||
517 | 165 | } | ||
518 | 166 | |||
519 | 167 | public void cancel () | ||
520 | 168 | { | ||
521 | 169 | var widget = (get_toplevel () as Gtk.Window).get_focus (); | ||
522 | 170 | if (widget is DialogButton) | ||
523 | 171 | (get_toplevel () as Gtk.Window).set_focus (null); | ||
524 | 172 | else | ||
525 | 173 | close (); | ||
526 | 174 | } | ||
527 | 175 | |||
528 | 176 | public override void size_allocate (Gtk.Allocation allocation) | ||
529 | 177 | { | ||
530 | 178 | base.size_allocate (allocation); | ||
531 | 179 | |||
532 | 180 | var content_allocation = Gtk.Allocation (); | ||
533 | 181 | int minimum_width, natural_width, minimum_height, natural_height; | ||
534 | 182 | vbox.get_preferred_width (out minimum_width, out natural_width); | ||
535 | 183 | vbox.get_preferred_height_for_width (minimum_width, out minimum_height, out natural_height); | ||
536 | 184 | content_allocation.x = allocation.x + (allocation.width - minimum_width) / 2; | ||
537 | 185 | content_allocation.y = allocation.y + (allocation.height - minimum_height) / 2; | ||
538 | 186 | content_allocation.width = minimum_width; | ||
539 | 187 | content_allocation.height = minimum_height; | ||
540 | 188 | vbox.size_allocate (content_allocation); | ||
541 | 189 | |||
542 | 190 | var a = Gtk.Allocation (); | ||
543 | 191 | close_button.get_preferred_width (out minimum_width, out natural_width); | ||
544 | 192 | close_button.get_preferred_height (out minimum_height, out natural_height); | ||
545 | 193 | a.x = content_allocation.x - BORDER_SIZE + CLOSE_OFFSET; | ||
546 | 194 | a.y = content_allocation.y - BORDER_SIZE + CLOSE_OFFSET; | ||
547 | 195 | a.width = minimum_width; | ||
548 | 196 | a.height = minimum_height; | ||
549 | 197 | close_button.size_allocate (a); | ||
550 | 198 | } | ||
551 | 199 | |||
552 | 200 | public override bool draw (Cairo.Context c) | ||
553 | 201 | { | ||
554 | 202 | if (corner_surface == null) | ||
555 | 203 | { | ||
556 | 204 | corner_surface = new Cairo.ImageSurface.from_png (Path.build_filename (Config.PKGDATADIR, "switcher_corner.png")); | ||
557 | 205 | left_surface = new Cairo.ImageSurface.from_png (Path.build_filename (Config.PKGDATADIR, "switcher_left.png")); | ||
558 | 206 | top_surface = new Cairo.ImageSurface.from_png (Path.build_filename (Config.PKGDATADIR, "switcher_top.png")); | ||
559 | 207 | corner_pattern = new Cairo.Pattern.for_surface (corner_surface); | ||
560 | 208 | left_pattern = new Cairo.Pattern.for_surface (left_surface); | ||
561 | 209 | left_pattern.set_extend (Cairo.Extend.REPEAT); | ||
562 | 210 | top_pattern = new Cairo.Pattern.for_surface (top_surface); | ||
563 | 211 | top_pattern.set_extend (Cairo.Extend.REPEAT); | ||
564 | 212 | } | ||
565 | 213 | |||
566 | 214 | var width = vbox.get_allocated_width () + 20 * 2 + BORDER_SIZE * 2; | ||
567 | 215 | var height = vbox.get_allocated_height () + 20 * 2 + BORDER_SIZE * 2; | ||
568 | 216 | |||
569 | 217 | /* Darken background */ | ||
570 | 218 | c.set_source_rgba (0, 0, 0, 0.25); | ||
571 | 219 | c.paint (); | ||
572 | 220 | |||
573 | 221 | /* Draw dialog */ | ||
574 | 222 | c.save (); | ||
575 | 223 | c.translate ((get_allocated_width () - width) * 0.5, (get_allocated_height () - height) * 0.5); | ||
576 | 224 | |||
577 | 225 | /* Top left */ | ||
578 | 226 | var m = Cairo.Matrix.identity (); | ||
579 | 227 | corner_pattern.set_matrix (m); | ||
580 | 228 | c.set_source (corner_pattern); | ||
581 | 229 | c.rectangle (0, 0, BORDER_SIZE, BORDER_SIZE); | ||
582 | 230 | c.fill (); | ||
583 | 231 | |||
584 | 232 | /* Top right */ | ||
585 | 233 | m = Cairo.Matrix.identity (); | ||
586 | 234 | m.translate (width, 0); | ||
587 | 235 | m.scale (-1, 1); | ||
588 | 236 | corner_pattern.set_matrix (m); | ||
589 | 237 | c.set_source (corner_pattern); | ||
590 | 238 | c.rectangle (width - BORDER_SIZE, 0, BORDER_SIZE, BORDER_SIZE); | ||
591 | 239 | c.fill (); | ||
592 | 240 | |||
593 | 241 | /* Bottom left */ | ||
594 | 242 | m = Cairo.Matrix.identity (); | ||
595 | 243 | m.translate (0, height); | ||
596 | 244 | m.scale (1, -1); | ||
597 | 245 | corner_pattern.set_matrix (m); | ||
598 | 246 | c.set_source (corner_pattern); | ||
599 | 247 | c.rectangle (0, height - BORDER_SIZE, BORDER_SIZE, BORDER_SIZE); | ||
600 | 248 | c.fill (); | ||
601 | 249 | |||
602 | 250 | /* Bottom right */ | ||
603 | 251 | m = Cairo.Matrix.identity (); | ||
604 | 252 | m.translate (width, height); | ||
605 | 253 | m.scale (-1, -1); | ||
606 | 254 | corner_pattern.set_matrix (m); | ||
607 | 255 | c.set_source (corner_pattern); | ||
608 | 256 | c.rectangle (width - BORDER_SIZE, height - BORDER_SIZE, BORDER_SIZE, BORDER_SIZE); | ||
609 | 257 | c.fill (); | ||
610 | 258 | |||
611 | 259 | /* Left */ | ||
612 | 260 | m = Cairo.Matrix.identity (); | ||
613 | 261 | left_pattern.set_matrix (m); | ||
614 | 262 | c.set_source (left_pattern); | ||
615 | 263 | c.rectangle (0, BORDER_SIZE, BORDER_SIZE, height - BORDER_SIZE * 2); | ||
616 | 264 | c.fill (); | ||
617 | 265 | |||
618 | 266 | /* Right */ | ||
619 | 267 | m = Cairo.Matrix.identity (); | ||
620 | 268 | m.translate (width, 0); | ||
621 | 269 | m.scale (-1, 1); | ||
622 | 270 | left_pattern.set_matrix (m); | ||
623 | 271 | c.set_source (left_pattern); | ||
624 | 272 | c.rectangle (width - BORDER_SIZE, BORDER_SIZE, BORDER_SIZE, height - BORDER_SIZE * 2); | ||
625 | 273 | c.fill (); | ||
626 | 274 | |||
627 | 275 | /* Top */ | ||
628 | 276 | m = Cairo.Matrix.identity (); | ||
629 | 277 | top_pattern.set_matrix (m); | ||
630 | 278 | c.set_source (top_pattern); | ||
631 | 279 | c.rectangle (BORDER_SIZE, 0, width - BORDER_SIZE * 2, BORDER_SIZE); | ||
632 | 280 | c.fill (); | ||
633 | 281 | |||
634 | 282 | /* Right */ | ||
635 | 283 | m = Cairo.Matrix.identity (); | ||
636 | 284 | m.translate (0, height); | ||
637 | 285 | m.scale (1, -1); | ||
638 | 286 | top_pattern.set_matrix (m); | ||
639 | 287 | c.set_source (top_pattern); | ||
640 | 288 | c.rectangle (BORDER_SIZE, height - BORDER_SIZE, width - BORDER_SIZE * 2, BORDER_SIZE); | ||
641 | 289 | c.fill (); | ||
642 | 290 | |||
643 | 291 | /* Background */ | ||
644 | 292 | DashBox.cairo_rounded_rectangle (c, 20, 20, width - 40, height - 40, 5); | ||
645 | 293 | c.set_source_rgba (0, 0, 0, 0.75); | ||
646 | 294 | c.fill (); | ||
647 | 295 | |||
648 | 296 | c.restore (); | ||
649 | 297 | |||
650 | 298 | return base.draw (c); | ||
651 | 299 | } | ||
652 | 300 | |||
653 | 301 | public override bool button_press_event (Gdk.EventButton event) | ||
654 | 302 | { | ||
655 | 303 | /* Close when selecting the background */ | ||
656 | 304 | // FIXME: Broken.. | ||
657 | 305 | close (); | ||
658 | 306 | return true; | ||
659 | 307 | } | ||
660 | 308 | |||
661 | 309 | private DialogButton add_button (string text, string inactive_filename, string active_filename) | ||
662 | 310 | { | ||
663 | 311 | var b = new Gtk.Box (Gtk.Orientation.VERTICAL, 9); | ||
664 | 312 | b.visible = true; | ||
665 | 313 | button_box.pack_start (b, false, false, 0); | ||
666 | 314 | |||
667 | 315 | var label = new Gtk.Label (text); | ||
668 | 316 | label.visible = true; | ||
669 | 317 | label.override_font (Pango.FontDescription.from_string ("Ubuntu Light 12")); | ||
670 | 318 | label.override_color (Gtk.StateFlags.NORMAL, { 1.0f, 1.0f, 1.0f, 0.0f }); | ||
671 | 319 | var button = new DialogButton (inactive_filename, active_filename, label); | ||
672 | 320 | button.visible = true; | ||
673 | 321 | |||
674 | 322 | b.pack_start (button, false, false, 0); | ||
675 | 323 | b.pack_start (label, false, false, 0); | ||
676 | 324 | |||
677 | 325 | return button; | ||
678 | 326 | } | ||
679 | 327 | } | ||
680 | 328 | |||
681 | 329 | private class DialogButton : Gtk.Button | ||
682 | 330 | { | ||
683 | 331 | private string inactive_filename; | ||
684 | 332 | private string active_filename; | ||
685 | 333 | private Gtk.Image i; | ||
686 | 334 | private Gtk.Label? l; | ||
687 | 335 | |||
688 | 336 | public DialogButton (string inactive_filename, string active_filename, Gtk.Label? label = null) | ||
689 | 337 | { | ||
690 | 338 | this.inactive_filename = inactive_filename; | ||
691 | 339 | this.active_filename = active_filename; | ||
692 | 340 | l = label; | ||
693 | 341 | relief = Gtk.ReliefStyle.NONE; | ||
694 | 342 | focus_on_click = false; | ||
695 | 343 | i = new Gtk.Image.from_file (inactive_filename); | ||
696 | 344 | i.visible = true; | ||
697 | 345 | add (i); | ||
698 | 346 | } | ||
699 | 347 | |||
700 | 348 | public override bool enter_notify_event (Gdk.EventCrossing event) | ||
701 | 349 | { | ||
702 | 350 | grab_focus (); | ||
703 | 351 | return base.enter_notify_event (event); | ||
704 | 352 | } | ||
705 | 353 | |||
706 | 354 | public override bool leave_notify_event (Gdk.EventCrossing event) | ||
707 | 355 | { | ||
708 | 356 | (get_toplevel () as Gtk.Window).set_focus (null); | ||
709 | 357 | return base.leave_notify_event (event); | ||
710 | 358 | } | ||
711 | 359 | |||
712 | 360 | public override bool focus_in_event (Gdk.EventFocus event) | ||
713 | 361 | { | ||
714 | 362 | i.set_from_file (active_filename); | ||
715 | 363 | if (l != null) | ||
716 | 364 | l.override_color (Gtk.StateFlags.NORMAL, { 1.0f, 1.0f, 1.0f, 1.0f }); | ||
717 | 365 | return base.focus_in_event (event); | ||
718 | 366 | } | ||
719 | 367 | |||
720 | 368 | public override bool focus_out_event (Gdk.EventFocus event) | ||
721 | 369 | { | ||
722 | 370 | i.set_from_file (inactive_filename); | ||
723 | 371 | if (l != null) | ||
724 | 372 | l.override_color (Gtk.StateFlags.NORMAL, { 1.0f, 1.0f, 1.0f, 0.0f }); | ||
725 | 373 | return base.focus_out_event (event); | ||
726 | 374 | } | ||
727 | 375 | |||
728 | 376 | public override bool draw (Cairo.Context c) | ||
729 | 377 | { | ||
730 | 378 | i.draw (c); | ||
731 | 379 | return true; | ||
732 | 380 | } | ||
733 | 381 | } | ||
734 | 0 | 382 | ||
735 | === modified file 'src/unity-greeter.vala' | |||
736 | --- src/unity-greeter.vala 2013-10-02 17:46:49 +0000 | |||
737 | +++ src/unity-greeter.vala 2013-11-05 04:29:38 +0000 | |||
738 | @@ -46,6 +46,8 @@ | |||
739 | 46 | 46 | ||
740 | 47 | private static Timer log_timer; | 47 | private static Timer log_timer; |
741 | 48 | 48 | ||
742 | 49 | private DialogDBusInterface dbus_object; | ||
743 | 50 | |||
744 | 49 | private UnityGreeter (bool test_mode_) | 51 | private UnityGreeter (bool test_mode_) |
745 | 50 | { | 52 | { |
746 | 51 | singleton = this; | 53 | singleton = this; |
747 | @@ -98,6 +100,38 @@ | |||
748 | 98 | 100 | ||
749 | 99 | main_window = new MainWindow (); | 101 | main_window = new MainWindow (); |
750 | 100 | 102 | ||
751 | 103 | dbus_object = new DialogDBusInterface (); | ||
752 | 104 | dbus_object.open_dialog.connect ((type) => | ||
753 | 105 | { | ||
754 | 106 | ShutdownDialogType dialog_type; | ||
755 | 107 | switch (type) | ||
756 | 108 | { | ||
757 | 109 | default: | ||
758 | 110 | case 1: | ||
759 | 111 | dialog_type = ShutdownDialogType.LOGOUT; | ||
760 | 112 | break; | ||
761 | 113 | case 2: | ||
762 | 114 | dialog_type = ShutdownDialogType.RESTART; | ||
763 | 115 | break; | ||
764 | 116 | } | ||
765 | 117 | main_window.show_shutdown_dialog (dialog_type); | ||
766 | 118 | }); | ||
767 | 119 | dbus_object.close_dialog.connect ((type) => { main_window.close_shutdown_dialog (); }); | ||
768 | 120 | Bus.own_name (BusType.SESSION, "com.canonical.Unity", BusNameOwnerFlags.NONE, | ||
769 | 121 | (c) => | ||
770 | 122 | { | ||
771 | 123 | try | ||
772 | 124 | { | ||
773 | 125 | c.register_object ("/org/gnome/SessionManager/EndSessionDialog", dbus_object); | ||
774 | 126 | } | ||
775 | 127 | catch (Error e) | ||
776 | 128 | { | ||
777 | 129 | warning ("Failed to register /org/gnome/SessionManager/EndSessionDialog: %s", e.message); | ||
778 | 130 | } | ||
779 | 131 | }, | ||
780 | 132 | null, | ||
781 | 133 | () => debug ("Failed to acquire name com.canonical.Unity")); | ||
782 | 134 | |||
783 | 101 | start_fake_wm (); | 135 | start_fake_wm (); |
784 | 102 | Gdk.threads_add_idle (ready_cb); | 136 | Gdk.threads_add_idle (ready_cb); |
785 | 103 | } | 137 | } |
786 | @@ -535,3 +569,20 @@ | |||
787 | 535 | return Posix.EXIT_SUCCESS; | 569 | return Posix.EXIT_SUCCESS; |
788 | 536 | } | 570 | } |
789 | 537 | } | 571 | } |
790 | 572 | |||
791 | 573 | [DBus (name="org.gnome.SessionManager.EndSessionDialog")] | ||
792 | 574 | public class DialogDBusInterface : Object | ||
793 | 575 | { | ||
794 | 576 | public signal void open_dialog (uint32 type); | ||
795 | 577 | public signal void close_dialog (); | ||
796 | 578 | |||
797 | 579 | public void open (uint32 type, uint32 timestamp, uint32 seconds_to_stay_open, ObjectPath[] inhibitor_object_paths) | ||
798 | 580 | { | ||
799 | 581 | open_dialog (type); | ||
800 | 582 | } | ||
801 | 583 | |||
802 | 584 | public void close () | ||
803 | 585 | { | ||
804 | 586 | close_dialog (); | ||
805 | 587 | } | ||
806 | 588 | } | ||
807 | 538 | 589 | ||
808 | === modified file 'tests/Makefile.am' | |||
809 | --- tests/Makefile.am 2013-10-17 22:09:16 +0000 | |||
810 | +++ tests/Makefile.am 2013-11-05 04:29:38 +0000 | |||
811 | @@ -34,7 +34,8 @@ | |||
812 | 34 | ../src/session-list.vala \ | 34 | ../src/session-list.vala \ |
813 | 35 | ../src/main-window.vala \ | 35 | ../src/main-window.vala \ |
814 | 36 | ../src/list-stack.vala \ | 36 | ../src/list-stack.vala \ |
816 | 37 | ../src/settings.vala | 37 | ../src/settings.vala \ |
817 | 38 | ../src/shutdown-dialog.vala | ||
818 | 38 | 39 | ||
819 | 39 | 40 | ||
820 | 40 | unity_greeter_test_CFLAGS = \ | 41 | unity_greeter_test_CFLAGS = \ |
PASSED: Continuous integration, rev:1016 jenkins. qa.ubuntu. com/job/ unity-greeter- ci/13/ jenkins. qa.ubuntu. com/job/ unity-greeter- saucy-amd64- ci/13 jenkins. qa.ubuntu. com/job/ unity-greeter- saucy-armhf- ci/8
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild: 10.97.0. 26:8080/ job/unity- greeter- ci/13/rebuild
http://