diff --git a/ChangeLog b/ChangeLog index ccc77e0def..f8e8cbb9cc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2006-04-06 Robert Love + + Fix bad but simple bug where an active modem connection did not update + NM's connection state, breaking any app that did online/offline: + * src/NetworkManagerMain.h: Add 'modem_active' member to NMData, + represented whether a dial up connection is active, or not. + * src/nm-dbus-nm.c: Set and unset 'modem_active' in response + to modem activation and deactivation. + * src/NetworkManagerDbus.c: When asked our state, do not return + disconnected if the modem is active. + 2006-04-04 Robert Love * gnome/applet/applet.c: Remove the 'Remove' option that I added to the diff --git a/src/NetworkManagerDbus.c b/src/NetworkManagerDbus.c index 1ba3888a56..c00f932721 100644 --- a/src/NetworkManagerDbus.c +++ b/src/NetworkManagerDbus.c @@ -302,7 +302,7 @@ NMState nm_get_app_state_from_data (NMData *data) return NM_STATE_ASLEEP; act_dev = nm_get_active_device (data); - if (!act_dev) + if (!act_dev && !data->modem_active) return NM_STATE_DISCONNECTED; if (nm_device_is_activating (act_dev)) diff --git a/src/NetworkManagerMain.h b/src/NetworkManagerMain.h index c4cf9a1b29..24b703a241 100644 --- a/src/NetworkManagerMain.h +++ b/src/NetworkManagerMain.h @@ -83,6 +83,7 @@ typedef struct NMData GMutex * dev_list_mutex; gboolean wireless_enabled; + gboolean modem_active; gboolean asleep; GSList * dialup_list; diff --git a/src/nm-dbus-nm.c b/src/nm-dbus-nm.c index ce6c4aaa0f..017e12f0ac 100644 --- a/src/nm-dbus-nm.c +++ b/src/nm-dbus-nm.c @@ -170,6 +170,8 @@ static DBusMessage *nm_dbus_nm_activate_dialup (DBusConnection *connection, DBus if (!nm_system_activate_dialup (nm_data->dialup_list, dialup)) reply = nm_dbus_create_error_message (message, NM_DBUS_INTERFACE, "ActivationFailed", "Failed to activate the dialup device."); + else + nm_data->modem_active = TRUE; nm_unlock_mutex (nm_data->dialup_list_mutex, __FUNCTION__); out: @@ -203,6 +205,8 @@ static DBusMessage *nm_dbus_nm_deactivate_dialup (DBusConnection *connection, DB if (!nm_system_deactivate_dialup (nm_data->dialup_list, dialup)) reply = nm_dbus_create_error_message (message, NM_DBUS_INTERFACE, "DeactivationFailed", "Failed to deactivate the dialup device."); + else + nm_data->modem_active = FALSE; nm_unlock_mutex (nm_data->dialup_list_mutex, __FUNCTION__); out: @@ -560,6 +564,7 @@ static DBusMessage *nm_dbus_nm_sleep (DBusConnection *connection, DBusMessage *m nm_lock_mutex (app_data->dialup_list_mutex, __FUNCTION__); nm_system_deactivate_all_dialup (app_data->dialup_list); + app_data->modem_active = FALSE; nm_unlock_mutex (app_data->dialup_list_mutex, __FUNCTION__); }