Merge lp:~robert-ancell/unity-greeter/login-box-height into lp:unity-greeter/0.2

Proposed by Robert Ancell
Status: Merged
Approved by: Michael Terry
Approved revision: 402
Merged at revision: 402
Proposed branch: lp:~robert-ancell/unity-greeter/login-box-height
Merge into: lp:unity-greeter/0.2
Diff against target: 43 lines (+17/-2)
1 file modified
src/user-list.vala (+17/-2)
To merge this branch: bzr merge lp:~robert-ancell/unity-greeter/login-box-height
Reviewer Review Type Date Requested Status
Michael Terry (community) Approve
Review via email: mp+146023@code.launchpad.net

Description of the change

Resize the login box vertically when long messages need to be shown like supported in 12.10 onwards. Can be tested with "unity-greeter --test-mode" with users "Long Info Prompt" and "Multi Info Prompt".

To post a comment you must log in.
Revision history for this message
Robert Ancell (robert-ancell) wrote :

I've pushed a package into the Desktop PPA [1] for testing - unity-greeter 0.2.9-0ubuntu2. You probably want to manually download the .deb so you don't accidentally bring in other packages.

[1] https://launchpad.net/~ubuntu-desktop/+archive/ppa/+packages

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

Looks fine to me. I played with it and it works as expected.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/user-list.vala'
2--- src/user-list.vala 2012-11-20 21:54:15 +0000
3+++ src/user-list.vala 2013-02-01 02:14:23 +0000
4@@ -327,6 +327,21 @@
5
6 private void redraw_login_box ()
7 {
8+ /* Resize to fit messages */
9+ var vertical_offset = 0.0;
10+ foreach (var m in messages)
11+ {
12+ int w, h;
13+ m.layout.get_pixel_size (out w, out h);
14+ vertical_offset += h;
15+ }
16+ var new_box_height = 3 + (int) vertical_offset / grid_size;
17+ if (new_box_height != box_height)
18+ {
19+ box_height = new_box_height;
20+ allocate_login_box ();
21+ }
22+
23 Gtk.Allocation allocation;
24 login_box.get_allocation (out allocation);
25 queue_draw_area (allocation.x, allocation.y, allocation.width, allocation.height);
26@@ -831,7 +846,7 @@
27
28 /* Put prompt entry and login button inside login box */
29 child_allocation.x = allocation.x + box_x + grid_size / 2;
30- child_allocation.y = allocation.y + box_y + grid_size * 2 - grid_size / 4;
31+ child_allocation.y = allocation.y + box_y + grid_size * (box_height - 1) - grid_size / 4;
32 child_allocation.width = grid_size * (box_width - 1);
33 prompt_entry.get_preferred_height (null, out child_allocation.height);
34 prompt_entry.size_allocate (child_allocation);
35@@ -1090,7 +1105,7 @@
36 int w, h;
37 m.layout.get_pixel_size (out w, out h);
38
39- c.move_to (grid_size / 2, grid_size * 1.5 - vertical_offset + border);
40+ c.move_to (grid_size / 2, grid_size * (box_height - 1.5) - vertical_offset + border);
41 vertical_offset -= h;
42
43 var r = 1.0;

Subscribers

People subscribed via source and target branches