[libsocialweb] online: update connection states for NM 0.9



commit da899278ae076972cd1fa15142b8a79a6be3000f
Author: Dan Williams <dcbw redhat com>
Date:   Mon Mar 7 22:48:52 2011 -0600

    online: update connection states for NM 0.9

 libsocialweb/sw-online.c |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/libsocialweb/sw-online.c b/libsocialweb/sw-online.c
index 2fb6196..6b82b02 100644
--- a/libsocialweb/sw-online.c
+++ b/libsocialweb/sw-online.c
@@ -105,6 +105,10 @@ sw_is_online (void)
 #if WITH_ONLINE_NM
 #include <libnm-glib/nm-client.h>
 
+#if !defined(NM_CHECK_VERSION)
+#define NM_CHECK_VERSION(x,y,z) 0
+#endif
+
 /*
  * Use NMClient since it correctly handles the NetworkManager service
  * appearing and disappearing, as can happen at boot time, or during
@@ -148,19 +152,24 @@ online_init (void)
 gboolean
 sw_is_online (void)
 {
-  NMState state = NM_STATE_UNKNOWN;
-
   if (!online_init ())
     return TRUE;
 
-  g_object_get (G_OBJECT (client), NM_CLIENT_STATE, &state, NULL);
-
-  switch (state) {
+  switch (nm_client_get_state (client)) {
+#if NM_CHECK_VERSION(0,8,992)
+  case NM_STATE_CONNECTED_LOCAL:
+  case NM_STATE_CONNECTED_SITE:
+  case NM_STATE_CONNECTED_GLOBAL:
+#else
   case NM_STATE_CONNECTED:
+#endif
     return TRUE;
   case NM_STATE_CONNECTING:
   case NM_STATE_ASLEEP:
   case NM_STATE_DISCONNECTED:
+#if NM_CHECK_VERSION(0,8,992)
+  case NM_STATE_DISCONNECTING:
+#endif
   case NM_STATE_UNKNOWN:
   default:
     return FALSE;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]