From be798e43ab7fe1b7ecb059905bc0e3e47f2e525a Mon Sep 17 00:00:00 2001 From: Tambet Ingo Date: Wed, 13 Jun 2007 11:58:25 +0000 Subject: [PATCH] 2007-06-13 Tambet Ingo * src/nm-device.c (nm_device_state_changed): Emit the signal before handling it because the handling code will cause the next state change and signal listeners get the signals in wrong order. * src/NetworkManagerPolicy.c (nm_policy_device_change_check): Get the "old_dev" correctly in case of pending activation. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2593 4912f4e0-d625-0410-9fb7-b9a5a253dbdc --- ChangeLog | 18 ++++++++++++++++++ src/NetworkManagerPolicy.c | 19 +++++++++++++++++-- src/nm-device.c | 4 ++-- 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index ef1bdf90b6..b02ac11521 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2007-06-13 Tambet Ingo + + * src/nm-device.c (nm_device_state_changed): Emit the signal before handling it + because the handling code will cause the next state change and signal listeners + get the signals in wrong order. + + * src/NetworkManagerPolicy.c (nm_policy_device_change_check): Get the "old_dev" + correctly in case of pending activation. + + * src/nm-device-802-11-wireless.c (nm_device_802_11_wireless_set_activation_ap): + Convert the essid byte array to string correctly, including the terminating NULL. + + * src/NetworkManagerPolicy.c (create_connection): Create wireless ssid and + mode with correct types. + + * src/nm-dbus-nmi.c (nm_dbus_get_user_key_for_network): Fix a typo, pass the + constructed info to dbus call instead of the activation request. + 2007-06-11 Christopher Aillon Patch from Christian Persch diff --git a/src/NetworkManagerPolicy.c b/src/NetworkManagerPolicy.c index c78c983321..7588eff0c1 100644 --- a/src/NetworkManagerPolicy.c +++ b/src/NetworkManagerPolicy.c @@ -214,12 +214,27 @@ static gboolean nm_policy_device_change_check (gpointer user_data) { NMPolicy *policy = (NMPolicy *) user_data; + GSList *iter; NMAccessPoint * ap = NULL; NMDevice * new_dev; - NMDevice * old_dev; + NMDevice * old_dev = NULL; gboolean do_switch = FALSE; - old_dev = nm_manager_get_active_device (policy->manager); + switch (nm_manager_get_state (policy->manager)) { + case NM_STATE_CONNECTED: + old_dev = nm_manager_get_active_device (policy->manager); + break; + case NM_STATE_CONNECTING: + for (iter = nm_manager_get_devices (policy->manager); iter; iter = iter->next) { + if (nm_device_is_activating (NM_DEVICE (iter->data))) { + old_dev = NM_DEVICE (iter->data); + break; + } + } + break; + default: + break; + } if (old_dev) { guint32 caps = nm_device_get_capabilities (old_dev); diff --git a/src/nm-device.c b/src/nm-device.c index 698017a4f9..79837426f1 100644 --- a/src/nm-device.c +++ b/src/nm-device.c @@ -1521,6 +1521,8 @@ nm_device_state_changed (NMDevice *device, NMDeviceState state) old_state = device->priv->state; device->priv->state = state; + g_signal_emit_by_name (device, "state-changed", state); + switch (state) { case NM_DEVICE_STATE_DOWN: if (old_state == NM_DEVICE_STATE_ACTIVATED) @@ -1536,8 +1538,6 @@ nm_device_state_changed (NMDevice *device, NMDeviceState state) default: break; } - - g_signal_emit_by_name (device, "state-changed", state); }