2007-09-14 Dan Williams <dcbw@redhat.com>

Implement deferred activation support in the device class.

	* src/nm-device-interface.c
	  src/nm-device-interface.h
		- (nm_device_interface_activate): take more arguments to support
			deferred activation; callers must pass one of (connection) OR
			(service_name, connection_path)
		- (impl_device_activate): connection validation is punted to the device
			to be able to handle deferred activation.  Yes, this means errors
			don't get returned from the Activate() dbus call, and yes, that
			should be fixed somehow later.

	* src/nm-device.c
	  src/nm-device.h
		- (clear_act_request): clear additional deferred activation stuff too
		- (deferred_activation_timeout_cb): new function; clean up when
			deferred activation times out.
		- (deferred_activation_start_cb): new function; when the connection
			finally becomes available, start device activation
		- (nm_device_activate): attach to the right signals of the activation
			request if we need to defer activation until the connection is valid

	* src/NetworkManagerPolicy.c
		- (nm_policy_device_change_check): update for additional arguments
			required for nm_device_interface_activate().  Pass NULL for these
			though because this function already knows exactly which
			NMConnection to use



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2812 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Dan Williams
2007-09-14 19:51:04 +00:00
parent 92ee635c59
commit c766867b65
5 changed files with 208 additions and 63 deletions

View File

@@ -177,16 +177,22 @@ nm_device_interface_get_type (void)
return device_interface_type;
}
/* Pass _either_ connection_path or connection. Passing 'connection' is
* meant for internal use only.
*/
void
nm_device_interface_activate (NMDeviceInterface *device,
NMConnection *connection,
const char *specific_object,
gboolean user_requested)
const char *service_name,
const char *connection_path,
NMConnection *connection,
const char *specific_object,
gboolean user_requested)
{
g_return_if_fail (NM_IS_DEVICE_INTERFACE (device));
g_return_if_fail (connection != NULL);
NM_DEVICE_INTERFACE_GET_INTERFACE (device)->activate (device,
service_name,
connection_path,
connection,
specific_object,
user_requested);
@@ -199,36 +205,13 @@ impl_device_activate (NMDeviceInterface *device,
const char *specific_object,
GError **err)
{
NMManager *manager;
NMConnection *connection;
gboolean success = FALSE;
manager = nm_manager_get ();
if (!strcmp (service_name, NM_DBUS_SERVICE_USER_SETTINGS)) {
connection = nm_manager_get_connection_by_object_path (manager,
NM_CONNECTION_TYPE_USER,
connection_path);
} else if (!strcmp (service_name, NM_DBUS_SERVICE_USER_SETTINGS)) {
connection = nm_manager_get_connection_by_object_path (manager,
NM_CONNECTION_TYPE_SYSTEM,
connection_path);
}
if (connection == NULL) {
g_set_error (err,
NM_DEVICE_INTERFACE_ERROR,
NM_DEVICE_INTERFACE_ERROR_UNKNOWN_CONNECTION,
"%s",
"Connection object or service unknown");
goto out;
}
nm_connection_dump (connection);
nm_device_interface_activate (device, connection, specific_object, TRUE);
success = TRUE;
out:
return success;
nm_device_interface_activate (device,
service_name,
connection_path,
NULL,
specific_object,
TRUE);
return TRUE;
}
void