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

Proposed by Adam Bieńkowski
Status: Merged
Approved by: Danielle Foré
Approved revision: 246
Merged at revision: 241
Proposed branch: lp:~donadigo/switchboard-plug-networking/ipv6
Merge into: lp:~elementary-pantheon/switchboard-plug-networking/trunk
Diff against target: 236 lines (+71/-32)
5 files modified
src/Plug.vala (+4/-4)
src/Utils.vala (+4/-2)
src/Widgets/InfoBox.vala (+60/-23)
src/Widgets/Page.vala (+2/-2)
src/common/Utils.vala (+1/-1)
To merge this branch: bzr merge lp:~donadigo/switchboard-plug-networking/ipv6
Reviewer Review Type Date Requested Status
Danielle Foré ux Needs Fixing
Review via email: mp+296612@code.launchpad.net

Commit message

* Fix bug #1517121: "On IPv6 and v4 (dual stack) networks only IPv4 is displayed".
* Fix not expanding content when resizing.
* Move "unknown" label to one constant.

Description of the change

Fixes bug #1517121: "On IPv6 and v4 (dual stack) networks only IPv4 is displayed".

This branch adds a IPv6 label to connections that has IPv6 address available.
Other: only one unknown constant string accross the labels and fixes for not expanding content when resizing.

To post a comment you must log in.
242. By Adam Bieńkowski

Return on first found address

243. By Adam Bieńkowski

Display multiple IPv6 addressess; use CIDR notation; fixes for not expanding ui

Revision history for this message
Danielle Foré (danrabbit) wrote :

It looks like the label for IPv6 is vertically centered. This is pretty confusing. It should be valign start to make sure it's associated correctly.

review: Needs Fixing (ux)
244. By Adam Bieńkowski

Initialy set IPv6 address to unknown

245. By Adam Bieńkowski

Revert last change

246. By Adam Bieńkowski

