Merge lp:~donadigo/switchboard-plug-networking/infobox-popover into lp:~elementary-pantheon/switchboard-plug-networking/trunk

Proposed by Adam Bieńkowski
Status: Merged
Approved by: Adam Bieńkowski
Approved revision: 149
Merged at revision: 149
Proposed branch: lp:~donadigo/switchboard-plug-networking/infobox-popover
Merge into: lp:~elementary-pantheon/switchboard-plug-networking/trunk
Diff against target: 133 lines (+39/-22)
2 files modified
src/Widgets/Page.vala (+3/-4)
src/Widgets/WifiInterface.vala (+36/-18)
To merge this branch: bzr merge lp:~donadigo/switchboard-plug-networking/infobox-popover
Reviewer Review Type Date Requested Status
Danielle Foré ux Approve
elementary Pantheon team code Pending
Review via email: mp+268974@code.launchpad.net

Commit message

* Move InfoBox to a separate button in connected access point box. (bug #1484685)
* Fixed: Sometimes the plug didn't update buttons sensitivity.

Description of the change

Move InfoBox to a separate button in connected access point box. The branch also fixes some cases where plug didn't update buttons sensitivity. Fixes bug #1484685.

To post a comment you must log in.
Revision history for this message
Danielle Foré (danrabbit) wrote :

Looks good :)

review: Approve (ux)
Revision history for this message
Adam Bieńkowski (donadigo) wrote :

As there is no changes in common folder I am going to merge this.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Widgets/Page.vala'
2--- src/Widgets/Page.vala 2015-08-06 20:29:57 +0000
3+++ src/Widgets/Page.vala 2015-08-24 20:44:29 +0000
4@@ -20,6 +20,7 @@
5 * Authored by: Adam Bieńkowski <donadigos159@gmail.com>
6 * xapantu
7 */
8+
9 namespace Network.Widgets {
10 public class Page : Gtk.Box {
11 public NM.Device device;
12@@ -73,10 +74,8 @@
13 this.device = _device;
14 this.info_box = _info_box;
15 info_box.margin_end = 16;
16- info_box.info_changed.connect (() => {
17- update ();
18- });
19-
20+ info_box.info_changed.connect (update);
21+
22 device_img = new Gtk.Image.from_icon_name (_icon_name, Gtk.IconSize.DIALOG);
23 device_img.pixel_size = 48;
24
25
26=== modified file 'src/Widgets/WifiInterface.vala'
27--- src/Widgets/WifiInterface.vala 2015-08-14 11:30:28 +0000
28+++ src/Widgets/WifiInterface.vala 2015-08-24 20:44:29 +0000
29@@ -29,10 +29,12 @@
30 protected Gtk.Revealer top_revealer;
31 protected Gtk.Button disconnect_btn;
32 protected Gtk.Button settings_btn;
33+ protected Gtk.ToggleButton info_btn;
34+ protected Gtk.Popover popover;
35
36 public WifiInterface (NM.Client nm_client, NM.RemoteSettings settings, NM.Device device_) {
37 info_box = new InfoBox.from_device (device_);
38- info_box.no_show_all = true;
39+ info_box.margin = 12;
40 this.init (device_, info_box);
41
42 var css_provider = new Gtk.CssProvider ();
43@@ -42,6 +44,13 @@
44 warning ("%s\n", e.message);
45 }
46
47+ popover = new Gtk.Popover (info_btn);
48+ popover.position = Gtk.PositionType.BOTTOM;
49+ popover.add (info_box);
50+ popover.hide.connect (() => {
51+ info_btn.active = false;
52+ });
53+
54 connected_frame = new Gtk.Frame (null);
55 connected_frame.get_style_context ().add_provider (css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
56
57@@ -69,20 +78,6 @@
58
59 var button_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 6);
60
61- var advanced_btn = Utils.get_advanced_button_from_device (device);
62- advanced_btn.sensitive = (device.get_state () == NM.DeviceState.ACTIVATED);
63- info_box.info_changed.connect (() => {
64- bool sensitive = (device.get_state () == NM.DeviceState.ACTIVATED);
65- if (disconnect_btn != null) {
66- disconnect_btn.sensitive = sensitive;
67- }
68- if (settings_btn != null) {
69- settings_btn.sensitive = sensitive;
70- }
71-
72- update ();
73- });
74-
75 var hidden_btn = new Gtk.Button.with_label (_("Connect to Hidden Network…"));
76 hidden_btn.clicked.connect (connect_to_hidden);
77
78@@ -90,7 +85,6 @@
79
80 update ();
81
82- bottom_box.add (info_box);
83 bottom_box.add (button_box);
84
85 this.add (top_revealer);
86@@ -100,6 +94,18 @@
87 }
88
89 public override void update () {
90+ bool sensitive = (device.get_state () == NM.DeviceState.ACTIVATED);
91+ if (disconnect_btn != null) {
92+ disconnect_btn.sensitive = sensitive;
93+ }
94+
95+ if (settings_btn != null) {
96+ settings_btn.sensitive = sensitive;
97+ }
98+
99+ if (info_btn != null) {
100+ info_btn.sensitive = sensitive;
101+ }
102
103 var old_active = active_wifi_item;
104
105@@ -147,14 +153,26 @@
106 settings_btn = Utils.get_advanced_button_from_device (wifi_device, _("Settings…"));
107 settings_btn.sensitive = (device.get_state () == NM.DeviceState.ACTIVATED);
108
109+ info_btn = new Gtk.ToggleButton ();
110+ info_btn.margin_top = info_btn.margin_bottom = 6;
111+ info_btn.get_style_context ().add_class ("flat");
112+ info_btn.image = new Gtk.Image.from_icon_name ("dialog-information-symbolic", Gtk.IconSize.SMALL_TOOLBAR);
113+
114+ popover.relative_to = info_btn;
115+
116+ info_btn.toggled.connect (() => {
117+ popover.visible = info_btn.get_active ();
118+ });
119+
120 var button_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 6);
121 button_box.homogeneous = true;
122 button_box.margin = 6;
123- button_box.pack_end (disconnect_btn);
124- button_box.pack_end (settings_btn);
125+ button_box.pack_end (disconnect_btn, false, false, 0);
126+ button_box.pack_end (settings_btn, false, false, 0);
127 button_box.show_all ();
128
129 connected_box.pack_end (button_box, false, false, 0);
130+ connected_box.pack_end (info_btn, false, false, 0);
131 connected_frame.add (connected_box);
132
133 connected_box.show_all ();

Subscribers

People subscribed via source and target branches

to all changes: