[krb5-auth-dialog] Port to libnm
- From: Guido Günther <guidog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [krb5-auth-dialog] Port to libnm
- Date: Sat, 14 Jan 2017 18:22:09 +0000 (UTC)
commit 49e9e86abac0640f534065d6a6a617cba3046a50
Author: Lubomir Rintel <lkundrak v3 sk>
Date: Thu Jan 12 15:39:41 2017 +0100
Port to libnm
It's the perferred NetworkManager's library for a couple of years now
already. Keep compatibility with the older one, since it's reasonably
similar.
Signed-off-by: Guido Günther <agx sigxcpu org>
configure.ac | 8 ++++++--
src/ka-kerberos.c | 37 ++++++++++++++++++++++++++-----------
2 files changed, 32 insertions(+), 13 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index c12d79b..1e1a6aa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -146,8 +146,12 @@ AC_ARG_ENABLE([network-manager],
AC_MSG_RESULT([$enable_network_manager])
if test "x$enable_network_manager" != "xno"; then
- PKG_CHECK_MODULES([NETWORK_MANAGER],[libnm-glib >= 0.7.999],
- [enable_network_manager=yes],[enable_network_manager=no])
+ PKG_CHECK_MODULES([NETWORK_MANAGER],[libnm],
+ AC_DEFINE([HAVE_LIBNM],[1],[Define if libnm is available])
+ [enable_network_manager=yes],
+ PKG_CHECK_MODULES([NETWORK_MANAGER],[libnm-glib >= 0.7.999],
+ [enable_network_manager=yes],
+ [enable_network_manager=no]))
AC_SUBST([NETWORK_MANAGER_CFLAGS])
AC_SUBST([NETWORK_MANAGER_LIBS])
fi
diff --git a/src/ka-kerberos.c b/src/ka-kerberos.c
index ab94b62..373d9ae 100644
--- a/src/ka-kerberos.c
+++ b/src/ka-kerberos.c
@@ -41,11 +41,14 @@
#include "ka-main-window.h"
#ifdef ENABLE_NETWORK_MANAGER
-#include <nm-client.h>
-
-#if !defined(NM_CHECK_VERSION)
-#define NM_CHECK_VERSION(x,y,z) 0
-#endif
+# ifdef HAVE_LIBNM
+# include <NetworkManager.h>
+# else
+# include <nm-client.h>
+# if !defined(NM_CHECK_VERSION)
+# define NM_CHECK_VERSION(x,y,z) 0
+# endif
+# endif
#endif
#ifdef HAVE_HX509_ERR_H
@@ -1094,16 +1097,28 @@ static gboolean
ka_nm_init (void)
{
#ifdef ENABLE_NETWORK_MANAGER
+#ifdef HAVE_LIBNM
+ GError *error = NULL;
+
+ nm_client = nm_client_new (NULL, &error);
+ if (!nm_client) {
+ g_warning ("Could not initialize nm-client: %s", error->message);
+ g_error_free (error);
+ return FALSE;
+ }
+#else
nm_client = nm_client_new ();
if (!nm_client) {
g_warning ("Could not initialize nm-client");
- } else {
- g_signal_connect (nm_client, "notify::state",
- G_CALLBACK (ka_nm_client_state_changed_cb),
- &is_online);
- /* Set initial state */
- ka_nm_client_state_changed_cb (nm_client, NULL, &is_online);
+ return FALSE;
}
+#endif
+
+ g_signal_connect (nm_client, "notify::state",
+ G_CALLBACK (ka_nm_client_state_changed_cb),
+ &is_online);
+ /* Set initial state */
+ ka_nm_client_state_changed_cb (nm_client, NULL, &is_online);
#endif /* ENABLE_NETWORK_MANAGER */
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]