Align the IPv6 label vertically

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Plug.vala'
2--- src/Plug.vala 2016-02-12 18:38:11 +0000
3+++ src/Plug.vala 2016-06-08 20:01:19 +0000
4@@ -73,6 +73,7 @@
5 paned.width_request = 250;
6
7 content = new Gtk.Stack ();
8+ content.hexpand = true;
9
10 var sidebar = new Gtk.Box (Gtk.Orientation.VERTICAL, 0);
11 device_list = new Widgets.DeviceList ();
12@@ -99,8 +100,8 @@
13 sidebar.pack_start (scrolled_window, true, true);
14 sidebar.pack_start (footer, false, false);
15
16- paned.pack1 (sidebar, true, false);
17- paned.pack2 (content, true, true);
18+ paned.pack1 (sidebar, true, true);
19+ paned.pack2 (content, true, false);
20 paned.set_position (240);
21
22 connect_signals ();
23@@ -122,12 +123,11 @@
24 });
25
26 device_list.show_no_devices.connect ((show) => {
27+ scrolled_window.sensitive = !show;
28 if (show) {
29 content.set_visible_child (no_devices);
30- scrolled_window.sensitive = false;
31 } else {
32 content.set_visible_child (page);
33- scrolled_window.sensitive = true;
34 }
35 });
36
37
38=== modified file 'src/Utils.vala'
39--- src/Utils.vala 2016-04-24 15:32:14 +0000
40+++ src/Utils.vala 2016-06-08 20:01:19 +0000
41@@ -18,6 +18,8 @@
42 */
43
44 namespace Network {
45+ public const string UNKNOWN_STR = (_("Unknown"));
46+
47 public class Utils {
48 public class Hotspot {
49 public delegate void UpdateSecretCallback ();
50@@ -218,7 +220,7 @@
51 return _("Failed to connect");
52 case NM.DeviceState.UNKNOWN:
53 default:
54- return _("Unknown");
55+ return UNKNOWN_STR;
56 }
57 }
58
59@@ -252,7 +254,7 @@
60 return _("Bridge master");
61 case NM.DeviceType.UNKNOWN:
62 default:
63- return _("Unknown");
64+ return UNKNOWN_STR;
65 }
66 }
67 }
68
69=== modified file 'src/Widgets/InfoBox.vala'
70--- src/Widgets/InfoBox.vala 2016-02-12 15:09:30 +0000
71+++ src/Widgets/InfoBox.vala 2016-06-08 20:01:19 +0000
72@@ -24,20 +24,24 @@
73 private NM.Device device;
74 private DeviceItem? owner;
75
76- private string ipaddress_l = (_("IP Address:") + SUFFIX);
77+ private string ip4address_l = (_("IP Address:") + SUFFIX);
78+ private string ip6address_l = (_("IPv6 Address:") + SUFFIX);
79 private string mask_l = (_("Subnet mask:") + SUFFIX);
80 private string router_l = (_("Router:") + SUFFIX);
81 private string broadcast_l = (_("Broadcast:") + SUFFIX);
82 private string sent_l = (_("Sent:") + SUFFIX);
83 private string received_l = (_("Received:") + SUFFIX);
84
85- private Gtk.Label ipaddress;
86+ private Gtk.Label ip4address;
87+ private Gtk.Label ip6address;
88 private Gtk.Label mask;
89 private Gtk.Label router;
90 private Gtk.Label broadcast;
91 private Gtk.Label sent;
92 private Gtk.Label received;
93
94+ private Gtk.Label ip6address_head;
95+
96 public InfoBox.from_device (NM.Device? _device) {
97 owner = null;
98 device = _device;
99@@ -84,8 +88,12 @@
100 activity_info.attach_next_to (received_head, sent_head, Gtk.PositionType.BOTTOM);
101 activity_info.attach_next_to (received, received_head, Gtk.PositionType.RIGHT);
102
103- ipaddress = new Gtk.Label ("");
104- ipaddress.selectable = true;
105+ ip4address = new Gtk.Label ("");
106+ ip4address.selectable = true;
107+
108+ ip6address = new Gtk.Label ("");
109+ ip6address.selectable = true;
110+ ip6address.no_show_all = true;
111
112 mask = new Gtk.Label ("");
113 mask.selectable = true;
114@@ -96,22 +104,30 @@
115 broadcast = new Gtk.Label ("");
116 broadcast.selectable = true;
117
118- var ipaddress_head = new Gtk.Label (ipaddress_l);
119+ var ip4address_head = new Gtk.Label (ip4address_l);
120+
121+ ip6address_head = new Gtk.Label (ip6address_l);
122+ ip6address_head.no_show_all = true;
123+ ip6address_head.valign = Gtk.Align.START;
124+
125 var mask_head = new Gtk.Label (mask_l);
126 var broadcast_head = new Gtk.Label (broadcast_l);
127 var router_head = new Gtk.Label (router_l);
128
129- fix_halign (Gtk.Align.START, ipaddress, mask, broadcast,
130- router, ipaddress_head, mask_head,
131+ fix_halign (Gtk.Align.START, ip4address, ip6address, mask, broadcast,
132+ router, ip4address_head, ip6address_head, mask_head,
133 broadcast_head, router_head);
134
135- fix_first_col (ipaddress_head, mask_head,
136+ fix_first_col (ip4address_head, ip6address_head, mask_head,
137 broadcast_head, router_head);
138
139- info_grid.attach (ipaddress_head, 0, 0);
140- info_grid.attach_next_to (ipaddress, ipaddress_head, Gtk.PositionType.RIGHT);
141-
142- info_grid.attach_next_to (mask_head, ipaddress_head, Gtk.PositionType.BOTTOM);
143+ info_grid.attach (ip4address_head, 0, 0);
144+ info_grid.attach_next_to (ip4address, ip4address_head, Gtk.PositionType.RIGHT);
145+
146+ info_grid.attach_next_to (ip6address_head, ip4address_head, Gtk.PositionType.BOTTOM);
147+ info_grid.attach_next_to (ip6address, ip6address_head, Gtk.PositionType.RIGHT);
148+
149+ info_grid.attach_next_to (mask_head, ip6address_head, Gtk.PositionType.BOTTOM);
150 info_grid.attach_next_to (mask, mask_head, Gtk.PositionType.RIGHT);
151
152 info_grid.attach_next_to (router_head, mask_head, Gtk.PositionType.BOTTOM);
153@@ -133,24 +149,45 @@
154 }
155
156 public void update_activity (string sent_bytes, string received_bytes) {
157- sent.label = sent_bytes ?? _("Unknown");
158- received.label = received_bytes ?? _("Unknown");
159+ sent.label = sent_bytes ?? UNKNOWN_STR;
160+ received.label = received_bytes ?? UNKNOWN_STR;
161 }
162
163 public void update_status () {
164 // Refresh DHCP4 info
165 var dhcp4 = device.get_dhcp4_config ();
166 if (dhcp4 != null) {
167- ipaddress.label = (dhcp4.get_one_option ("ip_address") ?? _("Unknown"));
168- mask.label = (dhcp4.get_one_option ("subnet_mask") ?? _("Unknown"));
169- router.label = (dhcp4.get_one_option ("routers") ?? _("Unknown"));
170- broadcast.label = (dhcp4.get_one_option ("broadcast_address") ?? _("Unknown"));
171+ ip4address.label = (dhcp4.get_one_option ("ip_address") ?? UNKNOWN_STR);
172+ mask.label = (dhcp4.get_one_option ("subnet_mask") ?? UNKNOWN_STR);
173+ router.label = (dhcp4.get_one_option ("routers") ?? UNKNOWN_STR);
174+ broadcast.label = (dhcp4.get_one_option ("broadcast_address") ?? UNKNOWN_STR);
175 } else {
176- ipaddress.label = _("Unknown");
177- mask.label = _("Unknown");
178- router.label = _("Unknown");
179- broadcast.label = _("Unknown");
180- }
181+ ip4address.label = UNKNOWN_STR;
182+ mask.label = UNKNOWN_STR;
183+ router.label = UNKNOWN_STR;
184+ broadcast.label = UNKNOWN_STR;
185+ }
186+
187+ var ip6 = device.get_ip6_config ();
188+ ip6address.visible = ip6address_head.visible = (ip6 != null);
189+ ip6address.label = "";
190+ if (ip6 != null) {
191+ int i = 1;
192+ SList<NM.IP6Address> addresses = ip6.get_addresses ().copy ();
193+ addresses.@foreach ((addr) => {
194+ addr.@ref ();
195+ var inet = new InetAddress.from_bytes (addr.get_address (), SocketFamily.IPV6);
196+ string inet_str = inet.to_string () + "/" + addr.get_prefix ().to_string ();
197+ ip6address.visible = ip6address_head.visible = (inet_str.strip () != "");
198+ ip6address.label += inet_str;
199+ if (i < addresses.length ()) {
200+ ip6address.label += "\n";
201+ }
202+
203+ i++;
204+ });
205+ }
206+
207
208 if (owner != null) {
209 update_sidebar (owner);
210
211=== modified file 'src/Widgets/Page.vala'
212--- src/Widgets/Page.vala 2016-05-09 18:10:58 +0000
213+++ src/Widgets/Page.vala 2016-06-08 20:01:19 +0000
214@@ -121,8 +121,8 @@
215 }
216
217 public void get_activity_information (string iface, out string sent_bytes, out string received_bytes) {
218- sent_bytes = _("Unknown");
219- received_bytes = _("Unknown");
220+ sent_bytes = UNKNOWN_STR;
221+ received_bytes = UNKNOWN_STR;
222
223 string tx_bytes_path = "/sys/class/net/" + iface + "/statistics/tx_bytes";
224 string rx_bytes_path = "/sys/class/net/" + iface + "/statistics/rx_bytes";
225
226=== modified file 'src/common/Utils.vala'
227--- src/common/Utils.vala 2015-12-20 20:39:29 +0000
228+++ src/common/Utils.vala 2016-06-08 20:01:19 +0000
229@@ -51,7 +51,7 @@
230 case Network.State.WIRED_UNPLUGGED:
231 return _("Cable unplugged");
232 }
233- return _("Unknown");
234+ return UNKNOWN_STR;
235 }
236 }
237

Subscribers

People subscribed via source and target branches

to all changes: