Merge lp:~mterry/unity-greeter/center-names into lp:unity-greeter

Proposed by Michael Terry
Status: Merged
Approved by: Robert Ancell
Approved revision: 629
Merged at revision: 687
Proposed branch: lp:~mterry/unity-greeter/center-names
Merge into: lp:unity-greeter
Diff against target: 190 lines (+27/-43)
2 files modified
src/greeter-list.vala (+6/-15)
src/prompt-box.vala (+21/-28)
To merge this branch: bzr merge lp:~mterry/unity-greeter/center-names
Reviewer Review Type Date Requested Status
Unity Greeter Development Team Pending
Review via email: mp+139572@code.launchpad.net

Description of the change

This fixes some spacing and alignment issues around the names and option button.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/greeter-list.vala'
2--- src/greeter-list.vala 2012-09-28 19:22:56 +0000
3+++ src/greeter-list.vala 2012-12-12 21:00:36 +0000
4@@ -436,28 +436,19 @@
5
6 protected virtual int get_position_y (double position)
7 {
8- // Most position heights are just the grid height. Except for the one
9- // right above the greeter box and the greeter box itself. The greeter
10- // box is some number of grids to start with. And it is smaller by a
11- // bit, while the one above it is larger by the same amount, in order
12- // to line up names outside the greeter box in the middle of their
13- // grid, while the name inside the box is near the bottom of its first
14- // box.
15- int one_above_height = grid_size + PromptBox.NAME_MARGIN_TOP;
16- int box_height = get_greeter_box_height_grids () * grid_size -
17- PromptBox.NAME_MARGIN_TOP;
18+ // Most position heights are just the grid height. Except for the
19+ // greeter box itself.
20+ int box_height = get_greeter_box_height_grids () * grid_size;
21 double offset;
22
23- if (position < -1)
24- offset = (position + 1) * grid_size - one_above_height;
25- else if (position < 0)
26- offset = position * one_above_height;
27+ if (position < 0)
28+ offset = position * grid_size;
29 else if (position < 1)
30 offset = position * box_height;
31 else
32 offset = (position - 1) * grid_size + box_height;
33
34- return get_greeter_box_y () + (int)Math.round(offset);
35+ return box_y + (int)Math.round(offset);
36 }
37
38 private void move_entry (PromptBox entry, double position)
39
40=== modified file 'src/prompt-box.vala'
41--- src/prompt-box.vala 2012-12-06 21:06:54 +0000
42+++ src/prompt-box.vala 2012-12-12 21:00:36 +0000
43@@ -20,8 +20,6 @@
44
45 public class PromptBox : FadableBox
46 {
47- public static const int NAME_MARGIN_TOP = 12;
48-
49 public signal void respond (string[] response);
50 public signal void login ();
51 public signal void show_options ();
52@@ -45,8 +43,6 @@
53 private Gtk.Fixed fixed;
54 private Gtk.Widget zone; /* when overlapping zone we are fully expanded */
55
56- private int name_grid_height = grid_size - NAME_MARGIN_TOP;
57-
58 /* Expanded widgets */
59 protected Gtk.Grid box_grid;
60 protected Gtk.Grid name_grid;
61@@ -101,13 +97,11 @@
62 fixed.show ();
63 add (fixed);
64
65- /* Create fully expanded version of ourselves */
66- name_grid = create_name_grid ();
67-
68 box_grid = new Gtk.Grid ();
69 box_grid.column_spacing = 4;
70 box_grid.row_spacing = 3;
71- box_grid.margin_bottom = 10;
72+ box_grid.margin_top = GreeterList.BORDER;
73+ box_grid.margin_bottom = 6;
74 box_grid.expand = true;
75
76 /** Grid layout:
77@@ -119,7 +113,7 @@
78
79 active_indicator = new ActiveIndicator ();
80 active_indicator.valign = Gtk.Align.START;
81- active_indicator.margin_top = 11 + NAME_MARGIN_TOP;
82+ active_indicator.margin_top = (grid_size - active_indicator.pixbuf.get_height ()) / 2;
83 active_indicator.show ();
84 box_grid.attach (active_indicator, COL_ACTIVE, last_row, 1, 1);
85
86@@ -129,6 +123,9 @@
87 box_grid.attach (dummy_indicator, COL_SPACER, last_row, 1, 1);
88
89 box_grid.show ();
90+
91+ /* Create fully expanded version of ourselves */
92+ name_grid = create_name_grid ();
93 box_grid.attach (name_grid, COL_CONTENT, last_row, 1, 1);
94
95 /* Now prep small versions of the above normal widgets. These are
96@@ -140,8 +137,8 @@
97 small_box_grid.show ();
98
99 small_active_indicator = new ActiveIndicator ();
100- small_active_indicator.valign = Gtk.Align.CENTER;
101- small_active_indicator.margin_top = NAME_MARGIN_TOP;
102+ small_active_indicator.valign = Gtk.Align.START;
103+ small_active_indicator.margin_top = (grid_size - small_active_indicator.pixbuf.get_height ()) / 2;
104 small_active_indicator.show ();
105 small_box_grid.attach (small_active_indicator, 0, 0, 1, 1);
106
107@@ -177,11 +174,12 @@
108 name_label = new FadingLabel ("");
109 name_label.override_font (Pango.FontDescription.from_string ("Ubuntu 13"));
110 name_label.override_color (Gtk.StateFlags.NORMAL, { 1.0f, 1.0f, 1.0f, 1.0f });
111- name_label.margin_top = NAME_MARGIN_TOP;
112 name_label.valign = Gtk.Align.START;
113 name_label.vexpand = true;
114+ name_label.yalign = 0.5f;
115 name_label.xalign = 0.0f;
116- name_label.set_size_request (-1, name_grid_height);
117+ name_label.margin_left = 2;
118+ name_label.set_size_request (-1, grid_size);
119 name_label.show ();
120 name_grid.attach (name_label, COL_NAME_LABEL, ROW_NAME, 1, 1);
121
122@@ -197,8 +195,7 @@
123
124 var align = new Gtk.Alignment (0.5f, 0.5f, 0.0f, 0.0f);
125 align.valign = Gtk.Align.START;
126- align.margin_top = NAME_MARGIN_TOP;
127- align.set_size_request (-1, name_grid_height);
128+ align.set_size_request (-1, grid_size);
129 align.add (message_image);
130 align.show ();
131 name_grid.attach (align, COL_NAME_MESSAGE, ROW_NAME, 1, 1);
132@@ -207,7 +204,8 @@
133 option_button.hexpand = true;
134 option_button.halign = Gtk.Align.END;
135 option_button.valign = Gtk.Align.START;
136- option_button.margin_top = NAME_MARGIN_TOP;
137+ // Keep as much space on top as on the right
138+ option_button.margin_top = active_indicator.pixbuf.get_width () + box_grid.column_spacing;
139 option_button.focus_on_click = false;
140 option_button.relief = Gtk.ReliefStyle.NONE;
141 option_button.get_accessible ().set_name (_("Session Options"));
142@@ -240,9 +238,10 @@
143 small_name_label = new FadingLabel ("");
144 small_name_label.override_font (Pango.FontDescription.from_string ("Ubuntu 13"));
145 small_name_label.override_color (Gtk.StateFlags.NORMAL, { 1.0f, 1.0f, 1.0f, 1.0f });
146- small_name_label.margin_top = NAME_MARGIN_TOP;
147+ small_name_label.yalign = 0.5f;
148 small_name_label.xalign = 0.0f;
149- small_name_label.set_size_request (-1, name_grid_height);
150+ small_name_label.margin_left = 2;
151+ small_name_label.set_size_request (-1, grid_size);
152 small_name_label.show ();
153 small_name_grid.attach (small_name_label, 1, 0, 1, 1);
154
155@@ -250,8 +249,7 @@
156 small_message_image.pixbuf = message_image.pixbuf;
157
158 var align = new Gtk.Alignment (0.5f, 0.5f, 0.0f, 0.0f);
159- align.margin_top = NAME_MARGIN_TOP;
160- align.set_size_request (-1, name_grid_height);
161+ align.set_size_request (-1, grid_size);
162 align.add (small_message_image);
163 align.show ();
164 small_name_grid.attach (align, 2, 0, 1, 1);
165@@ -639,23 +637,18 @@
166 debug ("Could not load active image: %s", e.message);
167 }
168 notify["active"].connect (() => { queue_draw (); });
169+ xalign = 0.0f;
170 }
171
172 public override void get_preferred_width (out int min, out int nat)
173 {
174- if (pixbuf != null)
175- min = pixbuf.get_width ();
176- else
177- min = 0;
178+ min = 8;
179 nat = min;
180 }
181
182 public override void get_preferred_height (out int min, out int nat)
183 {
184- if (pixbuf != null)
185- min = pixbuf.get_height ();
186- else
187- min = 0;
188+ min = 7;
189 nat = min;
190 }
191

Subscribers

People subscribed via source and target branches