[gnome-settings-daemon] sharing: Port to the new libnm NetworkManager library



commit 8c9c21dcd3f87399179a944c23e75aec36460a33
Author: Javier Jardón <jjardon gnome org>
Date:   Tue Jan 19 15:17:24 2016 +0000

    sharing: Port to the new libnm NetworkManager library
    
    https://bugzilla.gnome.org/show_bug.cgi?id=760856

 configure.ac                          |    4 +-
 plugins/sharing/gsd-sharing-manager.c |   36 +++++---------------------------
 2 files changed, 8 insertions(+), 32 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 4cdaf5b..a7a10c9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -59,7 +59,7 @@ UPOWER_REQUIRED_VERSION=0.99.0
 GSETTINGS_DESKTOP_SCHEMAS_REQUIRED_VERSION=3.19.3
 GEOCODE_GLIB_REQUIRED_VERSION=3.10.0
 GEOCLUE_REQUIRED_VERSION=2.3.1
-NM_REQUIRED_VERSION=0.9.9.1
+NM_REQUIRED_VERSION=1.0
 
 EXTRA_COMPILE_WARNINGS(yes)
 
@@ -393,7 +393,7 @@ AC_ARG_ENABLE(network-manager,
         enable_network_manager=yes)
 
 if test "x$enable_network_manager" = "xyes" ; then
-        NM_MODULE="libnm-glib >= $NM_REQUIRED_VERSION libnm-util >= $NM_REQUIRED_VERSION"
+        NM_MODULE="libnm >= $NM_REQUIRED_VERSION"
         AC_DEFINE(HAVE_NETWORK_MANAGER, 1, [Defined if NetworkManager support is enabled])
 else
         NM_MODULE=
diff --git a/plugins/sharing/gsd-sharing-manager.c b/plugins/sharing/gsd-sharing-manager.c
index c932908..e218c62 100644
--- a/plugins/sharing/gsd-sharing-manager.c
+++ b/plugins/sharing/gsd-sharing-manager.c
@@ -26,9 +26,7 @@
 #include <glib/gstdio.h>
 
 #ifdef HAVE_NETWORK_MANAGER
-#include <nm-client.h>
-#include <nm-device.h>
-#include <nm-remote-settings.h>
+#include <NetworkManager.h>
 #endif /* HAVE_NETWORK_MANAGER */
 
 #include "gnome-settings-plugin.h"
@@ -54,7 +52,6 @@ struct GsdSharingManagerPrivate
         GCancellable            *cancellable;
 #ifdef HAVE_NETWORK_MANAGER
         NMClient                *client;
-        NMRemoteSettings        *remote_settings;
 #endif /* HAVE_NETWORK_MANAGER */
 
         GHashTable              *services;
@@ -369,10 +366,10 @@ get_type_and_name_for_connection_uuid (GsdSharingManager *manager,
         NMRemoteConnection *conn;
         const char *type;
 
-        if (!manager->priv->remote_settings)
+        if (!manager->priv->client)
                 return NULL;
 
-        conn = nm_remote_settings_get_connection_by_uuid (manager->priv->remote_settings, uuid);
+        conn = nm_client_get_connection_by_uuid (manager->priv->client, uuid);
         if (!conn)
                 return NULL;
         type = nm_connection_get_connection_type (NM_CONNECTION (conn));
@@ -397,10 +394,10 @@ connection_is_low_security (GsdSharingManager *manager,
 {
         NMRemoteConnection *conn;
 
-        if (!manager->priv->remote_settings)
+        if (!manager->priv->client)
                 return TRUE;
 
-        conn = nm_remote_settings_get_connection_by_uuid (manager->priv->remote_settings, uuid);
+        conn = nm_client_get_connection_by_uuid (manager->priv->client, uuid);
         if (!conn)
                 return TRUE;
 
@@ -423,7 +420,7 @@ gsd_sharing_manager_list_networks (GsdSharingManager  *manager,
                 return NULL;
 
 #ifdef HAVE_NETWORK_MANAGER
-        if (!manager->priv->remote_settings) {
+        if (!manager->priv->client) {
                 g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_FAILED, "Not ready yet");
                 return NULL;
         }
@@ -655,25 +652,6 @@ nm_client_ready (GObject      *source_object,
         primary_connection_changed (NULL, NULL, manager);
 }
 
-static void
-remote_settings_ready_cb (GObject      *source_object,
-                          GAsyncResult *res,
-                          gpointer      user_data)
-{
-        GError *error = NULL;
-        GsdSharingManager *manager = user_data;
-        NMRemoteSettings *remote_settings;
-
-        remote_settings = nm_remote_settings_new_finish (res, &error);
-        if (!remote_settings) {
-                if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
-                        g_warning ("Couldn't get remote settings: %s", error->message);
-                g_error_free (error);
-                return;
-        }
-
-        manager->priv->remote_settings = remote_settings;
-}
 #endif /* HAVE_NETWORK_MANAGER */
 
 #define RYGEL_BUS_NAME "org.gnome.Rygel1"
@@ -720,7 +698,6 @@ gsd_sharing_manager_start (GsdSharingManager *manager,
         manager->priv->cancellable = g_cancellable_new ();
 #ifdef HAVE_NETWORK_MANAGER
         nm_client_new_async (manager->priv->cancellable, nm_client_ready, manager);
-        nm_remote_settings_new_async (NULL, manager->priv->cancellable, remote_settings_ready_cb, manager);
 #endif /* HAVE_NETWORK_MANAGER */
 
         /* Start process of owning a D-Bus name */
@@ -748,7 +725,6 @@ gsd_sharing_manager_stop (GsdSharingManager *manager)
 
 #ifdef HAVE_NETWORK_MANAGER
         g_clear_object (&manager->priv->client);
-        g_clear_object (&manager->priv->remote_settings);
 #endif /* HAVE_NETWORK_MANAGER */
 
         if (manager->priv->name_id != 0) {


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