~attente/unity-control-center/fcitx-transition

« back to all changes in this revision

Viewing changes to panels/network/net-device-wired.c

  • Committer: William Hua
  • Date: 2015-02-12 14:09:23 UTC
  • mfrom: (12776.1.31 unity-control-center)
  • Revision ID: william.hua@canonical.com-20150212140923-huh9biwrke6rmwa2
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
157
157
        NMActiveConnection *a;
158
158
        NMConnection *connection;
159
159
        NMClient *client;
 
160
        NMDevice *nm_device;
160
161
 
161
162
        if (device_wired->priv->updating_device)
162
163
                return;
163
164
 
 
165
        client = net_object_get_client (NET_OBJECT (device_wired));
 
166
        nm_device = net_device_get_nm_device (NET_DEVICE (device_wired));
 
167
 
164
168
        active = gtk_switch_get_active (sw);
165
169
        if (active) {
166
 
                client = net_object_get_client (NET_OBJECT (device_wired));
167
170
                connection = net_device_get_find_connection (NET_DEVICE (device_wired));
168
171
                if (connection == NULL)
169
172
                        return;
170
173
                nm_client_activate_connection (client,
171
174
                                               connection,
172
 
                                               net_device_get_nm_device (NET_DEVICE (device_wired)),
 
175
                                               nm_device,
173
176
                                               NULL, NULL, NULL);
174
177
        } else {
175
 
                connection = net_device_get_find_connection (NET_DEVICE (device_wired));
176
 
                if (connection == NULL)
177
 
                        return;
178
 
                path = nm_connection_get_path (connection);
179
 
                client = net_object_get_client (NET_OBJECT (device_wired));
180
 
                acs = nm_client_get_active_connections (client);
181
 
                for (i = 0; i < acs->len; i++) {
182
 
                        a = (NMActiveConnection*)acs->pdata[i];
183
 
                        if (strcmp (nm_active_connection_get_connection (a), path) == 0) {
184
 
                                nm_client_deactivate_connection (client, a);
185
 
                                break;
186
 
                        }
187
 
                }
 
178
                nm_device_disconnect (nm_device, NULL, NULL);
188
179
        }
189
180
}
190
181