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
=== modified file 'src/Widgets/Page.vala'
--- src/Widgets/Page.vala 2015-08-06 20:29:57 +0000
+++ src/Widgets/Page.vala 2015-08-24 20:44:29 +0000
@@ -20,6 +20,7 @@
20 * Authored by: Adam Bieńkowski <donadigos159@gmail.com>20 * Authored by: Adam Bieńkowski <donadigos159@gmail.com>
21 * xapantu21 * xapantu
22 */22 */
23
23namespace Network.Widgets {24namespace Network.Widgets {
24 public class Page : Gtk.Box {25 public class Page : Gtk.Box {
25 public NM.Device device;26 public NM.Device device;
@@ -73,10 +74,8 @@
73 this.device = _device;74 this.device = _device;
74 this.info_box = _info_box;75 this.info_box = _info_box;
75 info_box.margin_end = 16;76 info_box.margin_end = 16;
76 info_box.info_changed.connect (() => {77 info_box.info_changed.connect (update);
77 update ();78
78 });
79
80 device_img = new Gtk.Image.from_icon_name (_icon_name, Gtk.IconSize.DIALOG);79 device_img = new Gtk.Image.from_icon_name (_icon_name, Gtk.IconSize.DIALOG);
81 device_img.pixel_size = 48;80 device_img.pixel_size = 48;
8281
8382
=== modified file 'src/Widgets/WifiInterface.vala'
--- src/Widgets/WifiInterface.vala 2015-08-14 11:30:28 +0000
+++ src/Widgets/WifiInterface.vala 2015-08-24 20:44:29 +0000
@@ -29,10 +29,12 @@
29 protected Gtk.Revealer top_revealer;29 protected Gtk.Revealer top_revealer;
30 protected Gtk.Button disconnect_btn;30 protected Gtk.Button disconnect_btn;
31 protected Gtk.Button settings_btn;31 protected Gtk.Button settings_btn;
32 protected Gtk.ToggleButton info_btn;
33 protected Gtk.Popover popover;
3234
33 public WifiInterface (NM.Client nm_client, NM.RemoteSettings settings, NM.Device device_) {35 public WifiInterface (NM.Client nm_client, NM.RemoteSettings settings, NM.Device device_) {
34 info_box = new InfoBox.from_device (device_);36 info_box = new InfoBox.from_device (device_);
35 info_box.no_show_all = true;37 info_box.margin = 12;
36 this.init (device_, info_box);38 this.init (device_, info_box);
37 39
38 var css_provider = new Gtk.CssProvider ();40 var css_provider = new Gtk.CssProvider ();
@@ -42,6 +44,13 @@
42 warning ("%s\n", e.message);44 warning ("%s\n", e.message);
43 }45 }
4446
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
45 connected_frame = new Gtk.Frame (null);54 connected_frame = new Gtk.Frame (null);
46 connected_frame.get_style_context ().add_provider (css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);55 connected_frame.get_style_context ().add_provider (css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION);
4756
@@ -69,20 +78,6 @@
6978
70 var button_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 6);79 var button_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 6);
7180
72 var advanced_btn = Utils.get_advanced_button_from_device (device);
73 advanced_btn.sensitive = (device.get_state () == NM.DeviceState.ACTIVATED);
74 info_box.info_changed.connect (() => {
75 bool sensitive = (device.get_state () == NM.DeviceState.ACTIVATED);
76 if (disconnect_btn != null) {
77 disconnect_btn.sensitive = sensitive;
78 }
79 if (settings_btn != null) {
80 settings_btn.sensitive = sensitive;
81 }
82
83 update ();
84 });
85
86 var hidden_btn = new Gtk.Button.with_label (_("Connect to Hidden Network…"));81 var hidden_btn = new Gtk.Button.with_label (_("Connect to Hidden Network…"));
87 hidden_btn.clicked.connect (connect_to_hidden);82 hidden_btn.clicked.connect (connect_to_hidden);
8883
@@ -90,7 +85,6 @@
9085
91 update ();86 update ();
9287
93 bottom_box.add (info_box);
94 bottom_box.add (button_box);88 bottom_box.add (button_box);
9589
96 this.add (top_revealer);90 this.add (top_revealer);
@@ -100,6 +94,18 @@
100 }94 }
10195
102 public override void update () {96 public override void update () {
97 bool sensitive = (device.get_state () == NM.DeviceState.ACTIVATED);
98 if (disconnect_btn != null) {
99 disconnect_btn.sensitive = sensitive;
100 }
101
102 if (settings_btn != null) {
103 settings_btn.sensitive = sensitive;
104 }
105
106 if (info_btn != null) {
107 info_btn.sensitive = sensitive;
108 }
103109
104 var old_active = active_wifi_item;110 var old_active = active_wifi_item;
105111
@@ -147,14 +153,26 @@
147 settings_btn = Utils.get_advanced_button_from_device (wifi_device, _("Settings…"));153 settings_btn = Utils.get_advanced_button_from_device (wifi_device, _("Settings…"));
148 settings_btn.sensitive = (device.get_state () == NM.DeviceState.ACTIVATED);154 settings_btn.sensitive = (device.get_state () == NM.DeviceState.ACTIVATED);
149155
156 info_btn = new Gtk.ToggleButton ();
157 info_btn.margin_top = info_btn.margin_bottom = 6;
158 info_btn.get_style_context ().add_class ("flat");
159 info_btn.image = new Gtk.Image.from_icon_name ("dialog-information-symbolic", Gtk.IconSize.SMALL_TOOLBAR);
160
161 popover.relative_to = info_btn;
162
163 info_btn.toggled.connect (() => {
164 popover.visible = info_btn.get_active ();
165 });
166
150 var button_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 6);167 var button_box = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 6);
151 button_box.homogeneous = true;168 button_box.homogeneous = true;
152 button_box.margin = 6;169 button_box.margin = 6;
153 button_box.pack_end (disconnect_btn);170 button_box.pack_end (disconnect_btn, false, false, 0);
154 button_box.pack_end (settings_btn);171 button_box.pack_end (settings_btn, false, false, 0);
155 button_box.show_all ();172 button_box.show_all ();
156173
157 connected_box.pack_end (button_box, false, false, 0);174 connected_box.pack_end (button_box, false, false, 0);
175 connected_box.pack_end (info_btn, false, false, 0);
158 connected_frame.add (connected_box);176 connected_frame.add (connected_box);
159177
160 connected_box.show_all ();178 connected_box.show_all ();

Subscribers

People subscribed via source and target branches

to all changes: