diff options
author | Diane Trout <diane@ghic.org> | 2016-06-29 22:37:24 -0700 |
---|---|---|
committer | Diane Trout <diane@ghic.org> | 2016-06-29 23:08:42 -0700 |
commit | 91499340222a563bacce7994f32275c38ff55ff0 (patch) | |
tree | 0f7111971f22eb508262a6be8599deeeee29dc8d | |
parent | 3d3a13c561e858853af5c601373be3ea0746f58c (diff) | |
download | telepathy-mission-control-91499340222a563bacce7994f32275c38ff55ff0.tar.gz |
libnm-glib is deprecated and may not be available.
This patch switches to use th enew libnm API, also snice nm_client_new
now takes a GError, I thought I'd report the error message if mission
control can't connect to the network manager.
Additionally we can remove a definition of the NM_CHECK_VERSION
macro for old versions of NM, as well as a guard for the
NM_STATE_DISCONNECTING constant.
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | src/connectivity-monitor.c | 13 |
2 files changed, 5 insertions, 10 deletions
diff --git a/configure.ac b/configure.ac index 78af8506..c4c8122c 100644 --- a/configure.ac +++ b/configure.ac @@ -270,7 +270,7 @@ if test "x$with_connectivity" = "xno" || test "x$with_connectivity" = "xconnman" else PKG_CHECK_MODULES(NETWORK_MANAGER, [ - libnm-glib >= 0.7.0 + libnm ], have_nm="yes", have_nm="no") if test "x$have_nm" = "xyes"; then diff --git a/src/connectivity-monitor.c b/src/connectivity-monitor.c index 8b3d3856..bb09096e 100644 --- a/src/connectivity-monitor.c +++ b/src/connectivity-monitor.c @@ -32,7 +32,7 @@ #endif #ifdef HAVE_NM -#include <nm-client.h> +#include <NetworkManager.h> #endif #ifdef HAVE_UPOWER @@ -190,10 +190,6 @@ connectivity_monitor_remove_states ( #ifdef HAVE_NM -#if !defined(NM_CHECK_VERSION) -#define NM_CHECK_VERSION(x,y,z) 0 -#endif - static void connectivity_monitor_nm_state_change_cb (NMClient *client, const GParamSpec *pspec, @@ -210,9 +206,7 @@ connectivity_monitor_nm_state_change_cb (NMClient *client, state = nm_client_get_state (priv->nm_client); if (state == NM_STATE_CONNECTING -#if NM_CHECK_VERSION(0,8,992) || state == NM_STATE_DISCONNECTING -#endif || state == NM_STATE_ASLEEP) { DEBUG ("New NetworkManager network state %d (unstable state)", state); @@ -504,6 +498,7 @@ static void mcd_connectivity_monitor_init (McdConnectivityMonitor *connectivity_monitor) { McdConnectivityMonitorPrivate *priv; + GError *error = NULL; priv = G_TYPE_INSTANCE_GET_PRIVATE (connectivity_monitor, MCD_TYPE_CONNECTIVITY_MONITOR, McdConnectivityMonitorPrivate); @@ -532,7 +527,7 @@ mcd_connectivity_monitor_init (McdConnectivityMonitor *connectivity_monitor) #endif #ifdef HAVE_NM - priv->nm_client = nm_client_new (); + priv->nm_client = nm_client_new (NULL, &error); if (priv->nm_client != NULL) { priv->state_change_signal_id = g_signal_connect (priv->nm_client, @@ -543,7 +538,7 @@ mcd_connectivity_monitor_init (McdConnectivityMonitor *connectivity_monitor) } else { - DEBUG ("Failed to get NetworkManager proxy"); + DEBUG ("Failed to get NetworkManager proxy: %s", error->message); } #endif |