Merge lp:~muktupavels/unity-greeter/lp1423542 into lp:unity-greeter

Proposed by Alberts Muktupāvels
Status: Merged
Merged at revision: 1558
Proposed branch: lp:~muktupavels/unity-greeter/lp1423542
Merge into: lp:unity-greeter
Diff against target: 71 lines (+7/-17)
3 files modified
src/flat-button.vala (+0/-7)
src/prompt-box.vala (+2/-10)
src/toggle-box.vala (+5/-0)
To merge this branch: bzr merge lp:~muktupavels/unity-greeter/lp1423542
Reviewer Review Type Date Requested Status
Robert Ancell Approve
Lars Karlitski (community) Approve
Dmitry Shachnev (community) Approve
Review via email: mp+250303@code.launchpad.net

Commit message

Update unity-greeter so it is possible to style buttons in greeter with css. (LP: #1423542)

Description of the change

Update unity-greeter so it is possible to style buttons in greeter with css. (LP: #1423542)

To post a comment you must log in.
Revision history for this message
Alberts Muktupāvels (muktupavels) wrote :
Revision history for this message
Dmitry Shachnev (mitya57) wrote :

LGTM

review: Approve
Revision history for this message
Robert Ancell (robert-ancell) wrote :

Lars - can you confirm this is the right way to do this?

Revision history for this message
Lars Karlitski (larsu) wrote :

It is indeed. Very neat. Thanks Alberts.

review: Approve
Revision history for this message
Robert Ancell (robert-ancell) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/flat-button.vala'
2--- src/flat-button.vala 2014-11-29 12:14:09 +0000
3+++ src/flat-button.vala 2015-02-19 13:15:49 +0000
4@@ -39,13 +39,6 @@
5 }
6 }
7
8- public override bool draw (Cairo.Context c)
9- {
10- // Make sure we don't react to mouse hovers
11- unset_state_flags (Gtk.StateFlags.PRELIGHT);
12- return base.draw (c);
13- }
14-
15 public override bool button_press_event (Gdk.EventButton event)
16 {
17 // Do nothing. The normal handler sets priv->button_down which
18
19=== modified file 'src/prompt-box.vala'
20--- src/prompt-box.vala 2014-12-17 07:12:01 +0000
21+++ src/prompt-box.vala 2015-02-19 13:15:49 +0000
22@@ -201,6 +201,7 @@
23 name_grid.attach (align, COL_NAME_MESSAGE, ROW_NAME, 1, 1);
24
25 option_button = new FlatButton ();
26+ option_button.get_style_context ().add_class ("option-button");
27 option_button.hexpand = true;
28 option_button.halign = Gtk.Align.END;
29 option_button.valign = Gtk.Align.START;
30@@ -212,16 +213,7 @@
31 option_button.clicked.connect (option_button_clicked_cb);
32 option_image = new CachedImage (null);
33 option_image.show ();
34- try
35- {
36- var style = new Gtk.CssProvider ();
37- style.load_from_data ("* {padding: 2px;}", -1);
38- option_button.get_style_context ().add_provider (style, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
39- }
40- catch (Error e)
41- {
42- debug ("Internal error loading session chooser style: %s", e.message);
43- }
44+
45 option_button.add (option_image);
46 name_grid.attach (option_button, COL_NAME_OPTIONS, ROW_NAME, 1, 1);
47
48
49=== modified file 'src/toggle-box.vala'
50--- src/toggle-box.vala 2013-11-12 03:27:13 +0000
51+++ src/toggle-box.vala 2015-02-19 13:15:49 +0000
52@@ -66,15 +66,20 @@
53 private void select (Gtk.Button button)
54 {
55 if (selected_button != null)
56+ {
57 selected_button.relief = Gtk.ReliefStyle.NONE;
58+ selected_button.get_style_context ().remove_class ("selected");
59+ }
60 selected_button = button;
61 selected_button.relief = Gtk.ReliefStyle.NORMAL;
62+ selected_button.get_style_context ().add_class ("selected");
63 selected_key = selected_button.get_data<string> ("toggle-list-key");
64 }
65
66 private Gtk.Button make_button (string key, string name_in, Gdk.Pixbuf? icon)
67 {
68 var item = new FlatButton ();
69+ item.get_style_context ().add_class ("toggle-button");
70 item.relief = Gtk.ReliefStyle.NONE;
71 item.clicked.connect (button_clicked_cb);
72

Subscribers

People subscribed via source and target branches