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

Proposed by Adam Bieńkowski
Status: Merged
Merged at revision: 172
Proposed branch: lp:~donadigo/switchboard-plug-networking/various-fixes
Merge into: lp:~elementary-pantheon/switchboard-plug-networking/trunk
Diff against target: 149 lines (+23/-22)
4 files modified
src/Plug.vala (+14/-6)
src/Utils.vala (+0/-10)
src/Widgets/DeviceList.vala (+6/-5)
src/common/Widgets/AbstractWifiInterface.vala (+3/-1)
To merge this branch: bzr merge lp:~donadigo/switchboard-plug-networking/various-fixes
Reviewer Review Type Date Requested Status
elementary Pantheon team Pending
Review via email: mp+275423@code.launchpad.net

Commit message

* Fixes bug #1508376.
* Fixes bug #1508378.
* Fixes bug #1508373.
* Fixes bug #1508372.

* Fixes: Wireless item variable wasn't decreased on removing Wifi device.

Description of the change

The branch contains few important fixes for UI:
* Fixes bug #1508376. Removes most of the warnings.
* Fixes bug #1508378. As this method was used only one time, it got completely removed and replaced with native solution.
* Fixes bug #1508373. Make device list insenitive when in ariplane mode.
* Fixes bug #1508372. Inteligently select items on removing devices rather than selecting first item.

* Fixes: Wireless item variable wasn't decreased on removing Wifi device which was resulting in having only one device displaying e.g: "Wireless 3"

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

Removed unused method

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 2015-10-20 20:34:36 +0000
3+++ src/Plug.vala 2015-10-22 17:10:36 +0000
4@@ -21,7 +21,7 @@
5 */
6
7 /* Main client instance */
8-static NM.Client client;
9+NM.Client client;
10
11 /* Proxy settings */
12 Network.ProxySettings proxy_settings;
13@@ -45,7 +45,6 @@
14 private Widgets.Footer footer;
15 private Widgets.InfoScreen no_devices;
16
17-
18 protected override void add_interface (WidgetNMInterface widget_interface) {
19 device_list.add_device_to_list (widget_interface);
20
21@@ -55,9 +54,17 @@
22
23 protected override void remove_interface (WidgetNMInterface widget_interface) {
24 device_list.remove_device_from_list (widget_interface.device);
25+ if (content.get_visible_child () == widget_interface) {
26+ int index = device_list.get_selected_row ().get_index ();
27+ if (index >= 0) {
28+ device_list.get_row_at_index (index).activate ();
29+ } else {
30+ select_first ();
31+ }
32+ }
33+
34 content.remove (widget_interface);
35-
36- select_first ();
37+
38 show_all ();
39 }
40
41@@ -114,11 +121,11 @@
42 /* Main function to connect all the signals */
43 private void connect_signals () {
44 device_list.row_activated.connect ((row) => {
45- if (!Utils.list_contains (content.get_children (), ((Widgets.DeviceItem) row).page)) {
46+ if (content.get_children ().find (((Widgets.DeviceItem)row).page) == null) {
47 content.add (((Widgets.DeviceItem) row).page);
48 }
49
50- content.visible_child = ((Widgets.DeviceItem) row).page;
51+ content.visible_child = ((Widgets.DeviceItem)row).page;
52 });
53
54 device_list.show_no_devices.connect ((show) => {
55@@ -132,6 +139,7 @@
56 });
57
58 client.notify["networking-enabled"].connect (() => {
59+ device_list.sensitive = client.networking_get_enabled ();
60 if (client.networking_get_enabled ()) {
61 device_list.select_first_item ();
62 } else {
63
64=== modified file 'src/Utils.vala'
65--- src/Utils.vala 2015-10-20 20:34:36 +0000
66+++ src/Utils.vala 2015-10-22 17:10:36 +0000
67@@ -15,16 +15,6 @@
68 return details_btn;
69 }
70
71- public bool list_contains (List list, List.G data) {
72- foreach (var unit in list.copy ()) {
73- if (unit == data) {
74- return true;
75- }
76- }
77-
78- return false;
79- }
80-
81 public string state_to_string (NM.DeviceState state) {
82 switch (state) {
83 case NM.DeviceState.ACTIVATED:
84
85=== modified file 'src/Widgets/DeviceList.vala'
86--- src/Widgets/DeviceList.vala 2015-10-20 20:34:36 +0000
87+++ src/Widgets/DeviceList.vala 2015-10-22 17:10:36 +0000
88@@ -25,14 +25,13 @@
89 public signal void show_no_devices (bool show);
90
91 public NM.Client client;
92- public DeviceItem wifi = null;
93- public DeviceItem proxy;
94
95 private List<DeviceItem> items;
96 private DeviceItem item;
97
98 private Gtk.Label settings_l;
99 private Gtk.Label devices_l;
100+ private DeviceItem proxy;
101
102 private int wireless_item = 0;
103
104@@ -56,7 +55,6 @@
105 this.add_proxy ();
106 }
107
108-
109 public void add_device_to_list (WidgetNMInterface iface) {
110 if (iface.device.get_device_type () == NM.DeviceType.WIFI) {
111 string title = _("Wireless");
112@@ -94,10 +92,12 @@
113 }
114
115 public void remove_row_from_list (DeviceItem item) {
116+ if (item.device.get_device_type () == NM.DeviceType.WIFI && wireless_item > 0) {
117+ wireless_item--;
118+ }
119+
120 items.remove (item);
121-
122 this.remove (item);
123- this.select_row (this.get_row_at_index (0));
124 }
125
126 private void add_proxy () {
127@@ -106,6 +106,7 @@
128 proxy.type = Utils.ItemType.PROXY;
129 this.add (proxy);
130 }
131+
132 public void select_first_item () {
133 this.get_row_at_index (0).activate ();
134 }
135
136=== modified file 'src/common/Widgets/AbstractWifiInterface.vala'
137--- src/common/Widgets/AbstractWifiInterface.vala 2015-08-11 22:35:35 +0000
138+++ src/common/Widgets/AbstractWifiInterface.vala 2015-10-22 17:10:36 +0000
139@@ -105,7 +105,9 @@
140 wifi_device.state_changed.connect (update);
141
142 var aps = wifi_device.get_access_points ();
143- aps.foreach(access_point_added_cb);
144+ if (aps != null && aps.length > 0) {
145+ aps.foreach(access_point_added_cb);
146+ }
147
148 update();
149 }

Subscribers

People subscribed via source and target branches

to all changes: