2007-09-26 Tambet Ingo <tambet@gmail.com>
* src/nm-manager.c (manager_device_state_changed): Listen to * device' NEED_AUTH state and try to get the secrets. * src/NetworkManagerPolicy.c (nm_policy_auto_get_best_device): * Get the list of connections from NMManager and let the device to choose the best from the list. Since the connection list is sorted by system ones first and user ones later, the devices still prefer system connections like they did before. (deactivate_old_device): Implement. When a device starts activation, we have a policy (for now at least) to deactivate any other device that might be either active or still activating. * src/vpn-manager/nm-vpn-manager.c: Add NMManager back to the * private structure. It's set on construction, there will be no other way to access it. * src/nm-device-802-11-wireless.c: Don't touch NMManager, * NMManager can listen to device events and drive the device, not the other way around. * src/nm-device-802-3-ethernet.c: Ditto. * src/nm-device.c (nm_device_get_best_connection): The * connections list is now sent along, pass it on to virtual functions. * src/nm-device-interface.c (nm_device_interface_get_iface): * Implement. It's static for now, but should really be public instead of nm_device_get_iface() since iface is a property of the DeviceInterface, not Device. (impl_device_activate): Don't touch NMManager! git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2889 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
|
||||
|
||||
#include "nm-device-interface.h"
|
||||
#include "nm-ip4-config.h"
|
||||
#include "nm-manager.h"
|
||||
#include "nm-utils.h"
|
||||
|
||||
static gboolean impl_device_activate (NMDeviceInterface *device,
|
||||
@@ -207,6 +207,19 @@ nm_device_interface_activate (NMDeviceInterface *device,
|
||||
user_requested);
|
||||
}
|
||||
|
||||
/* FIXME: This should be public and nm_device_get_iface() should be removed. */
|
||||
static const char *
|
||||
nm_device_interface_get_iface (NMDeviceInterface *device)
|
||||
{
|
||||
const char *iface = NULL;
|
||||
|
||||
g_return_val_if_fail (NM_IS_DEVICE_INTERFACE (device), NULL);
|
||||
|
||||
g_object_get (device, NM_DEVICE_INTERFACE_IFACE, &iface, NULL);
|
||||
|
||||
return iface;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
impl_device_activate (NMDeviceInterface *device,
|
||||
const char *service_name,
|
||||
@@ -214,44 +227,7 @@ impl_device_activate (NMDeviceInterface *device,
|
||||
const char *specific_object,
|
||||
GError **err)
|
||||
{
|
||||
NMManager *manager = nm_manager_get ();
|
||||
NMDevice *old_dev = NULL;
|
||||
GSList *iter;
|
||||
|
||||
// FIXME: remove when multiple active device support has landed
|
||||
switch (nm_manager_get_state (manager)) {
|
||||
case NM_STATE_CONNECTED:
|
||||
old_dev = nm_manager_get_active_device (manager);
|
||||
break;
|
||||
case NM_STATE_CONNECTING:
|
||||
for (iter = nm_manager_get_devices (manager); iter; iter = iter->next) {
|
||||
if (nm_device_is_activating (NM_DEVICE (iter->data))) {
|
||||
old_dev = NM_DEVICE (iter->data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case NM_STATE_DISCONNECTED:
|
||||
/* Check for devices that have deferred activation requests */
|
||||
for (iter = nm_manager_get_devices (manager); iter; iter = iter->next) {
|
||||
NMActRequest *req = nm_device_get_act_request (NM_DEVICE (iter->data));
|
||||
|
||||
if (req && nm_act_request_is_deferred (req)) {
|
||||
old_dev = NM_DEVICE (iter->data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
g_object_unref (manager);
|
||||
|
||||
nm_info ("User request for activation of %s.", nm_device_get_iface (NM_DEVICE (device)));
|
||||
|
||||
if (old_dev)
|
||||
nm_device_interface_deactivate (NM_DEVICE_INTERFACE (old_dev));
|
||||
|
||||
nm_info ("User request for activation of %s.", nm_device_interface_get_iface (device));
|
||||
nm_device_interface_activate (device,
|
||||
service_name,
|
||||
connection_path,
|
||||
|
Reference in New Issue
Block a user