Bug 639959 - Support NetworkManager 0.9.0; r=bz

This commit is contained in:
Dan Williams 2011-10-21 21:33:31 +01:00
Родитель a11dca0b3a
Коммит 1a0e3c8fd5
1 изменённых файлов: 14 добавлений и 11 удалений

Просмотреть файл

@ -52,15 +52,13 @@
#define NM_DBUS_SERVICE "org.freedesktop.NetworkManager"
#define NM_DBUS_PATH "/org/freedesktop/NetworkManager"
#define NM_DBUS_INTERFACE "org.freedesktop.NetworkManager"
#define NM_DBUS_SIGNAL_STATE_CHANGE "StateChange"
typedef enum NMState
{
NM_STATE_UNKNOWN = 0,
NM_STATE_ASLEEP,
NM_STATE_CONNECTING,
NM_STATE_CONNECTED,
NM_STATE_DISCONNECTED
} NMState;
#define NM_DBUS_SIGNAL_STATE_CHANGE "StateChange" /* Deprecated in 0.7.x */
#define NM_DBUS_SIGNAL_STATE_CHANGED "StateChanged"
#define NM_STATE_CONNECTED_OLD 3 /* Before NM 0.9.0 */
#define NM_STATE_CONNECTED_LOCAL 50
#define NM_STATE_CONNECTED_SITE 60
#define NM_STATE_CONNECTED_GLOBAL 70
nsNetworkManagerListener::nsNetworkManagerListener() :
mLinkUp(true), mNetworkManagerActive(false),
@ -185,7 +183,9 @@ nsNetworkManagerListener::UnregisterWithConnection(DBusConnection* connection) {
bool
nsNetworkManagerListener::HandleMessage(DBusMessage* message) {
if (dbus_message_is_signal(message, NM_DBUS_INTERFACE,
NM_DBUS_SIGNAL_STATE_CHANGE)) {
NM_DBUS_SIGNAL_STATE_CHANGE) ||
dbus_message_is_signal(message, NM_DBUS_INTERFACE,
NM_DBUS_SIGNAL_STATE_CHANGED)) {
UpdateNetworkStatus(message);
return true;
}
@ -202,7 +202,10 @@ nsNetworkManagerListener::UpdateNetworkStatus(DBusMessage* msg) {
mNetworkManagerActive = true;
bool wasUp = mLinkUp;
mLinkUp = result == NM_STATE_CONNECTED;
mLinkUp = result == NM_STATE_CONNECTED_OLD ||
result == NM_STATE_CONNECTED_LOCAL ||
result == NM_STATE_CONNECTED_SITE ||
result == NM_STATE_CONNECTED_GLOBAL;
if (wasUp == mLinkUp)
return;