Merge lp:~cyphermox/unity-control-center/lp1354987 into lp:unity-control-center

Proposed by Mathieu Trudel-Lapierre on 2014-09-04
Status: Merged
Approved by: Sebastien Bacher on 2014-09-22
Approved revision: 12787
Merged at revision: 12788
Proposed branch: lp:~cyphermox/unity-control-center/lp1354987
Merge into: lp:unity-control-center
Diff against target: 43 lines (+6/-15)
1 file modified
panels/network/net-device-wired.c (+6/-15)
To merge this branch: bzr merge lp:~cyphermox/unity-control-center/lp1354987
Reviewer Review Type Date Requested Status
Sebastien Bacher 2014-09-04 Approve on 2014-09-22
PS Jenkins bot (community) continuous-integration Approve on 2014-09-08
Review via email: mp+233416@code.launchpad.net

Commit message

Deactivate the wired device when wired is switched off.

Description of the change

Deactivate the wired device when wired is switched off.

To post a comment you must log in.
Sebastien Bacher (seb128) wrote :

Thanks, but that fails to build. Could you also give details on the change, does it come from upstream g-c-c?

review: Needs Fixing
Mathieu Trudel-Lapierre (cyphermox) wrote :

Seems like the same fix is in gnome-control-center upstream, indeed; but it's just the obvious and right way to deactivate the device if you don't want it to connect automatically.

12787. By Mathieu Trudel-Lapierre on 2014-09-08

Fix typo in nm_device_disconnect() call.

Sebastien Bacher (seb128) wrote :

is it upstream?
reading https://git.gnome.org/browse/gnome-control-center/tree/panels/network/net-device-simple.c it seems to still have the code you are changing there
would it make sense to send the fix to GNOME as well in this case?

Mathieu Trudel-Lapierre (cyphermox) wrote :

On Mon, Sep 8, 2014 at 3:00 PM, Sebastien Bacher <email address hidden> wrote:
> is it upstream?

Yes, but only for the ethernet device:
https://git.gnome.org/browse/gnome-control-center/tree/panels/network/net-device-ethernet.c

> reading https://git.gnome.org/browse/gnome-control-center/tree/panels/network/net-device-simple.c it seems to still have the code you are changing there
> would it make sense to send the fix to GNOME as well in this case?

Agreed, it should also be changed in net-device-simple; though nothing
seems to use that right now. I'll push the changes upstream.

/ Matt

Sebastien Bacher (seb128) wrote :

thanks, can you update the bug with the upstream ticket reference when you do that?

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'panels/network/net-device-wired.c'
2--- panels/network/net-device-wired.c 2012-08-22 14:32:59 +0000
3+++ panels/network/net-device-wired.c 2014-09-08 18:18:39 +0000
4@@ -157,34 +157,25 @@
5 NMActiveConnection *a;
6 NMConnection *connection;
7 NMClient *client;
8+ NMDevice *nm_device;
9
10 if (device_wired->priv->updating_device)
11 return;
12
13+ client = net_object_get_client (NET_OBJECT (device_wired));
14+ nm_device = net_device_get_nm_device (NET_DEVICE (device_wired));
15+
16 active = gtk_switch_get_active (sw);
17 if (active) {
18- client = net_object_get_client (NET_OBJECT (device_wired));
19 connection = net_device_get_find_connection (NET_DEVICE (device_wired));
20 if (connection == NULL)
21 return;
22 nm_client_activate_connection (client,
23 connection,
24- net_device_get_nm_device (NET_DEVICE (device_wired)),
25+ nm_device,
26 NULL, NULL, NULL);
27 } else {
28- connection = net_device_get_find_connection (NET_DEVICE (device_wired));
29- if (connection == NULL)
30- return;
31- path = nm_connection_get_path (connection);
32- client = net_object_get_client (NET_OBJECT (device_wired));
33- acs = nm_client_get_active_connections (client);
34- for (i = 0; i < acs->len; i++) {
35- a = (NMActiveConnection*)acs->pdata[i];
36- if (strcmp (nm_active_connection_get_connection (a), path) == 0) {
37- nm_client_deactivate_connection (client, a);
38- break;
39- }
40- }
41+ nm_device_disconnect (nm_device, NULL, NULL);
42 }
43 }
44

Subscribers

People subscribed via source and target branches