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

* libnm-util/nm-setting.c
	  libnm-util/nm-setting.h
		- (nm_setting_update_secrets): new function; add a virtual function that
			subclasses can implement to update their secrets
		- (setting_wireless_security_update_secrets): implement that function
			for the 802-11-wireless-security subclass

	* libnm-util/nm-connection.c
	  libnm-util/nm-connection.h
		- (nm_connection_update_secrets): update secrets for a Setting and
			emit a signal on success

	* src/nm-manager.c
	  src/nm-manager.h
	  src/nm-marshal.list
		- (connection_get_settings_cb): enable system settings bits
		- (nm_manager_get_connection_secrets, get_secrets_cb): add function
			to request secrets from the settings dbus service and to
			push those secrets to the NMConnection itself

	* src/nm-activation-request.c
	  src/nm-activation-request.h
		- Attach to the 'secrets-updated' signal of the NMConnection that's
			currently being activated, and proxy that signal to other listeners.
			Goes through the activation request because the activation request
			is the thing that manages the lifetime of the NMConnection that's
			being activated.

	* src/nm-device-802-11-wireless.c
		- (real_connection_secrets_updated): implement the connection secrets
			updated notification and restart activation when secrets are
			received
		- (real_act_stage2_config): request secrets from the settings dbus
			service if secrets are needed

	* src/nm-device.c
	  src/nm-device.h
		- (clear_act_request, nm_device_activation_cancel,
		   nm_device_deactivate_quickly, nm_device_dispose): consolidate places
			where the activation request is cleared
		- (nm_device_activate, connection_secrets_updated_cb): attach to the
			updated secrets signal of activation request and add a function
			that subclasses can override to handle it easily



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2782 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Dan Williams
2007-09-11 18:02:27 +00:00
parent d52a52421a
commit 937d1add73
13 changed files with 406 additions and 61 deletions

View File

@@ -21,15 +21,31 @@
#include "nm-activation-request.h"
#include "nm-marshal.h"
G_DEFINE_TYPE (NMActRequest, nm_act_request, G_TYPE_OBJECT)
#define NM_ACT_REQUEST_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_ACT_REQUEST, NMActRequestPrivate))
enum {
CONNECTION_SECRETS_UPDATED,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL] = { 0 };
static void connection_secrets_updated_cb (NMConnection *connection,
const char *setting_name,
NMActRequest *self);
typedef struct {
NMConnection *connection;
char *specific_object;
gboolean user_requested;
gulong secrets_updated_id;
} NMActRequestPrivate;
static void
@@ -42,6 +58,8 @@ finalize (GObject *object)
{
NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (object);
g_signal_handler_disconnect (priv->connection,
priv->secrets_updated_id);
g_object_unref (priv->connection);
g_free (priv->specific_object);
@@ -57,6 +75,17 @@ nm_act_request_class_init (NMActRequestClass *req_class)
g_type_class_add_private (req_class, sizeof (NMActRequestPrivate));
object_class->finalize = finalize;
/* Signals */
signals[CONNECTION_SECRETS_UPDATED] =
g_signal_new ("connection-secrets-updated",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (NMConnectionClass, secrets_updated),
NULL, NULL,
nm_marshal_VOID__OBJECT_STRING,
G_TYPE_NONE, 2,
G_TYPE_OBJECT, G_TYPE_STRING);
}
NMActRequest *
@@ -66,6 +95,7 @@ nm_act_request_new (NMConnection *connection,
{
GObject *obj;
NMActRequestPrivate *priv;
gulong id;
g_return_val_if_fail (connection != NULL, NULL);
@@ -80,9 +110,26 @@ nm_act_request_new (NMConnection *connection,
if (specific_object)
priv->specific_object = g_strdup (specific_object);
id = g_signal_connect (priv->connection,
"secrets-updated",
G_CALLBACK (connection_secrets_updated_cb),
NM_ACT_REQUEST (obj));
priv->secrets_updated_id = id;
return NM_ACT_REQUEST (obj);
}
static void
connection_secrets_updated_cb (NMConnection *connection,
const char *setting_name,
NMActRequest *self)
{
g_return_if_fail (setting_name != NULL);
g_return_if_fail (self != NULL);
g_signal_emit (connection, signals[CONNECTION_SECRETS_UPDATED], 0, connection, setting_name);
}
NMConnection *
nm_act_request_get_connection (NMActRequest *req)
{