2008-07-11 Dan Williams <dcbw@redhat.com>

Modify the NMDevice::state-changed signal to include the previous state
	and reason. Enables the applet to provide more information why device
	activation failed.


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3819 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Dan Williams
2008-07-11 10:28:53 +00:00
committed by Tambet Ingo
parent 9228a199fd
commit 95bb76aa7f
20 changed files with 675 additions and 304 deletions

View File

@@ -78,8 +78,46 @@ enum {
LAST_PROP
};
static void device_state_changed (NMDevice *device, NMDeviceState state, gpointer user_data);
static void
device_state_changed (NMDevice *device,
NMDeviceState new_state,
NMDeviceState old_state,
NMDeviceStateReason reason,
gpointer user_data)
{
NMActRequest *self = NM_ACT_REQUEST (user_data);
NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (self);
NMActiveConnectionState new_ac_state;
gboolean new_default = FALSE;
/* Set NMActiveConnection state based on the device's state */
switch (new_state) {
case NM_DEVICE_STATE_PREPARE:
case NM_DEVICE_STATE_CONFIG:
case NM_DEVICE_STATE_NEED_AUTH:
case NM_DEVICE_STATE_IP_CONFIG:
new_ac_state = NM_ACTIVE_CONNECTION_STATE_ACTIVATING;
break;
case NM_DEVICE_STATE_ACTIVATED:
new_ac_state = NM_ACTIVE_CONNECTION_STATE_ACTIVATED;
new_default = priv->is_default;
break;
default:
new_ac_state = NM_ACTIVE_CONNECTION_STATE_UNKNOWN;
break;
}
if (new_ac_state != priv->state) {
priv->state = new_ac_state;
g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_STATE);
}
if (new_default != priv->is_default) {
priv->is_default = new_default;
g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_DEFAULT);
}
}
NMActRequest *
nm_act_request_new (NMConnection *connection,
@@ -303,42 +341,6 @@ nm_act_request_class_init (NMActRequestClass *req_class)
nm_active_connection_install_type_info (object_class);
}
static void
device_state_changed (NMDevice *device, NMDeviceState state, gpointer user_data)
{
NMActRequest *self = NM_ACT_REQUEST (user_data);
NMActRequestPrivate *priv = NM_ACT_REQUEST_GET_PRIVATE (self);
NMActiveConnectionState new_state;
gboolean new_default = FALSE;
/* Set NMActiveConnection state based on the device's state */
switch (state) {
case NM_DEVICE_STATE_PREPARE:
case NM_DEVICE_STATE_CONFIG:
case NM_DEVICE_STATE_NEED_AUTH:
case NM_DEVICE_STATE_IP_CONFIG:
new_state = NM_ACTIVE_CONNECTION_STATE_ACTIVATING;
break;
case NM_DEVICE_STATE_ACTIVATED:
new_state = NM_ACTIVE_CONNECTION_STATE_ACTIVATED;
new_default = priv->is_default;
break;
default:
new_state = NM_ACTIVE_CONNECTION_STATE_UNKNOWN;
break;
}
if (new_state != priv->state) {
priv->state = new_state;
g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_STATE);
}
if (new_default != priv->is_default) {
priv->is_default = new_default;
g_object_notify (G_OBJECT (self), NM_ACTIVE_CONNECTION_DEFAULT);
}
}
typedef struct GetSecretsInfo {
NMActRequest *req;
char *setting_name;