[network-manager-applet/danw/libnm: 9/9] applet: port to libnm



commit 343fa6d617099782c33bf5f3722a0858ef158772
Author: Dan Winship <danw redhat com>
Date:   Tue Nov 25 10:00:33 2014 -0500

    applet: port to libnm
    
    Based on a patch by Jiří Klimeš.

 src/Makefile.am                |   14 +-
 src/ap-menu-item.c             |    9 +-
 src/ap-menu-item.h             |    2 +-
 src/applet-agent.c             |  141 +++++-------
 src/applet-agent.h             |   11 +-
 src/applet-device-bond.c       |   24 +--
 src/applet-device-bridge.c     |   24 +--
 src/applet-device-broadband.c  |   48 ++--
 src/applet-device-bt.c         |   32 +--
 src/applet-device-cdma.c       |   54 ++---
 src/applet-device-ethernet.c   |   72 +++----
 src/applet-device-gsm.c        |   59 +++---
 src/applet-device-infiniband.c |   25 +--
 src/applet-device-team.c       |   25 +--
 src/applet-device-vlan.c       |   34 +--
 src/applet-device-wifi.c       |  293 ++++++++++++------------
 src/applet-device-wimax.c      |   23 +--
 src/applet-dialogs.c           |  243 +++++++-------------
 src/applet-vpn-request.c       |   51 ++--
 src/applet-vpn-request.h       |    2 +-
 src/applet.c                   |  496 +++++++++++++++++-----------------------
 src/applet.h                   |   22 +--
 src/ethernet-dialog.c          |   11 +-
 src/ethernet-dialog.h          |    7 +-
 src/mobile-helpers.c           |   17 +-
 src/mobile-helpers.h           |    4 +-
 26 files changed, 734 insertions(+), 1009 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 5f2b741..5cd3313 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -4,10 +4,10 @@ bin_PROGRAMS = nm-applet
 
 nm_applet_CPPFLAGS = \
        $(GTK_CFLAGS) \
-       $(NMA_CFLAGS) \
+       $(LIBNM_CFLAGS) \
        $(LIBSECRET_CFLAGS) \
        $(NOTIFY_CFLAGS) \
-       -DLIBNM_GLIB_BUILD \
+       -DLIBNM_BUILD \
        -DNM_VERSION_MAX_ALLOWED=NM_VERSION_0_9_10 \
        -DICONDIR=\""$(datadir)/icons"\"                                                \
        -DUIDIR=\""$(uidir)"\"                                                  \
@@ -21,7 +21,7 @@ nm_applet_CPPFLAGS = \
        $(DBUS_CFLAGS)                                                                          \
        -I${top_srcdir}/src/utils \
        -I${top_srcdir}/src/wireless-security \
-       -I${top_srcdir}/src/libnm-gtk
+       -I${top_srcdir}/src/libnma
 
 BUILT_SOURCES = applet-dbus-bindings.h
 
@@ -75,12 +75,12 @@ nm_applet_SOURCES = \
 nm_applet_LDADD = \
        -lm \
        $(GTK_LIBS) \
-       $(NMA_LIBS) \
+       $(LIBNM_LIBS) \
        $(LIBSECRET_LIBS) \
        $(NOTIFY_LIBS) \
-       ${top_builddir}/src/utils/libutils-libnm-glib.la \
-       ${top_builddir}/src/wireless-security/libwireless-security-libnm-glib.la \
-       ${top_builddir}/src/libnm-gtk/libnm-gtk.la
+       ${top_builddir}/src/utils/libutils-libnm.la \
+       ${top_builddir}/src/wireless-security/libwireless-security-libnm.la \
+       ${top_builddir}/src/libnma/libnma.la
 
 if WITH_MODEM_MANAGER_1
 nm_applet_SOURCES += \
diff --git a/src/ap-menu-item.c b/src/ap-menu-item.c
index b345a1c..ca83c3d 100644
--- a/src/ap-menu-item.c
+++ b/src/ap-menu-item.c
@@ -18,7 +18,7 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * Copyright (C) 2005 - 2008 Red Hat, Inc.
+ * Copyright 2005 - 2014 Red Hat, Inc.
  */
 
 #ifdef HAVE_CONFIG_H
@@ -29,7 +29,8 @@
 #include <glib/gi18n.h>
 #include <string.h>
 
-#include <nm-utils.h>
+#include <NetworkManager.h>
+
 #include "ap-menu-item.h"
 #include "nm-access-point.h"
 
@@ -107,7 +108,7 @@ nm_network_menu_item_class_init (NMNetworkMenuItemClass * klass)
 }
 
 void
-nm_network_menu_item_set_ssid (NMNetworkMenuItem *item, GByteArray *ssid)
+nm_network_menu_item_set_ssid (NMNetworkMenuItem *item, GBytes *ssid)
 {
        g_return_if_fail (item != NULL);
        g_return_if_fail (NM_IS_NETWORK_MENU_ITEM (item));
@@ -115,7 +116,7 @@ nm_network_menu_item_set_ssid (NMNetworkMenuItem *item, GByteArray *ssid)
 
        g_free (item->ssid_string);
 
-       item->ssid_string = nm_utils_ssid_to_utf8 (ssid);
+       item->ssid_string = nm_utils_ssid_to_utf8 (g_bytes_get_data (ssid, NULL), g_bytes_get_size (ssid));
        if (!item->ssid_string) {
                // FIXME: shouldn't happen; always coerce the SSID to _something_
                item->ssid_string = g_strdup ("<unknown>");
diff --git a/src/ap-menu-item.h b/src/ap-menu-item.h
index d1b478b..5e0a0ae 100644
--- a/src/ap-menu-item.h
+++ b/src/ap-menu-item.h
@@ -68,7 +68,7 @@ GType    nm_network_menu_item_get_type (void) G_GNUC_CONST;
 GtkWidget* nm_network_menu_item_new (const char *hash, gboolean has_connections);
 
 void       nm_network_menu_item_set_ssid (NMNetworkMenuItem *item,
-                                          GByteArray *ssid);
+                                          GBytes *ssid);
 const char *nm_network_menu_item_get_ssid (NMNetworkMenuItem *item);
 
 gboolean   nm_network_menu_item_get_is_adhoc (NMNetworkMenuItem *item);
diff --git a/src/applet-agent.c b/src/applet-agent.c
index 3358519..0abd859 100644
--- a/src/applet-agent.c
+++ b/src/applet-agent.c
@@ -16,7 +16,7 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * Copyright (C) 2011 Red Hat, Inc.
+ * Copyright 2011 - 2014 Red Hat, Inc.
  */
 
 #ifdef HAVE_CONFIG_H
@@ -26,13 +26,6 @@
 #include <glib/gi18n.h>
 #include <string.h>
 #include <dbus/dbus-glib.h>
-#include <nm-setting-connection.h>
-#include <nm-setting-8021x.h>
-#include <nm-setting-vpn.h>
-#include <nm-setting-wireless.h>
-#include <nm-setting-wireless-security.h>
-#include <nm-setting-wired.h>
-#include <nm-setting-pppoe.h>
 
 #define SECRET_API_SUBJECT_TO_CHANGE
 #include <libsecret/secret.h>
@@ -55,7 +48,7 @@ static const SecretSchema network_manager_secret_schema = {
        }
 };
 
-G_DEFINE_TYPE (AppletAgent, applet_agent, NM_TYPE_SECRET_AGENT);
+G_DEFINE_TYPE (AppletAgent, applet_agent, NM_TYPE_SECRET_AGENT_OLD);
 
 #define APPLET_AGENT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), APPLET_TYPE_AGENT, 
AppletAgentPrivate))
 
@@ -81,15 +74,15 @@ static guint signals[LAST_SIGNAL] = { 0 };
 typedef struct {
        guint id;
 
-       NMSecretAgent *agent;
+       NMSecretAgentOld *agent;
        NMConnection *connection;
        char *path;
        char *setting_name;
        char **hints;
        guint32 flags;
-       NMSecretAgentGetSecretsFunc get_callback;
-       NMSecretAgentSaveSecretsFunc save_callback;
-       NMSecretAgentDeleteSecretsFunc delete_callback;
+       NMSecretAgentOldGetSecretsFunc get_callback;
+       NMSecretAgentOldSaveSecretsFunc save_callback;
+       NMSecretAgentOldDeleteSecretsFunc delete_callback;
        gpointer callback_data;
 
        GCancellable *cancellable;
@@ -97,15 +90,15 @@ typedef struct {
 } Request;
 
 static Request *
-request_new (NMSecretAgent *agent,
+request_new (NMSecretAgentOld *agent,
              NMConnection *connection,
              const char *connection_path,
              const char *setting_name,
              const char **hints,
              guint32 flags,
-             NMSecretAgentGetSecretsFunc get_callback,
-             NMSecretAgentSaveSecretsFunc save_callback,
-             NMSecretAgentDeleteSecretsFunc delete_callback,
+             NMSecretAgentOldGetSecretsFunc get_callback,
+             NMSecretAgentOldSaveSecretsFunc save_callback,
+             NMSecretAgentOldDeleteSecretsFunc delete_callback,
              gpointer callback_data)
 {
        static guint32 counter = 1;
@@ -149,7 +142,7 @@ request_free (Request *r)
 /*******************************************************/
 
 static void
-get_save_cb (NMSecretAgent *agent,
+get_save_cb (NMSecretAgentOld *agent,
              NMConnection *connection,
              GError *error,
              gpointer user_data)
@@ -159,7 +152,7 @@ get_save_cb (NMSecretAgent *agent,
 
 static void
 get_secrets_cb (AppletAgent *self,
-                GHashTable *secrets,
+                GVariant *secrets,
                 GError *error,
                 gpointer user_data)
 {
@@ -178,21 +171,21 @@ get_secrets_cb (AppletAgent *self,
                 */
                if (secrets && (r->flags != NM_SECRET_AGENT_GET_SECRETS_FLAG_NONE)) {
                        NMConnection *dupl;
-                       GHashTableIter iter;
+                       GVariantIter iter;
                        const char *setting_name;
 
                        /* Copy the existing connection and update its secrets */
-                       dupl = nm_connection_duplicate (r->connection);
-                       g_hash_table_iter_init (&iter, secrets);
-                       while (g_hash_table_iter_next (&iter, (gpointer) &setting_name, NULL))
+                       dupl = nm_simple_connection_new_clone (r->connection);
+                       g_variant_iter_init (&iter, secrets);
+                       while (g_variant_iter_next (&iter, (gpointer) &setting_name, NULL))
                                nm_connection_update_secrets (dupl, setting_name, secrets, NULL);
 
                        /* And save updated secrets to the keyring */
-                       nm_secret_agent_save_secrets (NM_SECRET_AGENT (self), dupl, get_save_cb, NULL);
+                       nm_secret_agent_old_save_secrets (NM_SECRET_AGENT_OLD (self), dupl, get_save_cb, 
NULL);
                        g_object_unref (dupl);
                }
 
-               r->get_callback (NM_SECRET_AGENT (r->agent), r->connection, secrets, error, r->callback_data);
+               r->get_callback (NM_SECRET_AGENT_OLD (r->agent), r->connection, secrets, error, 
r->callback_data);
        }
        request_free (r);
 }
@@ -282,24 +275,6 @@ is_connection_always_ask (NMConnection *connection)
        return FALSE;
 }
 
-static GValue *
-string_to_gvalue (const char *str)
-{
-       GValue *val;
-
-       val = g_slice_new0 (GValue);
-       g_value_init (val, G_TYPE_STRING);
-       g_value_set_string (val, str);
-       return val;
-}
-
-static void
-destroy_gvalue (gpointer data)
-{
-       g_value_unset ((GValue *) data);
-       g_slice_free (GValue, data);
-}
-
 static void
 keyring_find_secrets_cb (GObject *source,
                          GAsyncResult *result,
@@ -309,7 +284,8 @@ keyring_find_secrets_cb (GObject *source,
        GError *error = NULL;
        GError *search_error = NULL;
        const char *connection_id = NULL;
-       GHashTable *secrets = NULL, *settings = NULL;
+       GVariantBuilder builder;
+       GVariant *secrets = NULL, *settings = NULL;
        GList *list = NULL;
        GList *iter;
        gboolean hint_found = FALSE, ask = FALSE;
@@ -332,7 +308,7 @@ keyring_find_secrets_cb (GObject *source,
                goto done;
        } else if (search_error) {
                error = g_error_new (NM_SECRET_AGENT_ERROR,
-                                    NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+                                    NM_SECRET_AGENT_ERROR_FAILED,
                                     "%s.%d - failed to read secrets from keyring (%s)",
                                     __FILE__, __LINE__, search_error->message);
                g_error_free (search_error);
@@ -350,7 +326,7 @@ keyring_find_secrets_cb (GObject *source,
                return;
        }
 
-       secrets = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, destroy_gvalue);
+       g_variant_builder_init (&builder, NM_VARIANT_TYPE_SETTING);
 
        /* Extract the secrets from the list of matching keyring items */
        for (iter = list; iter != NULL; iter = g_list_next (iter)) {
@@ -369,8 +345,8 @@ keyring_find_secrets_cb (GObject *source,
                                continue;
                        }
 
-                       g_hash_table_insert (secrets, g_strdup (key_name),
-                                            string_to_gvalue (secret_value_get (secret, NULL)));
+                       g_variant_builder_add (&builder, "{sv}", key_name,
+                                              g_variant_new_string (secret_value_get (secret, NULL)));
 
                        /* See if this property matches a given hint */
                        if (r->hints && r->hints[0]) {
@@ -383,6 +359,7 @@ keyring_find_secrets_cb (GObject *source,
                        break;
                }
        }
+       secrets = g_variant_builder_end (&builder);
 
        /* If there were hints, and none of the hints were returned by the keyring,
         * get some new secrets.
@@ -401,47 +378,46 @@ keyring_find_secrets_cb (GObject *source,
        /* Returned secrets are a{sa{sv}}; this is the outer a{s...} hash that
         * will contain all the individual settings hashes.
         */
-       settings = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) 
g_hash_table_destroy);
-       g_hash_table_insert (settings, g_strdup (r->setting_name), secrets);
+       g_variant_builder_init (&builder, NM_VARIANT_TYPE_CONNECTION);
+       g_variant_builder_add (&builder, "{sa{sv}}", r->setting_name, secrets);
+       settings = g_variant_builder_end (&builder);
 
 done:
        g_list_free_full (list, g_object_unref);
        if (ask) {
-               GHashTableIter hash_iter;
+               GVariantIter dict_iter;
                const char *setting_name;
-               GHashTable *setting_hash;
+               GVariant *setting_dict;
 
                /* Stuff all the found secrets into the connection for the UI to use */
-               g_hash_table_iter_init (&hash_iter, settings);
-               while (g_hash_table_iter_next (&hash_iter,
-                                              (gpointer *) &setting_name,
-                                              (gpointer *) &setting_hash)) {
+               g_variant_iter_init (&dict_iter, settings);
+               while (g_variant_iter_next (&dict_iter, "{sa{sv}}", &setting_name, &setting_dict)) {
                        nm_connection_update_secrets (r->connection,
-                                                         setting_name,
-                                                         setting_hash,
-                                                         NULL);
+                                                     setting_name,
+                                                     setting_dict,
+                                                     NULL);
                }
 
                ask_for_secrets (r);
        } else {
                /* Otherwise send the secrets back to NetworkManager */
-               r->get_callback (NM_SECRET_AGENT (r->agent), r->connection, error ? NULL : settings, error, 
r->callback_data);
+               r->get_callback (NM_SECRET_AGENT_OLD (r->agent), r->connection, error ? NULL : settings, 
error, r->callback_data);
                request_free (r);
        }
 
        if (settings)
-               g_hash_table_destroy (settings);
+               g_variant_unref (settings);
        g_clear_error (&error);
 }
 
 static void
-get_secrets (NMSecretAgent *agent,
+get_secrets (NMSecretAgentOld *agent,
              NMConnection *connection,
              const char *connection_path,
              const char *setting_name,
              const char **hints,
              guint32 flags,
-             NMSecretAgentGetSecretsFunc callback,
+             NMSecretAgentOldGetSecretsFunc callback,
              gpointer callback_data)
 {
        AppletAgentPrivate *priv = APPLET_AGENT_GET_PRIVATE (agent);
@@ -518,7 +494,7 @@ get_secrets (NMSecretAgent *agent,
 /*******************************************************/
 
 static void
-cancel_get_secrets (NMSecretAgent *agent,
+cancel_get_secrets (NMSecretAgentOld *agent,
                     const char *connection_path,
                     const char *setting_name)
 {
@@ -543,7 +519,7 @@ cancel_get_secrets (NMSecretAgent *agent,
                        /* cancel outstanding keyring operations */
                        g_cancellable_cancel (r->cancellable);
 
-                       r->get_callback (NM_SECRET_AGENT (r->agent), r->connection, NULL, error, 
r->callback_data);
+                       r->get_callback (NM_SECRET_AGENT_OLD (r->agent), r->connection, NULL, error, 
r->callback_data);
                        g_hash_table_remove (priv->requests, GUINT_TO_POINTER (r->id));
                        g_signal_emit (r->agent, signals[CANCEL_SECRETS], 0, GUINT_TO_POINTER (r->id));
                }
@@ -562,7 +538,7 @@ save_request_try_complete (Request *r)
         */
        if (r->keyring_calls == 0) {
                if (!g_cancellable_is_cancelled (r->cancellable))
-                       r->save_callback (NM_SECRET_AGENT (r->agent), r->connection, NULL, r->callback_data);
+                       r->save_callback (NM_SECRET_AGENT_OLD (r->agent), r->connection, NULL, 
r->callback_data);
                request_free (r);
        }
 }
@@ -701,7 +677,7 @@ write_one_secret_to_keyring (NMSetting *setting,
 }
 
 static void
-save_delete_cb (NMSecretAgent *agent,
+save_delete_cb (NMSecretAgentOld *agent,
                 NMConnection *connection,
                 GError *error,
                 gpointer user_data)
@@ -719,10 +695,10 @@ save_delete_cb (NMSecretAgent *agent,
 }
 
 static void
-save_secrets (NMSecretAgent *agent,
+save_secrets (NMSecretAgentOld *agent,
               NMConnection *connection,
               const char *connection_path,
-              NMSecretAgentSaveSecretsFunc callback,
+              NMSecretAgentOldSaveSecretsFunc callback,
               gpointer callback_data)
 {
        AppletAgentPrivate *priv = APPLET_AGENT_GET_PRIVATE (agent);
@@ -732,7 +708,7 @@ save_secrets (NMSecretAgent *agent,
        g_hash_table_insert (priv->requests, GUINT_TO_POINTER (r->id), r);
 
        /* First delete any existing items in the keyring */
-       nm_secret_agent_delete_secrets (agent, connection, save_delete_cb, r);
+       nm_secret_agent_old_delete_secrets (agent, connection, save_delete_cb, r);
 }
 
 /*******************************************************/
@@ -756,7 +732,7 @@ delete_find_items_cb (GObject *source,
        secret_password_clear_finish (result, &secret_error);
        if (secret_error != NULL) {
                error = g_error_new (NM_SECRET_AGENT_ERROR,
-                                    NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+                                    NM_SECRET_AGENT_ERROR_FAILED,
                                     "The request could not be completed (%s)",
                                     secret_error->message);
                g_error_free (secret_error);
@@ -767,10 +743,10 @@ delete_find_items_cb (GObject *source,
 }
 
 static void
-delete_secrets (NMSecretAgent *agent,
+delete_secrets (NMSecretAgentOld *agent,
                 NMConnection *connection,
                 const char *connection_path,
-                NMSecretAgentDeleteSecretsFunc callback,
+                NMSecretAgentOldDeleteSecretsFunc callback,
                 gpointer callback_data)
 {
        AppletAgentPrivate *priv = APPLET_AGENT_GET_PRIVATE (agent);
@@ -807,18 +783,22 @@ applet_agent_handle_vpn_only (AppletAgent *agent, gboolean vpn_only)
 AppletAgent *
 applet_agent_new (void)
 {
-       return (AppletAgent *) g_object_new (APPLET_TYPE_AGENT,
-                                            NM_SECRET_AGENT_IDENTIFIER, "org.freedesktop.nm-applet",
-                                            NM_SECRET_AGENT_CAPABILITIES, 
NM_SECRET_AGENT_CAPABILITY_VPN_HINTS,
-                                            NULL);
+       //return g_initable_new (APPLET_TYPE_AGENT, NULL, NULL,
+       return g_object_new (APPLET_TYPE_AGENT,
+                              NM_SECRET_AGENT_OLD_IDENTIFIER, "org.freedesktop.nm-applet",
+                              NM_SECRET_AGENT_OLD_CAPABILITIES, NM_SECRET_AGENT_CAPABILITY_VPN_HINTS,
+                              NULL);
 }
 
+#if 0
+FIXME
 static void
-agent_registration_result_cb (NMSecretAgent *agent, GError *error, gpointer user_data)
+agent_registration_result_cb (NMSecretAgentOld *agent, GError *error, gpointer user_data)
 {
        if (error)
                g_warning ("Failed to register as an agent: (%d) %s", error->code, error->message);
 }
+#endif
 
 static void
 applet_agent_init (AppletAgent *self)
@@ -826,9 +806,6 @@ applet_agent_init (AppletAgent *self)
        AppletAgentPrivate *priv = APPLET_AGENT_GET_PRIVATE (self);
 
        priv->requests = g_hash_table_new (g_direct_hash, g_direct_equal);
-
-       g_signal_connect (self, NM_SECRET_AGENT_REGISTRATION_RESULT,
-                         G_CALLBACK (agent_registration_result_cb), NULL);
 }
 
 static void
@@ -857,7 +834,7 @@ static void
 applet_agent_class_init (AppletAgentClass *agent_class)
 {
        GObjectClass *object_class = G_OBJECT_CLASS (agent_class);
-       NMSecretAgentClass *parent_class = NM_SECRET_AGENT_CLASS (agent_class);
+       NMSecretAgentOldClass *parent_class = NM_SECRET_AGENT_OLD_CLASS (agent_class);
 
        g_type_class_add_private (agent_class, sizeof (AppletAgentPrivate));
 
diff --git a/src/applet-agent.h b/src/applet-agent.h
index 2e1be3e..e9cc5f2 100644
--- a/src/applet-agent.h
+++ b/src/applet-agent.h
@@ -16,13 +16,14 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * Copyright (C) 2011 Red Hat, Inc.
+ * Copyright 2011 - 2014 Red Hat, Inc.
  */
 
 #ifndef _APPLET_AGENT_H_
 #define _APPLET_AGENT_H_
 
-#include <nm-secret-agent.h>
+#include <NetworkManager.h>
+#include <nm-secret-agent-old.h>
 
 #define APPLET_TYPE_AGENT            (applet_agent_get_type ())
 #define APPLET_AGENT(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), APPLET_TYPE_AGENT, AppletAgent))
@@ -35,16 +36,16 @@
 #define APPLET_AGENT_CANCEL_SECRETS "cancel-secrets"
 
 typedef struct {
-       NMSecretAgent parent;
+       NMSecretAgentOld parent;
 } AppletAgent;
 
 typedef void (*AppletAgentSecretsCallback) (AppletAgent *self,
-                                            GHashTable *secrets,
+                                            GVariant *secrets,
                                             GError *error,
                                             gpointer user_data);
 
 typedef struct {
-       NMSecretAgentClass parent_class;
+       NMSecretAgentOldClass parent_class;
 
        void (*get_secrets)        (AppletAgent *self,
                                    void *request_id,
diff --git a/src/applet-device-bond.c b/src/applet-device-bond.c
index 36e22f7..c66bef3 100644
--- a/src/applet-device-bond.c
+++ b/src/applet-device-bond.c
@@ -17,8 +17,8 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * (C) Copyright 2008 Red Hat, Inc.
- * (C) Copyright 2008 Novell, Inc.
+ * Copyright 2008 - 2014 Red Hat, Inc.
+ * Copyright 2008 Novell, Inc.
  */
 
 #ifdef HAVE_CONFIG_H
@@ -28,22 +28,14 @@
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 
-#include <nm-device.h>
-#include <nm-setting-connection.h>
-#include <nm-setting-wired.h>
-#include <nm-setting-bond.h>
-#include <nm-device-bond.h>
-#include <nm-utils.h>
-
 #include "applet.h"
 #include "applet-device-bond.h"
 #include "utils.h"
-#include "nm-ui-utils.h"
 
 static void
 bond_add_menu_item (NMDevice *device,
                     gboolean multiple_devices,
-                    GSList *connections,
+                    const GPtrArray *connections,
                     NMConnection *active,
                     GtkWidget *menu,
                     NMApplet *applet)
@@ -51,7 +43,7 @@ bond_add_menu_item (NMDevice *device,
        char *text;
        GtkWidget *item;
 
-       text = nma_utils_get_connection_device_name (connections->data);
+       text = nm_connection_get_virtual_device_description (connections->pdata[0]);
        item = applet_menu_item_create_device_item_helper (device, applet, text);
        g_free (text);
 
@@ -59,8 +51,7 @@ bond_add_menu_item (NMDevice *device,
        gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
        gtk_widget_show (item);
 
-       if (g_slist_length (connections))
-               applet_add_connection_items (device, connections, TRUE, active, NMA_ADD_ACTIVE, menu, applet);
+       applet_add_connection_items (device, connections, TRUE, active, NMA_ADD_ACTIVE, menu, applet);
 
        /* Notify user of unmanaged or unavailable device */
        if (device) {
@@ -72,11 +63,10 @@ bond_add_menu_item (NMDevice *device,
        }
 
        if (!device || !nma_menu_device_check_unusable (device)) {
-               if ((!active && g_slist_length (connections)) || (active && g_slist_length (connections) > 1))
+               if (!active || connections->len > 1)
                        applet_menu_item_add_complex_separator_helper (menu, applet, _("Available"), -1);
 
-               if (g_slist_length (connections))
-                       applet_add_connection_items (device, connections, TRUE, active, NMA_ADD_INACTIVE, 
menu, applet);
+               applet_add_connection_items (device, connections, TRUE, active, NMA_ADD_INACTIVE, menu, 
applet);
        }
 }
 
diff --git a/src/applet-device-bridge.c b/src/applet-device-bridge.c
index 4352411..f44c969 100644
--- a/src/applet-device-bridge.c
+++ b/src/applet-device-bridge.c
@@ -17,8 +17,8 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * (C) Copyright 2008 Red Hat, Inc.
- * (C) Copyright 2008 Novell, Inc.
+ * Copyright 2008 - 2014 Red Hat, Inc.
+ * Copyright 2008 Novell, Inc.
  */
 
 #ifdef HAVE_CONFIG_H
@@ -28,22 +28,14 @@
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 
-#include <nm-device.h>
-#include <nm-setting-connection.h>
-#include <nm-setting-wired.h>
-#include <nm-setting-bridge.h>
-#include <nm-device-bridge.h>
-#include <nm-utils.h>
-
 #include "applet.h"
 #include "applet-device-bridge.h"
 #include "utils.h"
-#include "nm-ui-utils.h"
 
 static void
 bridge_add_menu_item (NMDevice *device,
                       gboolean multiple_devices,
-                      GSList *connections,
+                      const GPtrArray *connections,
                       NMConnection *active,
                       GtkWidget *menu,
                       NMApplet *applet)
@@ -51,7 +43,7 @@ bridge_add_menu_item (NMDevice *device,
        char *text;
        GtkWidget *item;
 
-       text = nma_utils_get_connection_device_name (connections->data);
+       text = nm_connection_get_virtual_device_description (connections->pdata[0]);
        item = applet_menu_item_create_device_item_helper (device, applet, text);
        g_free (text);
 
@@ -59,8 +51,7 @@ bridge_add_menu_item (NMDevice *device,
        gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
        gtk_widget_show (item);
 
-       if (g_slist_length (connections))
-               applet_add_connection_items (device, connections, TRUE, active, NMA_ADD_ACTIVE, menu, applet);
+       applet_add_connection_items (device, connections, TRUE, active, NMA_ADD_ACTIVE, menu, applet);
 
        /* Notify user of unmanaged or unavailable device */
        if (device) {
@@ -72,11 +63,10 @@ bridge_add_menu_item (NMDevice *device,
        }
 
        if (!device || !nma_menu_device_check_unusable (device)) {
-               if ((!active && g_slist_length (connections)) || (active && g_slist_length (connections) > 1))
+               if (!active || connections->len > 1)
                        applet_menu_item_add_complex_separator_helper (menu, applet, _("Available"), -1);
 
-               if (g_slist_length (connections))
-                       applet_add_connection_items (device, connections, TRUE, active, NMA_ADD_INACTIVE, 
menu, applet);
+               applet_add_connection_items (device, connections, TRUE, active, NMA_ADD_INACTIVE, menu, 
applet);
        }
 }
 
diff --git a/src/applet-device-broadband.c b/src/applet-device-broadband.c
index 2300c0d..75c44de 100644
--- a/src/applet-device-broadband.c
+++ b/src/applet-device-broadband.c
@@ -27,15 +27,12 @@
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 
-#include <nm-device.h>
-#include <nm-device-modem.h>
-#include <nm-utils.h>
+#include <NetworkManager.h>
 
 #include "applet.h"
 #include "applet-device-broadband.h"
 #include "applet-dialogs.h"
 #include "mobile-helpers.h"
-#include "nm-ui-utils.h"
 #include "mb-menu-item.h"
 
 typedef struct {
@@ -81,14 +78,16 @@ typedef struct {
 } ConnectNetworkInfo;
 
 static void
-add_and_activate_connection_done (NMClient *client,
-                                  NMActiveConnection *active,
-                                  const char *connection_path,
-                                  GError *error,
+add_and_activate_connection_done (GObject *client,
+                                  GAsyncResult *result,
                                   gpointer user_data)
 {
-       if (error)
+       GError *error = NULL;
+
+       if (!nm_client_add_and_activate_connection_finish (NM_CLIENT (client), result, &error)) {
                g_warning ("Failed to add/activate connection: (%d) %s", error->code, error->message);
+               g_error_free (error);
+       }
 }
 
 static void
@@ -105,12 +104,13 @@ wizard_done (NMConnection *connection,
                /* Ask NM to add the new connection and activate it; NM will fill in the
                 * missing details based on the specific object and the device.
                 */
-               nm_client_add_and_activate_connection (info->applet->nm_client,
-                                                      connection,
-                                                      info->device,
-                                                      "/",
-                                                      add_and_activate_connection_done,
-                                                      info->applet);
+               nm_client_add_and_activate_connection_async (info->applet->nm_client,
+                                                            connection,
+                                                            info->device,
+                                                            "/",
+                                                            NULL,
+                                                            add_and_activate_connection_done,
+                                                            info->applet);
        }
 
        g_object_unref (info->device);
@@ -318,7 +318,7 @@ unlock_dialog_new (NMDevice *device,
        }
 
        info->dialog = applet_mobile_pin_dialog_new (unlock_required,
-                                                    nma_utils_get_device_description (device));
+                                                    nm_device_get_description (device));
 
        g_object_set_data (G_OBJECT (info->dialog), "unlock-code", GUINT_TO_POINTER (lock));
        g_signal_connect (info->dialog, "response", G_CALLBACK (unlock_dialog_response), info);
@@ -464,7 +464,7 @@ get_secrets (SecretsRequest *req,
        if (!device) {
                g_set_error (error,
                             NM_SECRET_AGENT_ERROR,
-                            NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+                            NM_SECRET_AGENT_ERROR_FAILED,
                             "%s.%d (%s): failed to find device for active connection.",
                             __FILE__, __LINE__, __func__);
                return FALSE;
@@ -697,7 +697,7 @@ add_connection_item (NMDevice *device,
 static void
 add_menu_item (NMDevice *device,
                gboolean multiple_devices,
-               GSList *connections,
+               const GPtrArray *connections,
                NMConnection *active,
                GtkWidget *menu,
                NMApplet *applet)
@@ -705,14 +705,14 @@ add_menu_item (NMDevice *device,
        BroadbandDeviceInfo *info;
        char *text;
        GtkWidget *item;
-       GSList *iter;
+       int i;
 
        info = g_object_get_data (G_OBJECT (device), "devinfo");
 
        if (multiple_devices) {
                const char *desc;
 
-               desc = nma_utils_get_device_description (device);
+               desc = nm_device_get_description (device);
                text = g_strdup_printf (_("Mobile Broadband (%s)"), desc);
        } else {
                text = g_strdup (_("Mobile Broadband"));
@@ -766,12 +766,12 @@ add_menu_item (NMDevice *device,
 
        /* Add the default / inactive connection items */
        if (!nma_menu_device_check_unusable (device)) {
-               if ((!active && g_slist_length (connections)) || (active && g_slist_length (connections) > 1))
+               if ((!active && connections->len) || (active && connections->len > 1))
                        applet_menu_item_add_complex_separator_helper (menu, applet, _("Available"), -1);
 
-               if (g_slist_length (connections)) {
-                       for (iter = connections; iter; iter = g_slist_next (iter)) {
-                               NMConnection *connection = NM_CONNECTION (iter->data);
+               if (connections->len) {
+                       for (i = 0; i < connections->len; i++) {
+                               NMConnection *connection = NM_CONNECTION (connections->pdata[i]);
 
                                if (connection != active) {
                                        item = applet_new_menu_item_helper (connection, NULL, FALSE);
diff --git a/src/applet-device-bt.c b/src/applet-device-bt.c
index 580268d..7ac23b1 100644
--- a/src/applet-device-bt.c
+++ b/src/applet-device-bt.c
@@ -17,8 +17,8 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * (C) Copyright 2008 - 2012 Red Hat, Inc.
- * (C) Copyright 2008 Novell, Inc.
+ * Copyright 2008 - 2014 Red Hat, Inc.
+ * Copyright 2008 Novell, Inc.
  */
 
 #ifdef HAVE_CONFIG_H
@@ -28,19 +28,9 @@
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 
-#include <nm-device.h>
-#include <nm-setting-connection.h>
-#include <nm-setting-bluetooth.h>
-#include <nm-setting-cdma.h>
-#include <nm-setting-gsm.h>
-#include <nm-device-bt.h>
-#include <nm-utils.h>
-#include <nm-secret-agent.h>
-
 #include "applet.h"
 #include "applet-device-bt.h"
 #include "applet-dialogs.h"
-#include "nm-ui-utils.h"
 
 static gboolean
 bt_new_auto_connection (NMDevice *device,
@@ -56,7 +46,7 @@ bt_new_auto_connection (NMDevice *device,
 static void
 bt_add_menu_item (NMDevice *device,
                   gboolean multiple__devices,
-                  GSList *connections,
+                  const GPtrArray *connections,
                   NMConnection *active,
                   GtkWidget *menu,
                   NMApplet *applet)
@@ -66,7 +56,7 @@ bt_add_menu_item (NMDevice *device,
 
        text = nm_device_bt_get_name (NM_DEVICE_BT (device));
        if (!text)
-               text = nma_utils_get_device_description (device);
+               text = nm_device_get_description (device);
 
        item = applet_menu_item_create_device_item_helper (device, applet, text);
 
@@ -74,7 +64,7 @@ bt_add_menu_item (NMDevice *device,
        gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
        gtk_widget_show (item);
 
-       if (g_slist_length (connections))
+       if (connections->len)
                applet_add_connection_items (device, connections, TRUE, active, NMA_ADD_ACTIVE, menu, applet);
 
        /* Notify user of unmanaged or unavailable device */
@@ -86,7 +76,7 @@ bt_add_menu_item (NMDevice *device,
 
        if (!nma_menu_device_check_unusable (device)) {
                /* Add menu items for existing bluetooth connections for this device */
-               if (g_slist_length (connections)) {
+               if (connections->len) {
                        applet_menu_item_add_complex_separator_helper (menu, applet, _("Available"), -1);
                        applet_add_connection_items (device, connections, TRUE, active, NMA_ADD_INACTIVE, 
menu, applet);
                }
@@ -192,14 +182,14 @@ get_bt_secrets_cb (GtkDialog *dialog,
                } else {
                        g_set_error (&error,
                                         NM_SECRET_AGENT_ERROR,
-                                        NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+                                        NM_SECRET_AGENT_ERROR_FAILED,
                                         "%s.%d (%s): unhandled setting '%s'",
                                         __FILE__, __LINE__, __func__, req->setting_name);
                }
        } else {
                g_set_error (&error,
                             NM_SECRET_AGENT_ERROR,
-                            NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+                            NM_SECRET_AGENT_ERROR_FAILED,
                             "%s.%d (%s): canceled",
                             __FILE__, __LINE__, __func__);
        }
@@ -221,7 +211,7 @@ bt_get_secrets (SecretsRequest *req, GError **error)
        if (!req->hints || !g_strv_length (req->hints)) {
                g_set_error (error,
                             NM_SECRET_AGENT_ERROR,
-                            NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+                            NM_SECRET_AGENT_ERROR_FAILED,
                             "%s.%d (%s): missing secrets hints.",
                             __FILE__, __LINE__, __func__);
                return FALSE;
@@ -234,7 +224,7 @@ bt_get_secrets (SecretsRequest *req, GError **error)
        else {
                g_set_error (error,
                             NM_SECRET_AGENT_ERROR,
-                            NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+                            NM_SECRET_AGENT_ERROR_FAILED,
                             "%s.%d (%s): unknown secrets hint '%s'.",
                             __FILE__, __LINE__, __func__, info->secret_name);
                return FALSE;
@@ -245,7 +235,7 @@ bt_get_secrets (SecretsRequest *req, GError **error)
        if (!widget || !secret_entry) {
                g_set_error (error,
                             NM_SECRET_AGENT_ERROR,
-                            NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+                            NM_SECRET_AGENT_ERROR_FAILED,
                             "%s.%d (%s): error asking for CDMA secrets.",
                             __FILE__, __LINE__, __func__);
                return FALSE;
diff --git a/src/applet-device-cdma.c b/src/applet-device-cdma.c
index 8664cce..fab21ae 100644
--- a/src/applet-device-cdma.c
+++ b/src/applet-device-cdma.c
@@ -17,7 +17,7 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * (C) Copyright 2008 - 2012 Red Hat, Inc.
+ * Copyright 2008 - 2014 Red Hat, Inc.
  */
 
 #ifdef HAVE_CONFIG_H
@@ -27,22 +27,12 @@
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 
-#include <nm-device.h>
-#include <nm-setting-connection.h>
-#include <nm-setting-cdma.h>
-#include <nm-setting-serial.h>
-#include <nm-setting-ppp.h>
-#include <nm-device-modem.h>
-#include <nm-utils.h>
-#include <nm-secret-agent.h>
-
 #include "applet.h"
 #include "applet-device-cdma.h"
 #include "utils.h"
 #include "applet-dialogs.h"
-#include "nm-mobile-providers.h"
+#include "nma-mobile-providers.h"
 #include "mb-menu-item.h"
-#include "nm-ui-utils.h"
 #include "nm-glib-compat.h"
 
 typedef struct {
@@ -100,14 +90,19 @@ cdma_new_auto_connection (NMDevice *device,
 }
 
 static void
-dbus_3g_add_and_activate_cb (NMClient *client,
-                             NMActiveConnection *active,
-                             const char *connection_path,
-                             GError *error,
+dbus_3g_add_and_activate_cb (GObject *client,
+                             GAsyncResult *result,
                              gpointer user_data)
 {
+       GError *error = NULL;
+       NMActiveConnection *active;
+
+       active = nm_client_add_and_activate_connection_finish (NM_CLIENT (client), result, &error);
        if (error)
                g_warning ("Failed to add/activate connection: (%d) %s", error->code, error->message);
+
+       g_clear_object (&active);
+       g_clear_error (&error);
 }
 
 typedef struct {
@@ -129,12 +124,13 @@ dbus_connect_3g_cb (NMConnection *connection,
                /* Ask NM to add the new connection and activate it; NM will fill in the
                 * missing details based on the specific object and the device.
                 */
-               nm_client_add_and_activate_connection (info->applet->nm_client,
-                                                      connection,
-                                                      info->device,
-                                                      "/",
-                                                      dbus_3g_add_and_activate_cb,
-                                                      info->applet);
+               nm_client_add_and_activate_connection_async (info->applet->nm_client,
+                                                            connection,
+                                                            info->device,
+                                                            "/",
+                                                            NULL,
+                                                            dbus_3g_add_and_activate_cb,
+                                                            info->applet);
        }
 
        g_object_unref (info->device);
@@ -227,7 +223,7 @@ cdma_act_to_mb_act (CdmaDeviceInfo *info)
 static void
 cdma_add_menu_item (NMDevice *device,
                     gboolean multiple_devices,
-                    GSList *connections,
+                    const GPtrArray *connections,
                     NMConnection *active,
                     GtkWidget *menu,
                     NMApplet *applet)
@@ -235,14 +231,14 @@ cdma_add_menu_item (NMDevice *device,
        CdmaDeviceInfo *info;
        char *text;
        GtkWidget *item;
-       GSList *iter;
+       int i;
 
        info = g_object_get_data (G_OBJECT (device), "devinfo");
 
        if (multiple_devices) {
                const char *desc;
 
-               desc = nma_utils_get_device_description (device);
+               desc = nm_device_get_description (device);
                text = g_strdup_printf (_("Mobile Broadband (%s)"), desc);
        } else {
                text = g_strdup (_("Mobile Broadband"));
@@ -296,12 +292,12 @@ cdma_add_menu_item (NMDevice *device,
 
        /* Add the default / inactive connection items */
        if (!nma_menu_device_check_unusable (device)) {
-               if ((!active && g_slist_length (connections)) || (active && g_slist_length (connections) > 1))
+               if ((!active && connections->len) || (active && connections->len > 1))
                        applet_menu_item_add_complex_separator_helper (menu, applet, _("Available"), -1);
 
-               if (g_slist_length (connections)) {
-                       for (iter = connections; iter; iter = g_slist_next (iter)) {
-                               NMConnection *connection = NM_CONNECTION (iter->data);
+               if (connections->len) {
+                       for (i = 0; i < connections->len; i++) {
+                               NMConnection *connection = NM_CONNECTION (connections->pdata[i]);
 
                                if (connection != active) {
                                        item = applet_new_menu_item_helper (connection, NULL, FALSE);
diff --git a/src/applet-device-ethernet.c b/src/applet-device-ethernet.c
index 6e1c5a3..08f5ea1 100644
--- a/src/applet-device-ethernet.c
+++ b/src/applet-device-ethernet.c
@@ -17,8 +17,8 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * (C) Copyright 2008 - 2012 Red Hat, Inc.
- * (C) Copyright 2008 Novell, Inc.
+ * Copyright 2008 - 2014 Red Hat, Inc.
+ * Copyright 2008 Novell, Inc.
  */
 
 #ifdef HAVE_CONFIG_H
@@ -28,18 +28,9 @@
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 
-#include <nm-device.h>
-#include <nm-setting-connection.h>
-#include <nm-setting-wired.h>
-#include <nm-setting-8021x.h>
-#include <nm-setting-pppoe.h>
-#include <nm-device-ethernet.h>
-#include <nm-utils.h>
-
 #include "applet.h"
 #include "applet-device-ethernet.h"
 #include "ethernet-dialog.h"
-#include "nm-ui-utils.h"
 
 #define DEFAULT_ETHERNET_NAME _("Auto Ethernet")
 
@@ -54,7 +45,7 @@ ethernet_new_auto_connection (NMDevice *device,
        NMSettingConnection *s_con;
        char *uuid;
 
-       connection = nm_connection_new ();
+       connection = nm_simple_connection_new ();
 
        s_wired = NM_SETTING_WIRED (nm_setting_wired_new ());
        nm_connection_add_setting (connection, NM_SETTING (s_wired));
@@ -78,7 +69,7 @@ ethernet_new_auto_connection (NMDevice *device,
 static void
 ethernet_add_menu_item (NMDevice *device,
                         gboolean multiple_devices,
-                        GSList *connections,
+                        const GPtrArray *connections,
                         NMConnection *active,
                         GtkWidget *menu,
                         NMApplet *applet)
@@ -90,14 +81,14 @@ ethernet_add_menu_item (NMDevice *device,
        if (multiple_devices) {
                const char *desc;
 
-               desc = nma_utils_get_device_description (device);
+               desc = nm_device_get_description (device);
 
-               if (g_slist_length (connections) > 1)
+               if (connections->len > 1)
                        text = g_strdup_printf (_("Ethernet Networks (%s)"), desc);
                else
                        text = g_strdup_printf (_("Ethernet Network (%s)"), desc);
        } else {
-               if (g_slist_length (connections) > 1)
+               if (connections->len > 1)
                        text = g_strdup (_("Ethernet Networks"));
                else
                        text = g_strdup (_("Ethernet Network"));
@@ -116,7 +107,7 @@ ethernet_add_menu_item (NMDevice *device,
        gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
        gtk_widget_show (item);
 
-       if (g_slist_length (connections))
+       if (connections->len)
                applet_add_connection_items (device, connections, carrier, active, NMA_ADD_ACTIVE, menu, 
applet);
 
        /* Notify user of unmanaged or unavailable device */
@@ -127,10 +118,10 @@ ethernet_add_menu_item (NMDevice *device,
        }
 
        if (!nma_menu_device_check_unusable (device)) {
-               if ((!active && g_slist_length (connections)) || (active && g_slist_length (connections) > 1))
+               if ((!active && connections->len) || (active && connections->len > 1))
                        applet_menu_item_add_complex_separator_helper (menu, applet, _("Available"), -1);
 
-               if (g_slist_length (connections))
+               if (connections->len)
                        applet_add_connection_items (device, connections, carrier, active, NMA_ADD_INACTIVE, 
menu, applet);
                else
                        applet_add_default_connection_item (device, DEFAULT_ETHERNET_NAME, carrier, menu, 
applet);
@@ -223,7 +214,7 @@ pppoe_verify (GtkEditable *editable, gpointer user_data)
 }
 
 static void
-pppoe_update_setting (NMSettingPPPOE *pppoe, NMPppoeInfo *info)
+pppoe_update_setting (NMSettingPppoe *pppoe, NMPppoeInfo *info)
 {
        const char *s;
 
@@ -232,16 +223,16 @@ pppoe_update_setting (NMSettingPPPOE *pppoe, NMPppoeInfo *info)
                s = NULL;
 
        g_object_set (pppoe,
-                                 NM_SETTING_PPPOE_USERNAME, gtk_entry_get_text (info->username_entry),
-                                 NM_SETTING_PPPOE_PASSWORD, gtk_entry_get_text (info->password_entry),
-                                 NM_SETTING_PPPOE_SERVICE, s,
-                                 NULL);
+                     NM_SETTING_PPPOE_USERNAME, gtk_entry_get_text (info->username_entry),
+                     NM_SETTING_PPPOE_PASSWORD, gtk_entry_get_text (info->password_entry),
+                     NM_SETTING_PPPOE_SERVICE, s,
+                     NULL);
 }
 
 static void
 pppoe_update_ui (NMConnection *connection, NMPppoeInfo *info)
 {
-       NMSettingPPPOE *s_pppoe;
+       NMSettingPppoe *s_pppoe;
        const char *s;
 
        g_return_if_fail (NM_IS_CONNECTION (connection));
@@ -279,9 +270,8 @@ get_pppoe_secrets_cb (GtkDialog *dialog, gint response, gpointer user_data)
 {
        SecretsRequest *req = user_data;
        NMPppoeInfo *info = (NMPppoeInfo *) req;
-       NMSettingPPPOE *setting;
-       GHashTable *settings = NULL;
-       GHashTable *secrets;
+       NMSettingPppoe *setting;
+       GVariant *secrets = NULL;
        GError *error = NULL;
 
        if (response != GTK_RESPONSE_OK) {
@@ -296,27 +286,21 @@ get_pppoe_secrets_cb (GtkDialog *dialog, gint response, gpointer user_data)
        setting = nm_connection_get_setting_pppoe (req->connection);
        pppoe_update_setting (setting, info);
 
-       secrets = nm_setting_to_hash (NM_SETTING (setting), NM_SETTING_HASH_FLAG_ONLY_SECRETS);
+       secrets = nm_connection_to_dbus (req->connection, NM_CONNECTION_SERIALIZE_ONLY_SECRETS);
        if (!secrets) {
                g_set_error (&error,
                             NM_SECRET_AGENT_ERROR,
-                            NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+                            NM_SECRET_AGENT_ERROR_FAILED,
                                         "%s.%d (%s): failed to hash setting " NM_SETTING_PPPOE_SETTING_NAME,
                                         __FILE__, __LINE__, __func__);
-       } else {
-               /* Returned secrets are a{sa{sv}}; this is the outer a{s...} hash that
-                * will contain all the individual settings hashes.
-                */
-               settings = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, (GDestroyNotify) 
g_hash_table_destroy);
-               g_hash_table_insert (settings, NM_SETTING_PPPOE_SETTING_NAME, secrets);
        }
 
 done:
-       applet_secrets_request_complete (req, settings, error);
+       applet_secrets_request_complete (req, secrets, error);
        applet_secrets_request_free (req);
 
-       if (settings)
-               g_hash_table_destroy (settings);
+       if (secrets)
+               g_variant_unref (secrets);
 }
 
 static void
@@ -343,7 +327,7 @@ pppoe_get_secrets (SecretsRequest *req, GError **error)
        if (!gtk_builder_add_from_file (builder, UIDIR "/ce-page-dsl.ui", &tmp_error)) {
                g_set_error (error,
                             NM_SECRET_AGENT_ERROR,
-                            NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+                            NM_SECRET_AGENT_ERROR_FAILED,
                                         "%s.%d (%s): couldn't display secrets UI: %s",
                             __FILE__, __LINE__, __func__, tmp_error->message);
                g_error_free (tmp_error);
@@ -427,7 +411,7 @@ get_8021x_secrets_cb (GtkDialog *dialog, gint response, gpointer user_data)
        if (!connection) {
                g_set_error (&error,
                             NM_SECRET_AGENT_ERROR,
-                            NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+                            NM_SECRET_AGENT_ERROR_FAILED,
                             "%s.%d (%s): couldn't get connection from ethernet dialog.",
                             __FILE__, __LINE__, __func__);
                goto done;
@@ -439,7 +423,7 @@ get_8021x_secrets_cb (GtkDialog *dialog, gint response, gpointer user_data)
        } else {
                g_set_error (&error,
                             NM_SECRET_AGENT_ERROR,
-                            NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+                            NM_SECRET_AGENT_ERROR_FAILED,
                                         "%s.%d (%s): requested setting '802-1x' didn't"
                                         " exist in the connection.",
                                         __FILE__, __LINE__, __func__);
@@ -462,7 +446,7 @@ nm_8021x_get_secrets (SecretsRequest *req, GError **error)
        if (!info->dialog) {
                g_set_error (error,
                             NM_SECRET_AGENT_ERROR,
-                            NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+                            NM_SECRET_AGENT_ERROR_FAILED,
                             "%s.%d (%s): couldn't display secrets UI",
                             __FILE__, __LINE__, __func__);
                return FALSE;
@@ -501,7 +485,7 @@ ethernet_get_secrets (SecretsRequest *req, GError **error)
        else {
                g_set_error (error,
                             NM_SECRET_AGENT_ERROR,
-                            NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+                            NM_SECRET_AGENT_ERROR_FAILED,
                             "%s.%d (%s): unhandled ethernet connection type '%s'",
                             __FILE__, __LINE__, __func__, ctype);
        }
diff --git a/src/applet-device-gsm.c b/src/applet-device-gsm.c
index d5493fd..89af18b 100644
--- a/src/applet-device-gsm.c
+++ b/src/applet-device-gsm.c
@@ -17,8 +17,8 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * (C) Copyright 2008 - 2012 Red Hat, Inc.
- * (C) Copyright 2008 Novell, Inc.
+ * Copyright 2008 - 2014 Red Hat, Inc.
+ * Copyright 2008 Novell, Inc.
  */
 
 #ifdef HAVE_CONFIG_H
@@ -32,22 +32,12 @@
 #define SECRET_API_SUBJECT_TO_CHANGE
 #include <libsecret/secret.h>
 
-#include <nm-device.h>
-#include <nm-setting-connection.h>
-#include <nm-setting-gsm.h>
-#include <nm-setting-serial.h>
-#include <nm-setting-ppp.h>
-#include <nm-device-modem.h>
-#include <nm-utils.h>
-#include <nm-secret-agent.h>
-
 #include "applet.h"
 #include "applet-device-gsm.h"
 #include "utils.h"
 #include "applet-dialogs.h"
 #include "mb-menu-item.h"
-#include "nm-mobile-providers.h"
-#include "nm-ui-utils.h"
+#include "nma-mobile-providers.h"
 #include "nm-glib-compat.h"
 
 typedef enum {
@@ -133,14 +123,18 @@ gsm_new_auto_connection (NMDevice *device,
 }
 
 static void
-dbus_3g_add_and_activate_cb (NMClient *client,
-                             NMActiveConnection *active,
-                             const char *connection_path,
-                             GError *error,
+dbus_3g_add_and_activate_cb (GObject *client,
+                             GAsyncResult *result,
                              gpointer user_data)
 {
+       GError *error = NULL;
+       NMActiveConnection *active;
+
+       active = nm_client_add_and_activate_connection_finish (NM_CLIENT (client), result, &error);
        if (error)
                g_warning ("Failed to add/activate connection: (%d) %s", error->code, error->message);
+       g_clear_object (&active);
+       g_clear_error (&error);
 }
 
 typedef struct {
@@ -162,12 +156,13 @@ dbus_connect_3g_cb (NMConnection *connection,
                /* Ask NM to add the new connection and activate it; NM will fill in the
                 * missing details based on the specific object and the device.
                 */
-               nm_client_add_and_activate_connection (info->applet->nm_client,
-                                                      connection,
-                                                      info->device,
-                                                      "/",
-                                                      dbus_3g_add_and_activate_cb,
-                                                      info->applet);
+               nm_client_add_and_activate_connection_async (info->applet->nm_client,
+                                                            connection,
+                                                            info->device,
+                                                            "/",
+                                                            NULL,
+                                                            dbus_3g_add_and_activate_cb,
+                                                            info->applet);
        }
 
        g_object_unref (info->device);
@@ -283,7 +278,7 @@ gsm_act_to_mb_act (GsmDeviceInfo *info)
 static void
 gsm_add_menu_item (NMDevice *device,
                    gboolean multiple_devices,
-                   GSList *connections,
+                   const GPtrArray *connections,
                    NMConnection *active,
                    GtkWidget *menu,
                    NMApplet *applet)
@@ -291,14 +286,14 @@ gsm_add_menu_item (NMDevice *device,
        GsmDeviceInfo *info;
        char *text;
        GtkWidget *item;
-       GSList *iter;
+       int i;
 
        info = g_object_get_data (G_OBJECT (device), "devinfo");
 
        if (multiple_devices) {
                const char *desc;
 
-               desc = nma_utils_get_device_description (device);
+               desc = nm_device_get_description (device);
                text = g_strdup_printf (_("Mobile Broadband (%s)"), desc);
        } else {
                text = g_strdup (_("Mobile Broadband"));
@@ -352,12 +347,12 @@ gsm_add_menu_item (NMDevice *device,
 
        /* Add the default / inactive connection items */
        if (!nma_menu_device_check_unusable (device)) {
-               if ((!active && g_slist_length (connections)) || (active && g_slist_length (connections) > 1))
+               if ((!active && connections->len) || (active && connections->len > 1))
                        applet_menu_item_add_complex_separator_helper (menu, applet, _("Available"), -1);
 
-               if (g_slist_length (connections)) {
-                       for (iter = connections; iter; iter = g_slist_next (iter)) {
-                               NMConnection *connection = NM_CONNECTION (iter->data);
+               if (connections->len) {
+                       for (i = 0; i < connections->len; i++) {
+                               NMConnection *connection = NM_CONNECTION (connections->pdata[i]);
 
                                if (connection != active) {
                                        item = applet_new_menu_item_helper (connection, NULL, FALSE);
@@ -434,7 +429,7 @@ gsm_get_secrets (SecretsRequest *req, GError **error)
        if (!device) {
                g_set_error (error,
                             NM_SECRET_AGENT_ERROR,
-                            NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+                            NM_SECRET_AGENT_ERROR_FAILED,
                             "%s.%d (%s): failed to find device for active connection.",
                             __FILE__, __LINE__, __func__);
                return FALSE;
@@ -578,7 +573,7 @@ unlock_dialog_new (NMDevice *device, GsmDeviceInfo *info)
                return;
 
        info->dialog = applet_mobile_pin_dialog_new (info->unlock_required,
-                                                    nma_utils_get_device_description (device));
+                                                    nm_device_get_description (device));
 
        if (!strcmp (info->unlock_required, "sim-pin"))
                g_object_set_data (G_OBJECT (info->dialog), "unlock-code", GUINT_TO_POINTER 
(UNLOCK_CODE_PIN));
diff --git a/src/applet-device-infiniband.c b/src/applet-device-infiniband.c
index d72cb09..4b0be3c 100644
--- a/src/applet-device-infiniband.c
+++ b/src/applet-device-infiniband.c
@@ -17,7 +17,7 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * (C) Copyright 2013 Red Hat, Inc.
+ * Copyright 2013 - 2014 Red Hat, Inc.
  */
 
 #ifdef HAVE_CONFIG_H
@@ -27,15 +27,8 @@
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 
-#include <nm-device.h>
-#include <nm-setting-connection.h>
-#include <nm-setting-infiniband.h>
-#include <nm-device-infiniband.h>
-#include <nm-utils.h>
-
 #include "applet.h"
 #include "applet-device-infiniband.h"
-#include "nm-ui-utils.h"
 
 #define DEFAULT_INFINIBAND_NAME _("Auto InfiniBand")
 
@@ -50,7 +43,7 @@ infiniband_new_auto_connection (NMDevice *device,
        NMSettingConnection *s_con;
        char *uuid;
 
-       connection = nm_connection_new ();
+       connection = nm_simple_connection_new ();
 
        s_infiniband = NM_SETTING_INFINIBAND (nm_setting_infiniband_new ());
        nm_connection_add_setting (connection, NM_SETTING (s_infiniband));
@@ -74,7 +67,7 @@ infiniband_new_auto_connection (NMDevice *device,
 static void
 infiniband_add_menu_item (NMDevice *device,
                           gboolean multiple_devices,
-                          GSList *connections,
+                          const GPtrArray *connections,
                           NMConnection *active,
                           GtkWidget *menu,
                           NMApplet *applet)
@@ -86,14 +79,14 @@ infiniband_add_menu_item (NMDevice *device,
        if (multiple_devices) {
                const char *desc;
 
-               desc = nma_utils_get_device_description (device);
+               desc = nm_device_get_description (device);
 
-               if (g_slist_length (connections) > 1)
+               if (connections->len > 1)
                        text = g_strdup_printf (_("InfiniBand Networks (%s)"), desc);
                else
                        text = g_strdup_printf (_("InfiniBand Network (%s)"), desc);
        } else {
-               if (g_slist_length (connections) > 1)
+               if (connections->len > 1)
                        text = g_strdup (_("InfiniBand Networks"));
                else
                        text = g_strdup (_("InfiniBand Network"));
@@ -112,7 +105,7 @@ infiniband_add_menu_item (NMDevice *device,
        gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
        gtk_widget_show (item);
 
-       if (g_slist_length (connections))
+       if (connections->len)
                applet_add_connection_items (device, connections, carrier, active, NMA_ADD_ACTIVE, menu, 
applet);
 
        /* Notify user of unmanaged or unavailable device */
@@ -123,10 +116,10 @@ infiniband_add_menu_item (NMDevice *device,
        }
 
        if (!nma_menu_device_check_unusable (device)) {
-               if ((!active && g_slist_length (connections)) || (active && g_slist_length (connections) > 1))
+               if ((!active && connections->len) || (active && connections->len > 1))
                        applet_menu_item_add_complex_separator_helper (menu, applet, _("Available"), -1);
 
-               if (g_slist_length (connections))
+               if (connections->len)
                        applet_add_connection_items (device, connections, carrier, active, NMA_ADD_INACTIVE, 
menu, applet);
                else
                        applet_add_default_connection_item (device, DEFAULT_INFINIBAND_NAME, carrier, menu, 
applet);
diff --git a/src/applet-device-team.c b/src/applet-device-team.c
index 9c03784..c00f364 100644
--- a/src/applet-device-team.c
+++ b/src/applet-device-team.c
@@ -1,7 +1,5 @@
 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
 /*
- * Copyright (C) 2013 Jiri Pirko <jiri resnulli us>
- *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
@@ -15,6 +13,9 @@
  * You should have received a copy of the GNU General Public License along
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright 2013 Jiri Pirko <jiri resnulli us>
+ * Copyright 2013 - 2014 Red Hat, Inc.
  */
 
 #ifdef HAVE_CONFIG_H
@@ -24,22 +25,14 @@
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 
-#include <nm-device.h>
-#include <nm-setting-connection.h>
-#include <nm-setting-wired.h>
-#include <nm-setting-team.h>
-#include <nm-device-team.h>
-#include <nm-utils.h>
-
 #include "applet.h"
 #include "applet-device-team.h"
 #include "utils.h"
-#include "nm-ui-utils.h"
 
 static void
 team_add_menu_item (NMDevice *device,
                     gboolean multiple_devices,
-                    GSList *connections,
+                    const GPtrArray *connections,
                     NMConnection *active,
                     GtkWidget *menu,
                     NMApplet *applet)
@@ -47,7 +40,7 @@ team_add_menu_item (NMDevice *device,
        char *text;
        GtkWidget *item;
 
-       text = nma_utils_get_connection_device_name (connections->data);
+       text = nm_connection_get_virtual_device_description (connections->pdata[0]);
        item = applet_menu_item_create_device_item_helper (device, applet, text);
        g_free (text);
 
@@ -55,8 +48,7 @@ team_add_menu_item (NMDevice *device,
        gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
        gtk_widget_show (item);
 
-       if (g_slist_length (connections))
-               applet_add_connection_items (device, connections, TRUE, active, NMA_ADD_ACTIVE, menu, applet);
+       applet_add_connection_items (device, connections, TRUE, active, NMA_ADD_ACTIVE, menu, applet);
 
        /* Notify user of unmanaged or unavailable device */
        if (device) {
@@ -68,11 +60,10 @@ team_add_menu_item (NMDevice *device,
        }
 
        if (!device || !nma_menu_device_check_unusable (device)) {
-               if ((!active && g_slist_length (connections)) || (active && g_slist_length (connections) > 1))
+               if (!active || connections->len > 1)
                        applet_menu_item_add_complex_separator_helper (menu, applet, _("Available"), -1);
 
-               if (g_slist_length (connections))
-                       applet_add_connection_items (device, connections, TRUE, active, NMA_ADD_INACTIVE, 
menu, applet);
+               applet_add_connection_items (device, connections, TRUE, active, NMA_ADD_INACTIVE, menu, 
applet);
        }
 }
 
diff --git a/src/applet-device-vlan.c b/src/applet-device-vlan.c
index 204230c..4fb588d 100644
--- a/src/applet-device-vlan.c
+++ b/src/applet-device-vlan.c
@@ -17,8 +17,8 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * (C) Copyright 2008 Red Hat, Inc.
- * (C) Copyright 2008 Novell, Inc.
+ * Copyright 2008 - 2014 Red Hat, Inc.
+ * Copyright 2008 Novell, Inc.
  */
 
 #ifdef HAVE_CONFIG_H
@@ -28,17 +28,8 @@
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 
-#include <nm-device.h>
-#include <nm-setting-connection.h>
-#include <nm-setting-wired.h>
-#include <nm-setting-vlan.h>
-#include <nm-device-ethernet.h>
-#include <nm-device-vlan.h>
-#include <nm-utils.h>
-
 #include "applet.h"
 #include "applet-device-vlan.h"
-#include "nm-ui-utils.h"
 
 static NMDevice *
 find_device_by_iface (const char *iface, const GPtrArray *devices)
@@ -62,7 +53,7 @@ find_device_by_mac (const GByteArray *mac, const GPtrArray *devices)
        char *vlan_hw_address, *candidate_hw_address;
        int i;
 
-       vlan_hw_address = nm_utils_hwaddr_ntoa_len (mac->data, mac->len);
+       vlan_hw_address = nm_utils_hwaddr_ntoa (mac->data, mac->len);
 
        for (i = 0; i < devices->len && device == NULL; i++) {
                candidate = devices->pdata[i];
@@ -84,18 +75,18 @@ find_device_by_mac (const GByteArray *mac, const GPtrArray *devices)
 }
 
 static NMDevice *
-find_vlan_parent (GSList *connections, NMApplet *applet)
+find_vlan_parent (const GPtrArray *connections, NMApplet *applet)
 {
        const GPtrArray *devices;
        NMDevice *parent_device;
-       GSList *iter;
+       int i;
 
        devices = nm_client_get_devices (applet->nm_client);
        if (!devices)
                return NULL;
 
-       for (iter = connections; iter; iter = iter->next) {
-               NMConnection *connection = iter->data;
+       for (i = 0; i < connections->len; i++) {
+               NMConnection *connection = connections->pdata[i];
                NMSettingVlan *s_vlan;
                const char *parent;
 
@@ -143,7 +134,7 @@ find_vlan_parent (GSList *connections, NMApplet *applet)
 static void
 vlan_add_menu_item (NMDevice *device,
                     gboolean multiple_devices,
-                    GSList *connections,
+                    const GPtrArray *connections,
                     NMConnection *active,
                     GtkWidget *menu,
                     NMApplet *applet)
@@ -152,7 +143,7 @@ vlan_add_menu_item (NMDevice *device,
        GtkWidget *item;
        gboolean carrier = TRUE;
 
-       text = nma_utils_get_connection_device_name (connections->data);
+       text = nm_connection_get_virtual_device_description (connections->pdata[0]);
        item = applet_menu_item_create_device_item_helper (device, applet, text);
        g_free (text);
 
@@ -173,8 +164,7 @@ vlan_add_menu_item (NMDevice *device,
        gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
        gtk_widget_show (item);
 
-       if (g_slist_length (connections))
-               applet_add_connection_items (device, connections, carrier, active, NMA_ADD_ACTIVE, menu, 
applet);
+       applet_add_connection_items (device, connections, carrier, active, NMA_ADD_ACTIVE, menu, applet);
 
        /* Notify user of unmanaged or unavailable device */
        if (device) {
@@ -186,10 +176,10 @@ vlan_add_menu_item (NMDevice *device,
        }
 
        if (!device || !nma_menu_device_check_unusable (device)) {
-               if ((!active && g_slist_length (connections)) || (active && g_slist_length (connections) > 1))
+               if (!active || connections->len > 1)
                        applet_menu_item_add_complex_separator_helper (menu, applet, _("Available"), -1);
 
-               if (g_slist_length (connections))
+               if (connections->len)
                        applet_add_connection_items (device, connections, carrier, active, NMA_ADD_INACTIVE, 
menu, applet);
        }
 }
diff --git a/src/applet-device-wifi.c b/src/applet-device-wifi.c
index e8ff46f..e61ef2f 100644
--- a/src/applet-device-wifi.c
+++ b/src/applet-device-wifi.c
@@ -17,7 +17,7 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * (C) Copyright 2008 - 2012 Red Hat, Inc.
+ * Copyright 2008 - 2014 Red Hat, Inc.
  */
 
 #ifdef HAVE_CONFIG_H
@@ -32,21 +32,11 @@
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 
-#include <nm-device.h>
-#include <nm-access-point.h>
-#include <nm-setting-connection.h>
-#include <nm-setting-wireless.h>
-#include <nm-device-wifi.h>
-#include <nm-setting-8021x.h>
-#include <nm-utils.h>
-#include <nm-secret-agent.h>
-
 #include "applet.h"
 #include "applet-device-wifi.h"
 #include "ap-menu-item.h"
 #include "utils.h"
-#include "nm-wifi-dialog.h"
-#include "nm-ui-utils.h"
+#include "nma-wifi-dialog.h"
 
 #define ACTIVE_AP_TAG "active-ap"
 
@@ -76,7 +66,7 @@ applet_wifi_connect_to_hidden_network (NMApplet *applet)
 {
        GtkWidget *dialog;
 
-       dialog = nma_wifi_dialog_new_for_hidden (applet->nm_client, applet->settings);
+       dialog = nma_wifi_dialog_new_for_hidden (applet->nm_client);
        if (dialog) {
                g_signal_connect (dialog, "response",
                                  G_CALLBACK (wifi_dialog_response_cb),
@@ -127,7 +117,7 @@ applet_wifi_create_wifi_network (NMApplet *applet)
 {
        GtkWidget *dialog;
 
-       dialog = nma_wifi_dialog_new_for_create (applet->nm_client, applet->settings);
+       dialog = nma_wifi_dialog_new_for_create (applet->nm_client);
        if (dialog) {
                g_signal_connect (dialog, "response",
                                  G_CALLBACK (wifi_dialog_response_cb),
@@ -158,14 +148,19 @@ nma_menu_add_create_network_item (GtkWidget *menu, NMApplet *applet)
 }
 
 static void
-dbus_8021x_add_and_activate_cb (NMClient *client,
-                                NMActiveConnection *active,
-                                const char *connection_path,
-                                GError *error,
+dbus_8021x_add_and_activate_cb (GObject *client,
+                                GAsyncResult *result,
                                 gpointer user_data)
 {
+       GError *error = NULL;
+       NMActiveConnection *active;
+
+       active = nm_client_add_and_activate_connection_finish (NM_CLIENT (client), result, &error);
        if (error)
                g_warning ("Failed to add/activate connection: (%d) %s", error->code, error->message);
+
+       g_clear_object (&active);
+       g_clear_error (&error);
 }
 
 typedef struct {
@@ -188,12 +183,13 @@ dbus_connect_8021x_cb (NMConnection *connection,
                /* Ask NM to add the new connection and activate it; NM will fill in the
                 * missing details based on the specific object and the device.
                 */
-               nm_client_add_and_activate_connection (info->applet->nm_client,
-                                                          connection,
-                                                          info->device,
-                                                          nm_object_get_path (NM_OBJECT (info->ap)),
-                                                          dbus_8021x_add_and_activate_cb,
-                                                          info->applet);
+               nm_client_add_and_activate_connection_async (info->applet->nm_client,
+                                                            connection,
+                                                            info->device,
+                                                            nm_object_get_path (NM_OBJECT (info->ap)),
+                                                            NULL,
+                                                            dbus_8021x_add_and_activate_cb,
+                                                            info->applet);
        }
 
        g_object_unref (info->device);
@@ -258,11 +254,11 @@ static const char *manf_default_ssids[] = {
 };
 
 static gboolean
-is_ssid_in_list (const GByteArray *ssid, const char **list)
+is_ssid_in_list (GBytes *ssid, const char **list)
 {
        while (*list) {
-               if (ssid->len == strlen (*list)) {
-                       if (!memcmp (*list, ssid->data, ssid->len))
+               if (g_bytes_get_size (ssid) == strlen (*list)) {
+                       if (!memcmp (*list, g_bytes_get_data (ssid, NULL), g_bytes_get_size (ssid)))
                                return TRUE;
                }
                list++;
@@ -271,7 +267,7 @@ is_ssid_in_list (const GByteArray *ssid, const char **list)
 }
 
 static gboolean
-is_manufacturer_default_ssid (const GByteArray *ssid)
+is_manufacturer_default_ssid (GBytes *ssid)
 {
        return is_ssid_in_list (ssid, manf_default_ssids);
 }
@@ -280,12 +276,12 @@ static char *
 get_ssid_utf8 (NMAccessPoint *ap)
 {
        char *ssid_utf8 = NULL;
-       const GByteArray *ssid;
+       GBytes *ssid;
 
        if (ap) {
                ssid = nm_access_point_get_ssid (ap);
                if (ssid)
-                       ssid_utf8 = nm_utils_ssid_to_utf8 (ssid);
+                       ssid_utf8 = nm_utils_ssid_to_utf8 (g_bytes_get_data (ssid, NULL), g_bytes_get_size 
(ssid));
        }
        if (!ssid_utf8)
                ssid_utf8 = g_strdup (_("(none)"));
@@ -301,7 +297,7 @@ static const char *blacklisted_ssids[] = {
 };
 
 static gboolean
-is_blacklisted_ssid (const GByteArray *ssid)
+is_blacklisted_ssid (GBytes *ssid)
 {
        return is_ssid_in_list (ssid, blacklisted_ssids);
 }
@@ -385,7 +381,7 @@ _do_new_auto_connection (NMApplet *applet,
        NMSettingWireless *s_wifi = NULL;
        NMSettingWirelessSecurity *s_wsec = NULL;
        NMSetting8021x *s_8021x = NULL;
-       const GByteArray *ssid;
+       GBytes *ssid;
        NM80211ApSecurityFlags wpa_flags, rsn_flags;
        GtkWidget *dialog;
        MoreInfo *more_info;
@@ -395,7 +391,7 @@ _do_new_auto_connection (NMApplet *applet,
        g_assert (device);
        g_assert (ap);
 
-       connection = nm_connection_new ();
+       connection = nm_simple_connection_new ();
 
        ssid = nm_access_point_get_ssid (ap);
        if (   (nm_access_point_get_mode (ap) == NM_802_11_MODE_INFRA)
@@ -451,7 +447,7 @@ _do_new_auto_connection (NMApplet *applet,
                more_info->callback = callback;
                more_info->callback_data = callback_data;
 
-               dialog = nma_wifi_dialog_new (applet->nm_client, applet->settings, connection, device, ap, 
FALSE);
+               dialog = nma_wifi_dialog_new (applet->nm_client, connection, device, ap, FALSE);
                if (dialog) {
                        g_signal_connect (dialog, "response",
                                              G_CALLBACK (more_info_wifi_dialog_response_cb),
@@ -529,28 +525,27 @@ static NMNetworkMenuItem *
 create_new_ap_item (NMDeviceWifi *device,
                     NMAccessPoint *ap,
                     struct dup_data *dup_data,
-                    GSList *connections,
+                    const GPtrArray *connections,
                     NMApplet *applet)
 {
        WifiMenuItemInfo *info;
-       GSList *iter;
+       int i;
        NMNetworkMenuItem *item = NULL;
-       GSList *dev_connections = NULL;
-       GSList *ap_connections = NULL;
-       const GByteArray *ssid;
+       GPtrArray *dev_connections;
+       GPtrArray *ap_connections;
+       GBytes *ssid;
        guint32 dev_caps;
 
        dev_connections = nm_device_filter_connections (NM_DEVICE (device), connections);
        ap_connections = nm_access_point_filter_connections (ap, dev_connections);
-       g_slist_free (dev_connections);
-       dev_connections = NULL;
+       g_ptr_array_unref (dev_connections);
 
        item = NM_NETWORK_MENU_ITEM (nm_network_menu_item_new (dup_data->hash,
-                                                              !!g_slist_length (ap_connections)));
+                                                              ap_connections->len != 0));
        gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM (item), TRUE);
 
        ssid = nm_access_point_get_ssid (ap);
-       nm_network_menu_item_set_ssid (item, (GByteArray *) ssid);
+       nm_network_menu_item_set_ssid (item, ssid);
 
        dev_caps = nm_device_wifi_get_capabilities (device);
        nma_icon_check_and_load ("nm-adhoc", &applet->adhoc_icon, applet);
@@ -561,13 +556,13 @@ create_new_ap_item (NMDeviceWifi *device,
        g_object_set_data (G_OBJECT (item), "device", NM_DEVICE (device));
 
        /* If there's only one connection, don't show the submenu */
-       if (g_slist_length (ap_connections) > 1) {
+       if (ap_connections->len > 1) {
                GtkWidget *submenu;
 
                submenu = gtk_menu_new ();
 
-               for (iter = ap_connections; iter; iter = g_slist_next (iter)) {
-                       NMConnection *connection = NM_CONNECTION (iter->data);
+               for (i = 0; i < ap_connections->len; i++) {
+                       NMConnection *connection = NM_CONNECTION (ap_connections->pdata[i]);
                        NMSettingConnection *s_con;
                        GtkWidget *subitem;
 
@@ -597,9 +592,9 @@ create_new_ap_item (NMDeviceWifi *device,
                info->device = g_object_ref (G_OBJECT (device));
                info->ap = g_object_ref (G_OBJECT (ap));
 
-               if (g_slist_length (ap_connections) == 1) {
-                       connection = NM_CONNECTION (g_slist_nth_data (ap_connections, 0));
-                       info->connection = g_object_ref (G_OBJECT (connection));
+               if (ap_connections->len == 1) {
+                       connection = NM_CONNECTION (ap_connections->pdata[0]);
+                       info->connection = g_object_ref (connection);
                }
 
                g_signal_connect_data (GTK_WIDGET (item),
@@ -610,24 +605,24 @@ create_new_ap_item (NMDeviceWifi *device,
                                       0);
        }
 
-       g_slist_free (ap_connections);
+       g_ptr_array_unref (ap_connections);
        return item;
 }
 
 static NMNetworkMenuItem *
 get_menu_item_for_ap (NMDeviceWifi *device,
                       NMAccessPoint *ap,
-                      GSList *connections,
+                      const GPtrArray *connections,
                       GSList *menu_list,
                       NMApplet *applet)
 {
-       const GByteArray *ssid;
+       GBytes *ssid;
        struct dup_data dup_data = { NULL, NULL };
 
        /* Don't add BSSs that hide their SSID or are blacklisted */
        ssid = nm_access_point_get_ssid (ap);
        if (   !ssid
-           || nm_utils_is_empty_ssid (ssid->data, ssid->len)
+           || nm_utils_is_empty_ssid (g_bytes_get_data (ssid, NULL), g_bytes_get_size (ssid))
            || is_blacklisted_ssid (ssid))
                return NULL;
 
@@ -741,7 +736,7 @@ sort_toplevel (gconstpointer tmpa, gconstpointer tmpb)
 static void
 wifi_add_menu_item (NMDevice *device,
                     gboolean multiple_devices,
-                    GSList *connections,
+                    const GPtrArray *connections,
                     NMConnection *active,
                     GtkWidget *menu,
                     NMApplet *applet)
@@ -764,7 +759,7 @@ wifi_add_menu_item (NMDevice *device,
        if (multiple_devices) {
                const char *desc;
 
-               desc = nma_utils_get_device_description (device);
+               desc = nm_device_get_description (device);
                if (aps && aps->len > 1)
                        text = g_strdup_printf (_("Wi-Fi Networks (%s)"), desc);
                else
@@ -891,7 +886,7 @@ notify_active_ap_changed_cb (NMDeviceWifi *device,
        NMRemoteConnection *connection;
        NMSettingWireless *s_wireless;
        NMAccessPoint *new;
-       const GByteArray *ssid;
+       GBytes *ssid_ap, *ssid;
        NMDeviceState state;
 
        state = nm_device_get_state (NM_DEVICE (device));
@@ -908,8 +903,13 @@ notify_active_ap_changed_cb (NMDeviceWifi *device,
        if (!s_wireless)
                return;
 
-       ssid = nm_access_point_get_ssid (new);
-       if (!ssid || !nm_utils_same_ssid (nm_setting_wireless_get_ssid (s_wireless), ssid, TRUE))
+       ssid_ap = nm_access_point_get_ssid (new);
+       ssid = nm_setting_wireless_get_ssid (s_wireless);
+       if (   !ssid_ap
+           || !ssid
+           || !nm_utils_same_ssid (g_bytes_get_data (ssid, NULL), g_bytes_get_size (ssid),
+                                   g_bytes_get_data (ssid_ap, NULL), g_bytes_get_size (ssid_ap),
+                                   TRUE))
                return;
 
        applet_schedule_update_icon (applet);
@@ -983,8 +983,8 @@ idle_check_avail_access_point_notification (gpointer datap)
        NMDeviceWifi *device = data->device;
        int i;
        const GPtrArray *aps;
-       GSList *all_connections;
-       GSList *connections;
+       GPtrArray *all_connections;
+       GPtrArray *connections;
        GTimeVal timeval;
        gboolean have_unused_access_point = FALSE;
        gboolean have_no_autoconnect_points = TRUE;
@@ -1001,18 +1001,17 @@ idle_check_avail_access_point_notification (gpointer datap)
 
        all_connections = applet_get_all_connections (applet);
        connections = nm_device_filter_connections (NM_DEVICE (device), all_connections);
-       g_slist_free (all_connections); 
-       all_connections = NULL;
+       g_ptr_array_unref (all_connections);    
 
        aps = nm_device_wifi_get_access_points (device);
-       for (i = 0; aps && (i < aps->len); i++) {
+       for (i = 0; i < aps->len; i++) {
                NMAccessPoint *ap = aps->pdata[i];
-               GSList *ap_connections = nm_access_point_filter_connections (ap, connections);
-               GSList *iter;
+               GPtrArray *ap_connections = nm_access_point_filter_connections (ap, connections);
+               int a;
                gboolean is_autoconnect = FALSE;
 
-               for (iter = ap_connections; iter; iter = g_slist_next (iter)) {
-                       NMConnection *connection = NM_CONNECTION (iter->data);
+               for (a = 0; a < ap_connections->len; a++) {
+                       NMConnection *connection = NM_CONNECTION (ap_connections->pdata[a]);
                        NMSettingConnection *s_con;
 
                        s_con = nm_connection_get_setting_connection (connection);
@@ -1021,14 +1020,14 @@ idle_check_avail_access_point_notification (gpointer datap)
                                break;
                        }
                }
-               g_slist_free (ap_connections);
+               g_ptr_array_unref (ap_connections);
 
                if (!is_autoconnect)
                        have_unused_access_point = TRUE;
                else
                        have_no_autoconnect_points = FALSE;
        }
-       g_slist_free (connections);
+       g_ptr_array_unref (connections);
 
        if (!(have_unused_access_point && have_no_autoconnect_points))
                return FALSE;
@@ -1100,7 +1099,7 @@ access_point_removed_cb (NMDeviceWifi *device,
 }
 
 static void
-on_new_connection (NMRemoteSettings *settings,
+on_new_connection (NMClient *client,
                    NMRemoteConnection *connection,
                    gpointer datap)
 {
@@ -1112,13 +1111,13 @@ static void
 free_ap_notification_data (gpointer user_data)
 {
        struct ap_notification_data *data = user_data;
-       NMRemoteSettings *settings = applet_get_settings (data->applet);
+       NMClient *client = data->applet->nm_client;
 
        if (data->id)
                g_source_remove (data->id);
 
-       if (settings)
-               g_signal_handler_disconnect (settings, data->new_con_id);
+       if (client)
+               g_signal_handler_disconnect (client, data->new_con_id);
        memset (data, 0, sizeof (*data));
        g_free (data);
 }
@@ -1153,12 +1152,12 @@ wifi_device_added (NMDevice *device, NMApplet *applet)
        data = g_new0 (struct ap_notification_data, 1);
        data->applet = applet;
        data->device = wdev;
-       /* We also need to hook up to the settings to find out when we have new connections
+       /* We also need to hook up to the client to find out when we have new connections
         * that might be candididates.  Keep the ID around so we can disconnect
         * when the device is destroyed.
         */ 
-       id = g_signal_connect (applet_get_settings (applet),
-                              NM_REMOTE_SETTINGS_NEW_CONNECTION,
+       id = g_signal_connect (applet->nm_client,
+                              NM_CLIENT_CONNECTION_ADDED,
                               G_CALLBACK (on_new_connection),
                               data);
        data->new_con_id = id;
@@ -1317,11 +1316,15 @@ wifi_get_icon (NMDevice *device,
 
 
 static void
-activate_existing_cb (NMClient *client,
-                      NMActiveConnection *active,
-                      GError *error,
+activate_existing_cb (GObject *client,
+                      GAsyncResult *result,
                       gpointer user_data)
 {
+       GError *error = NULL;
+       NMActiveConnection *active;
+
+       active = nm_client_activate_connection_finish (NM_CLIENT (client), result, &error);
+       g_clear_object (&active);
        if (error) {
                const char *text = _("Failed to activate connection");
                char *err_text = g_strdup_printf ("(%d) %s", error->code,
@@ -1330,17 +1333,21 @@ activate_existing_cb (NMClient *client,
                g_warning ("%s: %s", text, err_text);
                utils_show_error_dialog (_("Connection failure"), text, err_text, FALSE, NULL);
                g_free (err_text);
+               g_error_free (error);
        }
        applet_schedule_update_icon (NM_APPLET (user_data));
 }
 
 static void
-activate_new_cb (NMClient *client,
-                 NMActiveConnection *active,
-                 const char *connection_path,
-                 GError *error,
+activate_new_cb (GObject *client,
+                 GAsyncResult *result,
                  gpointer user_data)
 {
+       GError *error = NULL;
+       NMActiveConnection *active;
+
+       active = nm_client_add_and_activate_connection_finish (NM_CLIENT (client), result, &error);
+       g_clear_object (&active);
        if (error) {
                const char *text = _("Failed to add new connection");
                char *err_text = g_strdup_printf ("(%d) %s", error->code,
@@ -1349,6 +1356,7 @@ activate_new_cb (NMClient *client,
                g_warning ("%s: %s", text, err_text);
                utils_show_error_dialog (_("Connection failure"), text, err_text, FALSE, NULL);
                g_free (err_text);
+               g_error_free (error);
        }
        applet_schedule_update_icon (NM_APPLET (user_data));
 }
@@ -1363,7 +1371,8 @@ wifi_dialog_response_cb (GtkDialog *foo,
        NMConnection *connection = NULL, *fuzzy_match = NULL;
        NMDevice *device = NULL;
        NMAccessPoint *ap = NULL;
-       GSList *all, *iter;
+       GPtrArray *all;
+       int i;
 
        if (response != GTK_RESPONSE_OK)
                goto done;
@@ -1377,23 +1386,24 @@ wifi_dialog_response_cb (GtkDialog *foo,
 
        /* Find a similar connection and use that instead */
        all = applet_get_all_connections (applet);
-       for (iter = all; iter; iter = g_slist_next (iter)) {
+       for (i = 0; i < all->len; i++) {
                if (nm_connection_compare (connection,
-                                          NM_CONNECTION (iter->data),
+                                          NM_CONNECTION (all->pdata[i]),
                                           (NM_SETTING_COMPARE_FLAG_FUZZY | 
NM_SETTING_COMPARE_FLAG_IGNORE_ID))) {
-                       fuzzy_match = NM_CONNECTION (iter->data);
+                       fuzzy_match = NM_CONNECTION (all->pdata[i]);
                        break;
                }
        }
-       g_slist_free (all);
+       g_ptr_array_unref (all);
 
        if (fuzzy_match) {
-               nm_client_activate_connection (applet->nm_client,
-                                              fuzzy_match,
-                                              device,
-                                              ap ? nm_object_get_path (NM_OBJECT (ap)) : NULL,
-                                              activate_existing_cb,
-                                              applet);
+               nm_client_activate_connection_async (applet->nm_client,
+                                                    fuzzy_match,
+                                                    device,
+                                                    ap ? nm_object_get_path (NM_OBJECT (ap)) : NULL,
+                                                    NULL,
+                                                    activate_existing_cb,
+                                                    applet);
        } else {
                NMSetting *s_con;
                NMSettingWireless *s_wifi = NULL;
@@ -1414,12 +1424,13 @@ wifi_dialog_response_cb (GtkDialog *foo,
                        g_object_set (G_OBJECT (s_con), NM_SETTING_CONNECTION_AUTOCONNECT, FALSE, NULL);
                }
 
-               nm_client_add_and_activate_connection (applet->nm_client,
-                                                      connection,
-                                                      device,
-                                                      ap ? nm_object_get_path (NM_OBJECT (ap)) : NULL,
-                                                      activate_new_cb,
-                                                      applet);
+               nm_client_add_and_activate_connection_async (applet->nm_client,
+                                                            connection,
+                                                            device,
+                                                            ap ? nm_object_get_path (NM_OBJECT (ap)) : NULL,
+                                                            NULL,
+                                                            activate_new_cb,
+                                                            applet);
        }
 
        /* Balance nma_wifi_dialog_get_connection() */
@@ -1430,33 +1441,29 @@ done:
        gtk_widget_destroy (GTK_WIDGET (dialog));
 }
 
-static gboolean
-add_one_setting (GHashTable *settings,
-                 NMConnection *connection,
-                 NMSetting *setting,
-                 GError **error)
+static GVariant *
+remove_unwanted_secrets (GVariant *secrets, gboolean keep_8021X)
 {
-       GHashTable *secrets;
-
-       g_return_val_if_fail (settings != NULL, FALSE);
-       g_return_val_if_fail (connection != NULL, FALSE);
-       g_return_val_if_fail (setting != NULL, FALSE);
-       g_return_val_if_fail (error != NULL, FALSE);
-       g_return_val_if_fail (*error == NULL, FALSE);
-
-       secrets = nm_setting_to_hash (setting, NM_SETTING_HASH_FLAG_ALL);
-       if (secrets) {
-               g_hash_table_insert (settings, g_strdup (nm_setting_get_name (setting)), secrets);
-       } else {
-               g_set_error (error,
-                            NM_SECRET_AGENT_ERROR,
-                            NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
-                            "%s.%d (%s): failed to hash setting '%s'.",
-                            __FILE__, __LINE__, __func__, nm_setting_get_name (setting));
+       GVariant *copy, *setting_dict;
+       const char *setting_name;
+       GVariantBuilder conn_builder;
+       GVariantIter conn_iter;
+
+       g_variant_builder_init (&conn_builder, NM_VARIANT_TYPE_CONNECTION);
+       g_variant_iter_init (&conn_iter, secrets);
+       while (g_variant_iter_next (&conn_iter, "{&s a{sv}}", &setting_name, &setting_dict)) {
+               if (   !strcmp (setting_name, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME)
+                   || (!strcmp (setting_name, NM_SETTING_802_1X_SETTING_NAME) && keep_8021X))
+                       g_variant_builder_add (&conn_builder, "{s a{sv}}", setting_name, setting_dict);
+
+               g_variant_unref (setting_dict);
        }
+       copy = g_variant_builder_end (&conn_builder);
+       g_variant_unref (secrets);
 
-       return secrets ? TRUE : FALSE;
+       return copy;
 }
+       
 
 typedef struct {
        SecretsRequest req;
@@ -1485,8 +1492,9 @@ get_secrets_dialog_response_cb (GtkDialog *foo,
        NMAWifiDialog *dialog = NMA_WIFI_DIALOG (info->dialog);
        NMConnection *connection = NULL;
        NMSettingWirelessSecurity *s_wireless_sec;
-       GHashTable *settings = NULL;
+       GVariant *secrets = NULL;
        const char *key_mgmt, *auth_alg;
+       gboolean keep_8021X = FALSE;
        GError *error = NULL;
 
        if (response != GTK_RESPONSE_OK) {
@@ -1502,7 +1510,7 @@ get_secrets_dialog_response_cb (GtkDialog *foo,
        if (!connection) {
                g_set_error (&error,
                             NM_SECRET_AGENT_ERROR,
-                            NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+                            NM_SECRET_AGENT_ERROR_FAILED,
                             "%s.%d (%s): couldn't get connection from Wi-Fi dialog.",
                             __FILE__, __LINE__, __func__);
                goto done;
@@ -1520,20 +1528,14 @@ get_secrets_dialog_response_cb (GtkDialog *foo,
                goto done;  /* Unencrypted */
        }
 
-       /* Returned secrets are a{sa{sv}}; this is the outer a{s...} hash that
-        * will contain all the individual settings hashes.
-        */
-       settings = g_hash_table_new_full (g_str_hash, g_str_equal,
-                                         g_free, (GDestroyNotify) g_hash_table_destroy);
-       if (!settings) {
+       secrets = nm_connection_to_dbus (connection, NM_CONNECTION_SERIALIZE_ONLY_SECRETS);
+       if (!secrets) {
                g_set_error (&error,
                             NM_SECRET_AGENT_ERROR,
-                            NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
-                            "%s.%d (%s): not enough memory to return secrets.",
-                            __FILE__, __LINE__, __func__);
-               goto done;
+                            NM_SECRET_AGENT_ERROR_FAILED,
+                            "%s.%d (%s): failed to hash connection '%s'.",
+                            __FILE__, __LINE__, __func__, nm_connection_get_id (connection));
        }
-
        /* If the user chose an 802.1x-based auth method, return 802.1x secrets,
         * not wireless secrets.  Can happen with Dynamic WEP, because NM doesn't
         * know the capabilities of the AP (since Dynamic WEP APs don't broadcast
@@ -1557,22 +1559,19 @@ get_secrets_dialog_response_cb (GtkDialog *foo,
                                             __FILE__, __LINE__, __func__);
                                goto done;
                        }
-
-                       /* Add the 802.1x setting */
-                       if (!add_one_setting (settings, connection, NM_SETTING (s_8021x), &error))
-                               goto done;
+                       keep_8021X = TRUE;
                }
        }
 
-       /* Add the 802-11-wireless-security setting no matter what */
-       add_one_setting (settings, connection, NM_SETTING (s_wireless_sec), &error);
+       /* Remove all not-relevant secrets (inner dicts) */
+       secrets = remove_unwanted_secrets (secrets, keep_8021X);
 
 done:
-       applet_secrets_request_complete (req, settings, error);
+       applet_secrets_request_complete (req, secrets, error);
        applet_secrets_request_free (req);
 
-       if (settings)
-               g_hash_table_destroy (settings);
+       if (secrets)
+               g_variant_unref (secrets);
        if (connection)
                nm_connection_clear_secrets (connection);
 }
@@ -1584,7 +1583,7 @@ wifi_get_secrets (SecretsRequest *req, GError **error)
 
        applet_secrets_request_set_free_func (req, free_wifi_info);
 
-       info->dialog = nma_wifi_dialog_new (req->applet->nm_client, req->applet->settings, req->connection, 
NULL, NULL, TRUE);
+       info->dialog = nma_wifi_dialog_new (req->applet->nm_client, req->connection, NULL, NULL, TRUE);
        if (info->dialog) {
                g_signal_connect (info->dialog, "response",
                                  G_CALLBACK (get_secrets_dialog_response_cb),
@@ -1593,7 +1592,7 @@ wifi_get_secrets (SecretsRequest *req, GError **error)
        } else {
                g_set_error (error,
                             NM_SECRET_AGENT_ERROR,
-                            NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+                            NM_SECRET_AGENT_ERROR_FAILED,
                             "%s.%d (%s): couldn't display secrets UI",
                             __FILE__, __LINE__, __func__);
        }
diff --git a/src/applet-device-wimax.c b/src/applet-device-wimax.c
index e167059..68ec47e 100644
--- a/src/applet-device-wimax.c
+++ b/src/applet-device-wimax.c
@@ -17,7 +17,7 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * (C) Copyright 2008 - 2012 Red Hat, Inc.
+ * Copyright 2008 - 2014 Red Hat, Inc.
  */
 
 #ifdef HAVE_CONFIG_H
@@ -27,17 +27,10 @@
 #include <glib/gi18n.h>
 #include <gtk/gtk.h>
 
-#include <nm-device.h>
-#include <nm-setting-connection.h>
-#include <nm-setting-wimax.h>
-#include <nm-device-wimax.h>
-#include <nm-utils.h>
-
 #include "applet.h"
 #include "applet-device-wimax.h"
 #include "applet-dialogs.h"
 #include "mb-menu-item.h"
-#include "nm-ui-utils.h"
 
 #define ACTIVE_NSP_TAG "active-nsp"
 
@@ -76,7 +69,7 @@ wimax_new_auto_connection (NMDevice *device,
 
        nsp_name = nm_wimax_nsp_get_name (info->nsp);
 
-       connection = nm_connection_new ();
+       connection = nm_simple_connection_new ();
 
        s_wimax = NM_SETTING_WIMAX (nm_setting_wimax_new ());
        g_object_set (s_wimax,
@@ -168,14 +161,14 @@ new_nsp_menu_item (NMDeviceWimax *device,
 }
 
 static NMConnection *
-get_connection_for_nsp (GSList *connections, NMWimaxNsp *nsp)
+get_connection_for_nsp (const GPtrArray *connections, NMWimaxNsp *nsp)
 {
-       GSList *iter;
+       int i;
        const char *nsp_name, *candidate_name;
 
        nsp_name = nm_wimax_nsp_get_name (nsp);
-       for (iter = connections; iter; iter = g_slist_next (iter)) {
-               NMConnection *candidate = NM_CONNECTION (iter->data);
+       for (i = 0; i < connections->len; i++) {
+               NMConnection *candidate = NM_CONNECTION (connections->pdata[i]);
                NMSettingWimax *s_wimax;
 
                s_wimax = nm_connection_get_setting_wimax (candidate);
@@ -204,7 +197,7 @@ sort_nsps (gconstpointer a, gconstpointer b)
 static void
 wimax_add_menu_item (NMDevice *device,
                      gboolean multiple_devices,
-                     GSList *connections,
+                     const GPtrArray *connections,
                      NMConnection *active,
                      GtkWidget *menu,
                      NMApplet *applet)
@@ -223,7 +216,7 @@ wimax_add_menu_item (NMDevice *device,
        if (multiple_devices) {
                const char *desc;
 
-               desc = nma_utils_get_device_description (device);
+               desc = nm_device_get_description (device);
                text = g_strdup_printf (_("WiMAX Mobile Broadband (%s)"), desc);
        } else {
                text = g_strdup (_("WiMAX Mobile Broadband"));
diff --git a/src/applet-dialogs.c b/src/applet-dialogs.c
index e671a0f..aa030b0 100644
--- a/src/applet-dialogs.c
+++ b/src/applet-dialogs.c
@@ -17,7 +17,7 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * (C) Copyright 2008 - 2011 Red Hat, Inc.
+ * Copyright 2008 - 2014 Red Hat, Inc.
  */
 
 #include "config.h"
@@ -26,20 +26,7 @@
 #include <sys/socket.h>
 #include <arpa/inet.h>
 
-#include <nm-device-ethernet.h>
-#include <nm-device-wifi.h>
-#include <nm-device-modem.h>
-#include <nm-device-wimax.h>
-
-#include <nm-setting-connection.h>
-#include <nm-setting-wireless.h>
-#include <nm-setting-wireless-security.h>
-#include <nm-setting-wired.h>
-#include <nm-setting-8021x.h>
-#include <nm-setting-ip4-config.h>
-#include <nm-setting-ip6-config.h>
-#include <nm-vpn-connection.h>
-#include <nm-utils.h>
+#include <NetworkManager.h>
 
 #include <gtk/gtk.h>
 #include <glib/gi18n.h>
@@ -72,27 +59,6 @@ ip4_address_as_string (guint32 ip)
        return ip_string;
 }
 
-static gchar *
-ip6_address_as_string (const struct in6_addr *ip)
-{
-       char buf[INET6_ADDRSTRLEN];
-
-       memset (&buf, '\0', sizeof (buf));
-
-       if (inet_ntop (AF_INET6, ip, buf, INET6_ADDRSTRLEN)) {
-               return g_strdup (buf);
-       } else {
-               int j;
-               GString *ip6_str = g_string_new (NULL);
-               g_string_append_printf (ip6_str, "%02X", ip->s6_addr[0]);
-               for (j = 1; j < 16; j++)
-                       g_string_append_printf (ip6_str, " %02X", ip->s6_addr[j]);
-               g_warning ("%s: error converting IP6 address %s", __func__, ip6_str->str);
-               g_string_free (ip6_str, TRUE);
-               return NULL;
-       }
-}
-
 static char *
 get_eap_label (NMSettingWirelessSecurity *sec,
                           NMSetting8021x *s_8021x)
@@ -141,30 +107,6 @@ out:
 }
 
 static NMConnection *
-get_connection_for_active (NMApplet *applet, NMActiveConnection *active)
-{
-       GSList *list, *iter;
-       NMConnection *connection = NULL;
-       const char *path;
-
-       path = nm_active_connection_get_connection (active);
-       g_return_val_if_fail (path != NULL, NULL);
-
-       list = applet_get_all_connections (applet);
-       for (iter = list; iter; iter = g_slist_next (iter)) {
-               NMConnection *candidate = NM_CONNECTION (iter->data);
-
-               if (!strcmp (nm_connection_get_path (candidate), path)) {
-                       connection = candidate;
-                       break;
-               }
-       }
-       g_slist_free (list);
-
-       return connection;
-}
-
-static NMConnection *
 get_connection_for_active_path (NMApplet *applet, const char *active_path)
 {
        NMActiveConnection *active = NULL;
@@ -185,7 +127,7 @@ get_connection_for_active_path (NMApplet *applet, const char *active_path)
                }
        }
 
-       return active ? get_connection_for_active (applet, active) : NULL;
+       return active ? (NMConnection *) nm_active_connection_get_connection (active) : NULL;
 }
 
 static GtkWidget *
@@ -375,26 +317,29 @@ wimax_bsid_changed_cb (NMDevice *device, GParamSpec *pspec, gpointer user_data)
 
 
 static void
-display_ip4_info (NMIP4Address *def_addr, GtkGrid *grid, int *row)
+display_ip4_info (NMIPAddress *def_addr, GtkGrid *grid, int *row)
 {
        guint32 hostmask, network, bcast, netmask;
+       const char *addr;
        char *str;
 
        /* Address */
        gtk_grid_attach (grid, create_info_label (_("IP Address:"), FALSE),
                         0, *row, 1, 1);
-       str = def_addr ? ip4_address_as_string (nm_ip4_address_get_address (def_addr)) : g_strdup 
(C_("Address", "Unknown"));
-       gtk_grid_attach (grid, create_info_label (str, TRUE),
+       addr = def_addr ? nm_ip_address_get_address (def_addr) : C_("Address", "Unknown");
+       gtk_grid_attach (grid, create_info_label (addr, TRUE),
                         1, *row, 1, 1);
-       g_free (str);
        (*row)++;
 
        /* Broadcast */
        if (def_addr) {
-               netmask = nm_utils_ip4_prefix_to_netmask (nm_ip4_address_get_prefix (def_addr));
-               network = ntohl (nm_ip4_address_get_address (def_addr)) & ntohl (netmask);
-               hostmask = ~ntohl (netmask);
-               bcast = htonl (network | hostmask);
+               guint32 addr_bin;
+
+               nm_ip_address_get_address_binary (def_addr, &addr_bin);
+               netmask = nm_utils_ip4_prefix_to_netmask (nm_ip_address_get_prefix (def_addr));
+               network = addr_bin & netmask;
+               hostmask = ~netmask;
+               bcast = network | hostmask;
        }
 
        gtk_grid_attach (grid, create_info_label (_("Broadcast Address:"), FALSE),
@@ -413,24 +358,11 @@ display_ip4_info (NMIP4Address *def_addr, GtkGrid *grid, int *row)
                         1, *row, 1, 1);
        g_free (str);
        (*row)++;
-
-       /* Gateway */
-       if (def_addr && nm_ip4_address_get_gateway (def_addr)) {
-               gtk_grid_attach (grid, create_info_label (_("Default Route:"), FALSE),
-                                0, *row, 1, 1);
-               str = ip4_address_as_string (nm_ip4_address_get_gateway (def_addr));
-               gtk_grid_attach (grid, create_info_label (str, TRUE),
-                                1, *row, 1, 1);
-               g_free (str);
-               (*row)++;
-       }
 }
 
 static void
-display_ip6_info (NMIP6Address *def6_addr, const char *method, GtkGrid *grid, int *row)
+display_ip6_info (NMIPAddress *def6_addr, const char *method, GtkGrid *grid, int *row)
 {
-       char *tmp_addr;
-       guint32 prefix;
        char *str;
 
        if (!def6_addr)
@@ -439,60 +371,27 @@ display_ip6_info (NMIP6Address *def6_addr, const char *method, GtkGrid *grid, in
        /* Address */
        gtk_grid_attach (grid, create_info_label (_("IP Address:"), FALSE),
                         0, *row, 1, 1);
-       tmp_addr = ip6_address_as_string (nm_ip6_address_get_address (def6_addr));
-       prefix = nm_ip6_address_get_prefix (def6_addr);
-       str = g_strdup_printf ("%s/%d", tmp_addr, prefix);
-       g_free (tmp_addr);
+       str = g_strdup_printf ("%s/%d",
+                              nm_ip_address_get_address (def6_addr),
+                              nm_ip_address_get_prefix (def6_addr));
 
        gtk_grid_attach (grid, create_info_label (str, TRUE),
                         1, *row, 1, 1);
        g_free (str);
        (*row)++;
-
-       /* Gateway */
-       if (nm_ip6_address_get_gateway (def6_addr)) {
-               gtk_grid_attach (grid, create_info_label (_("Default Route:"), FALSE),
-                                0, *row, 1, 1);
-               str = ip6_address_as_string (nm_ip6_address_get_gateway (def6_addr));
-               gtk_grid_attach (grid, create_info_label (str, TRUE),
-                                1, *row, 1, 1);
-               g_free (str);
-               (*row)++;
-       }
 }
 
 static void
-display_dns4_info (const GArray *dns, GtkGrid *grid, int *row)
+display_dns_info (const char * const *dns, GtkGrid *grid, int *row)
 {
        char *label[] = { "Primary DNS:", "Secondary DNS:", "Ternary DNS:" };
-       char *str;
        int i;
 
-       for (i = 0; dns && i < dns->len && i < 3; i++) {
+       for (i = 0; dns && dns[i] && i < 3; i++) {
                gtk_grid_attach (grid, create_info_label (_(label[i]), FALSE),
                                 0, *row, 1, 1);
-               str = ip4_address_as_string (g_array_index (dns, guint32, i));
-               gtk_grid_attach (grid, create_info_label (str, TRUE),
+               gtk_grid_attach (grid, create_info_label (dns[i], TRUE),
                                 1, *row, 1, 1);
-               g_free (str);
-               (*row)++;
-       }
-}
-
-static void
-display_dns6_info (const GSList *dns6, GtkGrid *grid, int *row)
-{
-       char *label[] = { "Primary DNS:", "Secondary DNS:", "Ternary DNS:" };
-       char *str;
-       int i;
-
-       for (i = 0; dns6 && i < 3 ; dns6 = g_slist_next (dns6), i++) {
-               gtk_grid_attach (grid, create_info_label (_(label[i]), FALSE),
-                                0, *row, 1, 1);
-               str = ip6_address_as_string (dns6->data);
-               gtk_grid_attach (grid, create_info_label (str, TRUE),
-                                1, *row, 1, 1);
-               g_free (str);
                (*row)++;
        }
 }
@@ -507,16 +406,16 @@ info_dialog_add_page (GtkNotebook *notebook,
        guint32 speed = 0;
        char *str;
        const char *iface, *method = NULL;
-       NMIP4Config *ip4_config;
-       NMIP6Config *ip6_config;
-       const GArray *dns;
-       const GSList *dns6;
-       NMIP4Address *def_addr = NULL;
-       NMIP6Address *def6_addr = NULL;
-       NMSettingIP6Config *s_ip6;
+       NMIPConfig *ip4_config;
+       NMIPConfig *ip6_config;
+       const char * const *dns;
+       const char * const *dns6;
+       NMIPAddress *def_addr = NULL;
+       NMIPAddress *def6_addr = NULL;
+       NMSettingIPConfig *s_ip6;
        int row = 0;
        GtkWidget* speed_label, *sec_label = NULL;
-       const GSList *addresses;
+       GPtrArray *addresses;
        gboolean show_security = FALSE;
 
        grid = GTK_GRID (gtk_grid_new ());
@@ -664,15 +563,24 @@ info_dialog_add_page (GtkNotebook *notebook,
        row++;
 
        ip4_config = nm_device_get_ip4_config (device);
-       addresses = nm_ip4_config_get_addresses (ip4_config);
-       if (g_slist_length ((GSList *) addresses))
-               def_addr = addresses->data;
+       addresses = nm_ip_config_get_addresses (ip4_config);
+       if (addresses && addresses->len > 0)
+               def_addr = (NMIPAddress *) g_ptr_array_index (addresses, 0);
 
        display_ip4_info (def_addr, grid, &row);
 
+       /* Gateway */
+       if (nm_ip_config_get_gateway (ip4_config)) {
+               gtk_grid_attach (grid, create_info_label (_("Default Route:"), FALSE),
+                                0, row, 1, 1);
+               gtk_grid_attach (grid, create_info_label (nm_ip_config_get_gateway (ip4_config), TRUE),
+                                1, row, 1, 1);
+               row++;
+       }
+
        /* DNS */
-       dns = def_addr ? nm_ip4_config_get_nameservers (ip4_config) : NULL;
-       display_dns4_info (dns, grid, &row);
+       dns = def_addr ? nm_ip_config_get_nameservers (ip4_config) : NULL;
+       display_dns_info (dns, grid, &row);
 
        /* Empty line */
        gtk_grid_attach (grid, gtk_label_new (""), 0, row, 2, 1);
@@ -685,7 +593,7 @@ info_dialog_add_page (GtkNotebook *notebook,
 
        s_ip6 = nm_connection_get_setting_ip6_config (connection);
        if (s_ip6)
-                method = nm_setting_ip6_config_get_method (s_ip6);
+                method = nm_setting_ip_config_get_method (s_ip6);
 
        if (!method || !strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_IGNORE)) {
                gtk_grid_attach (grid, create_info_label (_("Ignored"), FALSE),
@@ -695,15 +603,24 @@ info_dialog_add_page (GtkNotebook *notebook,
 
        ip6_config = nm_device_get_ip6_config (device);
        if (ip6_config) {
-               addresses = nm_ip6_config_get_addresses (ip6_config);
-               if (g_slist_length ((GSList *) addresses))
-                       def6_addr = addresses->data;
+               addresses = nm_ip_config_get_addresses (ip6_config);
+               if (addresses && addresses->len > 0)
+                       def6_addr = (NMIPAddress *) g_ptr_array_index (addresses, 0);
        }
        display_ip6_info (def6_addr, method, grid, &row);
 
+       /* Gateway */
+       if (nm_ip_config_get_gateway (ip6_config)) {
+               gtk_grid_attach (grid, create_info_label (_("Default Route:"), FALSE),
+                                0, row, 1, 1);
+               gtk_grid_attach (grid, create_info_label (nm_ip_config_get_gateway (ip6_config), TRUE),
+                                1, row, 1, 1);
+               row++;
+       }
+
        /* DNS */
-       dns6 = def6_addr ? nm_ip6_config_get_nameservers (ip6_config) : NULL;
-       display_dns6_info (dns6, grid, &row);
+       dns6 = def6_addr ? nm_ip_config_get_nameservers (ip6_config) : NULL;
+       display_dns_info (dns6, grid, &row);
 
        gtk_notebook_append_page (notebook, GTK_WIDGET (grid),
                                  create_info_notebook_label (connection, is_default));
@@ -789,14 +706,14 @@ info_dialog_add_page_for_vpn (GtkNotebook *notebook,
        GtkGrid *grid;
        char *str;
        int row = 0;
-       NMIP4Config *ip4_config;
-       NMIP6Config *ip6_config;
-       const GArray *dns;
-       const GSList *dns6;
-       NMIP4Address *def_addr = NULL;
-       NMIP6Address *def6_addr = NULL;
-       const GSList *addresses;
-       NMSettingIP6Config *s_ip6;
+       NMIPConfig *ip4_config;
+       NMIPConfig *ip6_config;
+       const char * const *dns;
+       const char * const *dns6;
+       NMIPAddress *def_addr = NULL;
+       NMIPAddress *def6_addr = NULL;
+       GPtrArray *addresses;
+       NMSettingIPConfig *s_ip6;
        const char *method = NULL;
        gboolean is_default = nm_active_connection_get_default (active);
 
@@ -852,15 +769,15 @@ info_dialog_add_page_for_vpn (GtkNotebook *notebook,
        row++;
 
        ip4_config = nm_active_connection_get_ip4_config (active);
-       addresses = nm_ip4_config_get_addresses (ip4_config);
-       if (g_slist_length ((GSList *) addresses))
-               def_addr = addresses->data;
+       addresses = nm_ip_config_get_addresses (ip4_config);
+       if (addresses && addresses->len > 0)
+               def_addr = (NMIPAddress *) g_ptr_array_index (addresses, 0);
 
        display_ip4_info (def_addr, grid, &row);
 
        /* DNS */
-       dns = def_addr ? nm_ip4_config_get_nameservers (ip4_config) : NULL;
-       display_dns4_info (dns, grid, &row);
+       dns = def_addr ? nm_ip_config_get_nameservers (ip4_config) : NULL;
+       display_dns_info (dns, grid, &row);
 
        /* Empty line */
        gtk_grid_attach (grid, gtk_label_new (""), 0, row, 2, 1);
@@ -875,7 +792,7 @@ info_dialog_add_page_for_vpn (GtkNotebook *notebook,
 
                s_ip6 = nm_connection_get_setting_ip6_config (connection);
                if (s_ip6)
-                        method = nm_setting_ip6_config_get_method (s_ip6);
+                        method = nm_setting_ip_config_get_method (s_ip6);
 
                if (!method || !strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_IGNORE)) {
                        gtk_grid_attach (grid, create_info_label (_("Ignored"), FALSE),
@@ -883,16 +800,16 @@ info_dialog_add_page_for_vpn (GtkNotebook *notebook,
                        row++;
                }
 
-               addresses = nm_ip6_config_get_addresses (ip6_config);
-               if (g_slist_length ((GSList *) addresses))
-                       def6_addr = addresses->data;
+               addresses = nm_ip_config_get_addresses (ip6_config);
+               if (addresses && addresses->len > 0)
+                       def6_addr = (NMIPAddress *) g_ptr_array_index (addresses, 0);
 
                /* IPv6 Address */
                display_ip6_info (def6_addr, method, grid, &row);
 
                /* DNS */
-               dns6 = def6_addr ? nm_ip6_config_get_nameservers (ip6_config) : NULL;
-               display_dns6_info (dns6, grid, &row);
+               dns6 = def6_addr ? nm_ip_config_get_nameservers (ip6_config) : NULL;
+               display_dns_info (dns6, grid, &row);
        }
 
        gtk_notebook_append_page (notebook, GTK_WIDGET (grid),
@@ -925,7 +842,7 @@ info_dialog_update (NMApplet *applet)
                if (nm_active_connection_get_state (active_connection) != 
NM_ACTIVE_CONNECTION_STATE_ACTIVATED)
                        continue;
 
-               connection = get_connection_for_active (applet, active_connection);
+               connection = (NMConnection *) nm_active_connection_get_connection (active_connection);
                if (!connection) {
                        g_warning ("%s: couldn't find the default active connection's NMConnection!", 
__func__);
                        continue;
@@ -933,7 +850,7 @@ info_dialog_update (NMApplet *applet)
 
                devices = nm_active_connection_get_devices (active_connection);
                if (NM_IS_VPN_CONNECTION (active_connection)) {
-                       const char *spec_object = nm_active_connection_get_specific_object 
(active_connection);
+                       const char *spec_object = nm_active_connection_get_specific_object_path 
(active_connection);
                        NMConnection *parent_con = get_connection_for_active_path (applet, spec_object);
 
                        info_dialog_add_page_for_vpn (notebook, connection, active_connection, parent_con);
@@ -981,7 +898,7 @@ applet_about_dialog_show (NMApplet *applet)
 {
        gtk_show_about_dialog (NULL,
                               "version", VERSION,
-                              "copyright", _("Copyright \xc2\xa9 2004-2011 Red Hat, Inc.\n"
+                              "copyright", _("Copyright \xc2\xa9 2004-2014 Red Hat, Inc.\n"
                                              "Copyright \xc2\xa9 2005-2008 Novell, Inc.\n"
                                              "and many other community contributors and translators"),
                               "comments", _("Notification area applet for managing your network devices and 
connections."),
diff --git a/src/applet-vpn-request.c b/src/applet-vpn-request.c
index 62f7a98..25d51c5 100644
--- a/src/applet-vpn-request.c
+++ b/src/applet-vpn-request.c
@@ -17,7 +17,7 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * (C) Copyright 2004 - 2012 Red Hat, Inc.
+ * Copyright 2004 - 2014 Red Hat, Inc.
  */
 
 #include <config.h>
@@ -32,11 +32,9 @@
 
 #include <glib-object.h>
 
+#include <NetworkManager.h>
+
 #include "applet-vpn-request.h"
-#include <nm-connection.h>
-#include <nm-setting-connection.h>
-#include <nm-setting-vpn.h>
-#include <nm-secret-agent.h>
 
 #define APPLET_TYPE_VPN_REQUEST            (applet_vpn_request_get_type ())
 #define APPLET_VPN_REQUEST(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), APPLET_TYPE_VPN_REQUEST, 
AppletVpnRequest))
@@ -96,22 +94,15 @@ child_finished_cb (GPid pid, gint status, gpointer user_data)
        AppletVpnRequest *self = info->vpn;
        AppletVpnRequestPrivate *priv = APPLET_VPN_REQUEST_GET_PRIVATE (self);
        GError *error = NULL;
-       GHashTable *settings = NULL;
+       GVariant *settings = NULL;
+       GVariantBuilder settings_builder, vpn_builder, secrets_builder;
 
        if (status == 0) {
-               GHashTable *vpn, *secrets;
-               GValue val = { 0 };
                GSList *iter;
 
-               settings = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, (GDestroyNotify) 
g_hash_table_destroy);
-
-               vpn = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, (GDestroyNotify) g_value_unset);
-               g_hash_table_insert (settings, NM_SETTING_VPN_SETTING_NAME, vpn);
-
-               secrets = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, NULL);
-               g_value_init (&val, DBUS_TYPE_G_MAP_OF_STRING);
-               g_value_take_boxed (&val, secrets);
-               g_hash_table_insert (vpn, NM_SETTING_VPN_SECRETS, &val);
+               g_variant_builder_init (&settings_builder, NM_VARIANT_TYPE_CONNECTION);
+               g_variant_builder_init (&vpn_builder, NM_VARIANT_TYPE_SETTING);
+               g_variant_builder_init (&secrets_builder, G_VARIANT_TYPE ("a{ss}"));
 
                /* The length of 'lines' must be divisible by 2 since it must contain
                 * key:secret pairs with the key on one line and the associated secret
@@ -120,9 +111,17 @@ child_finished_cb (GPid pid, gint status, gpointer user_data)
                for (iter = priv->lines; iter; iter = g_slist_next (iter)) {
                        if (!iter->next)
                                break;
-                       g_hash_table_insert (secrets, (char *) iter->data, (char *) iter->next->data);
+                       g_variant_builder_add (&secrets_builder, "{ss}", iter->data, iter->next->data);
                        iter = iter->next;
                }
+
+               g_variant_builder_add (&vpn_builder, "{sv}",
+                                      NM_SETTING_VPN_SECRETS,
+                                       g_variant_builder_end (&secrets_builder));
+               g_variant_builder_add (&settings_builder, "{sa{sv}}",
+                                      NM_SETTING_VPN_SETTING_NAME,
+                                      &vpn_builder);
+               settings = g_variant_builder_end (&settings_builder);
        } else {
                error = g_error_new (NM_SECRET_AGENT_ERROR,
                                     NM_SECRET_AGENT_ERROR_USER_CANCELED,
@@ -134,7 +133,7 @@ child_finished_cb (GPid pid, gint status, gpointer user_data)
        applet_secrets_request_free (req);
 
        if (settings)
-               g_hash_table_destroy (settings);
+               g_variant_unref (settings);
        g_clear_error (&error);
 }
 
@@ -183,7 +182,7 @@ find_auth_dialog_binary (const char *service,
        if (!dir) {
                g_set_error (error,
                             NM_SECRET_AGENT_ERROR,
-                            NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+                            NM_SECRET_AGENT_ERROR_FAILED,
                             "Failed to open VPN plugin file configuration directory " VPN_NAME_FILES_DIR);
                return NULL;
        }
@@ -216,7 +215,7 @@ find_auth_dialog_binary (const char *service,
        if (prog == NULL) {
                g_set_error (error,
                             NM_SECRET_AGENT_ERROR,
-                            NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+                            NM_SECRET_AGENT_ERROR_FAILED,
                             "Could not find the authentication dialog for VPN connection type '%s'",
                             service);
        } else if (!g_path_is_absolute (prog)) {
@@ -271,7 +270,7 @@ write_item (int fd, const char *item, GError **error)
        if (write (fd, item, item_len) != item_len) {
                g_set_error (error,
                                 NM_SECRET_AGENT_ERROR,
-                                NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+                                NM_SECRET_AGENT_ERROR_FAILED,
                                 "Failed to write connection to VPN UI: errno %d", errno);
                return FALSE;
        }
@@ -309,14 +308,14 @@ write_one_key_val (const char *key, const char *value, gpointer user_data)
 static gboolean
 write_connection_to_child (int fd, NMConnection *connection, GError **error)
 {
-       NMSettingVPN *s_vpn;
+       NMSettingVpn *s_vpn;
        WriteItemInfo info = { .fd = fd, .secret = FALSE, .error = error };
 
        s_vpn = nm_connection_get_setting_vpn (connection);
        if (!s_vpn) {
                g_set_error_literal (error,
                                     NM_SECRET_AGENT_ERROR,
-                                    NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+                                    NM_SECRET_AGENT_ERROR_FAILED,
                                     "Connection had no VPN setting");
                return FALSE;
        }
@@ -350,7 +349,7 @@ applet_vpn_request_get_secrets (SecretsRequest *req, GError **error)
        VpnSecretsInfo *info = (VpnSecretsInfo *) req;
        AppletVpnRequestPrivate *priv;
        NMSettingConnection *s_con;
-       NMSettingVPN *s_vpn;
+       NMSettingVpn *s_vpn;
        const char *connection_type;
        const char *service_type;
        char *bin_path;
@@ -383,7 +382,7 @@ applet_vpn_request_get_secrets (SecretsRequest *req, GError **error)
        if (!info->vpn) {
                g_set_error_literal (error,
                                     NM_SECRET_AGENT_ERROR,
-                                    NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+                                    NM_SECRET_AGENT_ERROR_FAILED,
                                     "Could not create VPN secrets request object");
                goto out;
        }
diff --git a/src/applet-vpn-request.h b/src/applet-vpn-request.h
index 2fe5d28..835daeb 100644
--- a/src/applet-vpn-request.h
+++ b/src/applet-vpn-request.h
@@ -20,7 +20,7 @@
  * (C) Copyright 2004 - 2011 Red Hat, Inc.
  */
 
-#ifndef APPLET_VPN_REQUEST_H
+#ifndef APPLET_VPN_REQEUST_H
 #define APPLET_VPN_REQUEST_H
 
 #include "applet.h"
diff --git a/src/applet.c b/src/applet.c
index bca0415..12b0790 100644
--- a/src/applet.c
+++ b/src/applet.c
@@ -15,8 +15,8 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * Copyright (C) 2004 - 2012 Red Hat, Inc.
- * Copyright (C) 2005 - 2008 Novell, Inc.
+ * Copyright 2004 - 2014 Red Hat, Inc.
+ * Copyright 2005 - 2008 Novell, Inc.
  *
  * This applet used the GNOME Wireless Applet as a skeleton to build from.
  *
@@ -24,7 +24,7 @@
  *             Eskil Heyn Olsen <eskil eskil dk>
  *             Bastien Nocera <hadess hadess net> (Gnome2 port)
  *
- * (C) Copyright 2001, 2002 Free Software Foundation
+ * Copyright 2001, 2002 Free Software Foundation
  */
 
 #ifdef HAVE_CONFIG_H
@@ -44,31 +44,6 @@
 #include <dbus/dbus-glib.h>
 #include <dbus/dbus-glib-lowlevel.h>
 
-#include <NetworkManagerVPN.h>
-#include <nm-device-bond.h>
-#include <nm-device-team.h>
-#include <nm-device-bridge.h>
-#include <nm-device-bt.h>
-#include <nm-device-ethernet.h>
-#include <nm-device-infiniband.h>
-#include <nm-device-modem.h>
-#include <nm-device-vlan.h>
-#include <nm-device-wifi.h>
-#include <nm-device-wimax.h>
-#include <nm-utils.h>
-#include <nm-connection.h>
-#include <nm-vpn-connection.h>
-#include <nm-setting-connection.h>
-#include <nm-setting-wired.h>
-#include <nm-setting-wireless.h>
-#include <nm-setting-pppoe.h>
-#include <nm-setting-gsm.h>
-#include <nm-setting-cdma.h>
-#include <nm-setting-bluetooth.h>
-#include <nm-setting-vpn.h>
-#include <nm-active-connection.h>
-#include <nm-secret-agent.h>
-
 #include <libnotify/notify.h>
 
 #include "applet.h"
@@ -84,11 +59,10 @@
 #include "applet-device-wifi.h"
 #include "applet-device-wimax.h"
 #include "applet-dialogs.h"
-#include "nm-wifi-dialog.h"
+#include "nma-wifi-dialog.h"
 #include "applet-vpn-request.h"
 #include "utils.h"
 #include "shell-watcher.h"
-#include "nm-ui-utils.h"
 
 #if WITH_MODEM_MANAGER_1
 # include "applet-device-broadband.h"
@@ -114,7 +88,7 @@ impl_dbus_connect_to_hidden_network (NMApplet *applet, GError **error)
        if (!applet_wifi_connect_to_hidden_network (applet)) {
                g_set_error_literal (error,
                                     NM_SECRET_AGENT_ERROR,
-                                    NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+                                    NM_SECRET_AGENT_ERROR_FAILED,
                                     "Failed to create Wi-Fi dialog");
                return FALSE;
        }
@@ -128,7 +102,7 @@ impl_dbus_create_wifi_network (NMApplet *applet, GError **error)
        if (!applet_wifi_can_create_wifi_network (applet)) {
                g_set_error_literal (error,
                                     NM_SECRET_AGENT_ERROR,
-                                    NM_SECRET_AGENT_ERROR_NOT_AUTHORIZED,
+                                    NM_SECRET_AGENT_ERROR_PERMISSION_DENIED,
                                     "Creation of Wi-Fi networks has been disabled by system policy.");
                return FALSE;
        }
@@ -136,7 +110,7 @@ impl_dbus_create_wifi_network (NMApplet *applet, GError **error)
        if (!applet_wifi_create_wifi_network (applet)) {
                g_set_error_literal (error,
                                     NM_SECRET_AGENT_ERROR,
-                                    NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+                                    NM_SECRET_AGENT_ERROR_FAILED,
                                     "Failed to create Wi-Fi dialog");
                return FALSE;
        }
@@ -157,7 +131,7 @@ impl_dbus_connect_to_8021x_network (NMApplet *applet,
        if (!device || NM_IS_DEVICE_WIFI (device) == FALSE) {
                g_set_error_literal (error,
                                     NM_SECRET_AGENT_ERROR,
-                                    NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+                                    NM_SECRET_AGENT_ERROR_FAILED,
                                     "The device could not be found.");
                return FALSE;
        }
@@ -166,7 +140,7 @@ impl_dbus_connect_to_8021x_network (NMApplet *applet,
        if (!ap) {
                g_set_error_literal (error,
                                     NM_SECRET_AGENT_ERROR,
-                                    NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+                                    NM_SECRET_AGENT_ERROR_FAILED,
                                     "The access point could not be found.");
                return FALSE;
        }
@@ -176,7 +150,7 @@ impl_dbus_connect_to_8021x_network (NMApplet *applet,
            && !(nm_access_point_get_rsn_flags (ap) & NM_802_11_AP_SEC_KEY_MGMT_802_1X)) {
                g_set_error_literal (error,
                                     NM_SECRET_AGENT_ERROR,
-                                    NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+                                    NM_SECRET_AGENT_ERROR_FAILED,
                                     "The access point had no 802.1x capabilities");
                return FALSE;
        }
@@ -184,7 +158,7 @@ impl_dbus_connect_to_8021x_network (NMApplet *applet,
        if (!applet_wifi_connect_to_8021x_network (applet, device, ap)) {
                g_set_error_literal (error,
                                     NM_SECRET_AGENT_ERROR,
-                                    NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+                                    NM_SECRET_AGENT_ERROR_FAILED,
                                     "Failed to create Wi-Fi dialog");
                return FALSE;
        }
@@ -204,7 +178,7 @@ impl_dbus_connect_to_3g_network (NMApplet *applet,
        if (!device || NM_IS_DEVICE_MODEM (device) == FALSE) {
                g_set_error_literal (error,
                                     NM_SECRET_AGENT_ERROR,
-                                    NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+                                    NM_SECRET_AGENT_ERROR_FAILED,
                                     "The device could not be found.");
                return FALSE;
        }
@@ -218,7 +192,7 @@ impl_dbus_connect_to_3g_network (NMApplet *applet,
 
                g_set_error_literal (error,
                                     NM_SECRET_AGENT_ERROR,
-                                    NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+                                    NM_SECRET_AGENT_ERROR_FAILED,
                                     "ModemManager was not found");
                return FALSE;
        }
@@ -232,7 +206,7 @@ impl_dbus_connect_to_3g_network (NMApplet *applet,
        } else {
                g_set_error_literal (error,
                                     NM_SECRET_AGENT_ERROR,
-                                    NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+                                    NM_SECRET_AGENT_ERROR_FAILED,
                                     "The device had no GSM or CDMA capabilities.");
                return FALSE;
        }
@@ -449,58 +423,30 @@ applet_get_default_active_connection (NMApplet *applet, NMDevice **device)
        return default_ac;
 }
 
-NMRemoteSettings *
-applet_get_settings (NMApplet *applet)
-{
-       return applet->settings;
-}
-
-GSList *
+GPtrArray *
 applet_get_all_connections (NMApplet *applet)
 {
-       GSList *connections, *iter, *next;
+       const GPtrArray *all_connections;
+       GPtrArray *connections;
+       int i;
        NMConnection *connection;
        NMSettingConnection *s_con;
 
-       connections = nm_remote_settings_list_connections (applet->settings);
+       all_connections = nm_client_get_connections (applet->nm_client);
+       connections = g_ptr_array_new_full (all_connections->len, g_object_unref);
 
        /* Ignore slave connections */
-       for (iter = connections; iter; iter = next) {
-               connection = iter->data;
-               next = iter->next;
+       for (i = 0; i < all_connections->len; i++) {
+               connection = all_connections->pdata[i];
 
                s_con = nm_connection_get_setting_connection (connection);
-               if (s_con && nm_setting_connection_get_master (s_con))
-                       connections = g_slist_delete_link (connections, iter);
+               if (s_con && !nm_setting_connection_get_master (s_con))
+                       g_ptr_array_add (connections, g_object_ref (connection));
        }
 
        return connections;
 }
 
-static NMConnection *
-applet_get_connection_for_active (NMApplet *applet, NMActiveConnection *active)
-{
-       GSList *list, *iter;
-       NMConnection *connection = NULL;
-       const char *path;
-
-       path = nm_active_connection_get_connection (active);
-       g_return_val_if_fail (path != NULL, NULL);
-
-       list = applet_get_all_connections (applet);
-       for (iter = list; iter; iter = g_slist_next (iter)) {
-               NMConnection *candidate = NM_CONNECTION (iter->data);
-
-               if (!strcmp (nm_connection_get_path (candidate), path)) {
-                       connection = candidate;
-                       break;
-               }
-       }
-       g_slist_free (list);
-
-       return connection;
-}
-
 static NMActiveConnection *
 applet_get_active_for_connection (NMApplet *applet, NMConnection *connection)
 {
@@ -514,7 +460,8 @@ applet_get_active_for_connection (NMApplet *applet, NMConnection *connection)
        active_list = nm_client_get_active_connections (applet->nm_client);
        for (i = 0; active_list && (i < active_list->len); i++) {
                NMActiveConnection *active = NM_ACTIVE_CONNECTION (g_ptr_array_index (active_list, i));
-               const char *active_cpath = nm_active_connection_get_connection (active);
+               NMRemoteConnection *conn = nm_active_connection_get_connection (active);
+               const char *active_cpath = nm_connection_get_path (NM_CONNECTION (conn));
 
                if (active_cpath && !strcmp (active_cpath, cpath))
                        return active;
@@ -535,8 +482,9 @@ applet_get_device_for_connection (NMApplet *applet, NMConnection *connection)
        active_list = nm_client_get_active_connections (applet->nm_client);
        for (i = 0; active_list && (i < active_list->len); i++) {
                NMActiveConnection *active = NM_ACTIVE_CONNECTION (g_ptr_array_index (active_list, i));
+               NMRemoteConnection *ac_conn = nm_active_connection_get_connection (active);
 
-               if (!g_strcmp0 (nm_active_connection_get_connection (active), cpath))
+               if (!g_strcmp0 (nm_connection_get_path (NM_CONNECTION (ac_conn)), cpath))
                        return g_ptr_array_index (nm_active_connection_get_devices (active), 0);
        }
        return NULL;
@@ -564,12 +512,16 @@ applet_item_activate_info_destroy (AppletItemActivateInfo *info)
 }
 
 static void
-add_and_activate_cb (NMClient *client,
-                     NMActiveConnection *active,
-                     const char *connection_path,
-                     GError *error,
+add_and_activate_cb (GObject *client,
+                     GAsyncResult *result,
                      gpointer user_data)
 {
+       GError *error = NULL;
+       NMActiveConnection *active;
+
+       active = nm_client_add_and_activate_connection_finish (NM_CLIENT (client), result, &error);
+       g_clear_object (&active);
+
        if (error) {
                const char *text = _("Failed to add/activate connection");
                char *err_text = g_strdup_printf ("(%d) %s", error->code,
@@ -578,6 +530,7 @@ add_and_activate_cb (NMClient *client,
                g_warning ("%s: %s", text, err_text);
                utils_show_error_dialog (_("Connection failure"), text, err_text, FALSE, NULL);
                g_free (err_text);
+               g_error_free (error);
        }
 
        applet_schedule_update_icon (NM_APPLET (user_data));
@@ -601,19 +554,26 @@ applet_menu_item_activate_helper_new_connection (NMConnection *connection,
        /* Ask NM to add the new connection and activate it; NM will fill in the
         * missing details based on the specific object and the device.
         */
-       nm_client_add_and_activate_connection (info->applet->nm_client,
-                                              connection,
-                                              info->device,
-                                              info->specific_object,
-                                              add_and_activate_cb,
-                                              info->applet);
+       nm_client_add_and_activate_connection_async (info->applet->nm_client,
+                                                    connection,
+                                                    info->device,
+                                                    info->specific_object,
+                                                    NULL,
+                                                    add_and_activate_cb,
+                                                    info->applet);
 
        applet_item_activate_info_destroy (info);
 }
 
 static void
-disconnect_cb (NMDevice *device, GError *error, gpointer user_data)
+disconnect_cb (GObject *device,
+               GAsyncResult *result,
+               gpointer user_data)
+
 {
+       GError *error = NULL;
+
+       nm_device_disconnect_finish (NM_DEVICE (device), result, &error);
        if (error) {
                const char *text = _("Device disconnect failed");
                char *err_text = g_strdup_printf ("(%d) %s", error->code,
@@ -622,6 +582,7 @@ disconnect_cb (NMDevice *device, GError *error, gpointer user_data)
                g_warning ("%s: %s: %s", __func__, text, err_text);
                utils_show_error_dialog (_("Disconnect failure"), text, err_text, FALSE, NULL);
                g_free (err_text);
+               g_error_free (error);
        }
 }
 
@@ -631,15 +592,20 @@ applet_menu_item_disconnect_helper (NMDevice *device,
 {
        g_return_if_fail (NM_IS_DEVICE (device));
 
-       nm_device_disconnect (device, disconnect_cb, NULL);
+       nm_device_disconnect_async (device, NULL, disconnect_cb, NULL);
 }
 
 static void
-activate_connection_cb (NMClient *client,
-                        NMActiveConnection *active,
-                        GError *error,
+activate_connection_cb (GObject *client,
+                        GAsyncResult *result,
                         gpointer user_data)
 {
+       GError *error = NULL;
+       NMActiveConnection *active;
+
+       active = nm_client_activate_connection_finish (NM_CLIENT (client), result, &error);
+       g_clear_object (&active);
+
        if (error) {
                const char *text = _("Connection activation failed");
                char *err_text = g_strdup_printf ("(%d) %s", error->code,
@@ -648,6 +614,7 @@ activate_connection_cb (NMClient *client,
                g_warning ("%s: %s", text, err_text);
                utils_show_error_dialog (_("Connection failure"), text, err_text, FALSE, NULL);
                g_free (err_text);
+               g_error_free (error);
        }
 
        applet_schedule_update_icon (NM_APPLET (user_data));
@@ -667,12 +634,13 @@ applet_menu_item_activate_helper (NMDevice *device,
                /* If the menu item had an associated connection already, just tell
                 * NM to activate that connection.
                 */
-               nm_client_activate_connection (applet->nm_client,
-                                                  connection,
-                                                  device,
-                                                  specific_object,
-                                                  activate_connection_cb,
-                                                  applet);
+               nm_client_activate_connection_async (applet->nm_client,
+                                                    connection,
+                                                    device,
+                                                    specific_object,
+                                                    NULL,
+                                                    activate_connection_cb,
+                                                    applet);
                return;
        }
 
@@ -1013,7 +981,7 @@ applet_is_any_vpn_activating (NMApplet *applet)
        connections = nm_client_get_active_connections (applet->nm_client);
        for (i = 0; connections && (i < connections->len); i++) {
                NMActiveConnection *candidate = NM_ACTIVE_CONNECTION (g_ptr_array_index (connections, i));
-               NMVPNConnectionState vpn_state;
+               NMVpnConnectionState vpn_state;
 
                if (NM_IS_VPN_CONNECTION (candidate)) {
                        vpn_state = nm_vpn_connection_get_vpn_state (NM_VPN_CONNECTION (candidate));
@@ -1029,8 +997,8 @@ applet_is_any_vpn_activating (NMApplet *applet)
 }
 
 static char *
-make_vpn_failure_message (NMVPNConnection *vpn,
-                          NMVPNConnectionStateReason reason,
+make_vpn_failure_message (NMVpnConnection *vpn,
+                          NMVpnConnectionStateReason reason,
                           NMApplet *applet)
 {
        NMConnection *connection;
@@ -1038,7 +1006,7 @@ make_vpn_failure_message (NMVPNConnection *vpn,
 
        g_return_val_if_fail (vpn != NULL, NULL);
 
-       connection = applet_get_connection_for_active (applet, NM_ACTIVE_CONNECTION (vpn));
+       connection = (NMConnection *) nm_active_connection_get_connection (NM_ACTIVE_CONNECTION (vpn));
        s_con = nm_connection_get_setting_connection (connection);
 
        switch (reason) {
@@ -1075,8 +1043,8 @@ make_vpn_failure_message (NMVPNConnection *vpn,
 }
 
 static char *
-make_vpn_disconnection_message (NMVPNConnection *vpn,
-                                NMVPNConnectionStateReason reason,
+make_vpn_disconnection_message (NMVpnConnection *vpn,
+                                NMVpnConnectionStateReason reason,
                                 NMApplet *applet)
 {
        NMConnection *connection;
@@ -1084,7 +1052,7 @@ make_vpn_disconnection_message (NMVPNConnection *vpn,
 
        g_return_val_if_fail (vpn != NULL, NULL);
 
-       connection = applet_get_connection_for_active (applet, NM_ACTIVE_CONNECTION (vpn));
+       connection = (NMConnection *) nm_active_connection_get_connection (NM_ACTIVE_CONNECTION (vpn));
        s_con = nm_connection_get_setting_connection (connection);
 
        switch (reason) {
@@ -1102,9 +1070,9 @@ make_vpn_disconnection_message (NMVPNConnection *vpn,
 }
 
 static void
-vpn_connection_state_changed (NMVPNConnection *vpn,
-                              NMVPNConnectionState state,
-                              NMVPNConnectionStateReason reason,
+vpn_connection_state_changed (NMVpnConnection *vpn,
+                              NMVpnConnectionState state,
+                              NMVpnConnectionStateReason reason,
                               gpointer user_data)
 {
        NMApplet *applet = NM_APPLET (user_data);
@@ -1185,13 +1153,17 @@ typedef struct {
 } VPNActivateInfo;
 
 static void
-activate_vpn_cb (NMClient *client,
-                 NMActiveConnection *active,
-                 GError *error,
+activate_vpn_cb (GObject *client,
+                 GAsyncResult *result,
                  gpointer user_data)
 {
        VPNActivateInfo *info = (VPNActivateInfo *) user_data;
+       NMActiveConnection *active;
        char *title, *msg, *name;
+       GError *error = NULL;
+
+       active = nm_client_activate_connection_finish (NM_CLIENT (client), result, &error);
+       g_clear_object (&active);
 
        if (error) {
                clear_animation_timeout (info->applet);
@@ -1212,9 +1184,9 @@ activate_vpn_cb (NMClient *client,
 
                applet_do_notify_with_pref (info->applet, title, msg, "gnome-lockscreen",
                                            PREF_DISABLE_VPN_NOTIFICATIONS);
-               g_free (msg);
-
                g_warning ("VPN Connection activation failed: (%s) %s", name, error->message);
+               g_free (msg);
+               g_error_free (error);
        }
 
        applet_schedule_update_icon (info->applet);
@@ -1254,12 +1226,13 @@ nma_menu_vpn_item_clicked (GtkMenuItem *item, gpointer user_data)
        info->vpn_name = g_strdup (nm_setting_connection_get_id (s_con));
 
        /* Connection inactive, activate */
-       nm_client_activate_connection (applet->nm_client,
-                                      connection,
-                                      device,
-                                      nm_object_get_path (NM_OBJECT (active)),
-                                      activate_vpn_cb,
-                                      info);
+       nm_client_activate_connection_async (applet->nm_client,
+                                            connection,
+                                            device,
+                                            nm_object_get_path (NM_OBJECT (active)),
+                                            NULL,
+                                            activate_vpn_cb,
+                                            info);
        start_animation_timeout (applet);
                
 //     nmi_dbus_signal_user_interface_activated (applet->connection);
@@ -1284,7 +1257,7 @@ nma_menu_configure_vpn_item_activate (GtkMenuItem *item, gpointer user_data)
 
 static NMActiveConnection *
 applet_get_first_active_vpn_connection (NMApplet *applet,
-                                        NMVPNConnectionState *out_state)
+                                        NMVpnConnectionState *out_state)
 {
        const GPtrArray *active_list;
        int i;
@@ -1297,7 +1270,7 @@ applet_get_first_active_vpn_connection (NMApplet *applet,
 
                candidate = g_ptr_array_index (active_list, i);
 
-               connection = applet_get_connection_for_active (applet, candidate);
+               connection = (NMConnection *) nm_active_connection_get_connection (candidate);
                if (!connection)
                        continue;
 
@@ -1325,11 +1298,11 @@ nma_menu_disconnect_vpn_item_activate (GtkMenuItem *item, gpointer user_data)
 {
        NMApplet *applet = NM_APPLET (user_data);
        NMActiveConnection *active_vpn = NULL;
-       NMVPNConnectionState state = NM_VPN_CONNECTION_STATE_UNKNOWN;
+       NMVpnConnectionState state = NM_VPN_CONNECTION_STATE_UNKNOWN;
 
        active_vpn = applet_get_first_active_vpn_connection (applet, &state);
        if (active_vpn)
-               nm_client_deactivate_connection (applet->nm_client, active_vpn);
+               nm_client_deactivate_connection (applet->nm_client, active_vpn, NULL, NULL);
        else
                g_warning ("%s: deactivate clicked but no active VPN connection could be found.", __func__);
 //     nmi_dbus_signal_user_interface_activated (applet->connection);
@@ -1378,8 +1351,8 @@ sort_devices_by_description (gconstpointer a, gconstpointer b)
        const char *aa_desc;
        const char *bb_desc;
 
-       aa_desc = nma_utils_get_device_description (aa);
-       bb_desc = nma_utils_get_device_description (bb);
+       aa_desc = nm_device_get_description (aa);
+       bb_desc = nm_device_get_description (bb);
 
        return g_strcmp0 (aa_desc, bb_desc);
 }
@@ -1402,7 +1375,6 @@ applet_find_active_connection_for_device (NMDevice *device,
                                           NMActiveConnection **out_active)
 {
        const GPtrArray *active_connections;
-       NMConnection *connection = NULL;
        int i;
 
        g_return_val_if_fail (NM_IS_DEVICE (device), NULL);
@@ -1411,32 +1383,27 @@ applet_find_active_connection_for_device (NMDevice *device,
                g_return_val_if_fail (*out_active == NULL, NULL);
 
        active_connections = nm_client_get_active_connections (applet->nm_client);
-       for (i = 0; active_connections && (i < active_connections->len); i++) {
-               NMRemoteConnection *tmp;
+       for (i = 0; i < active_connections->len; i++) {
+               NMRemoteConnection *conn;
                NMActiveConnection *active;
-               const char *connection_path;
                const GPtrArray *devices;
 
                active = NM_ACTIVE_CONNECTION (g_ptr_array_index (active_connections, i));
                devices = nm_active_connection_get_devices (active);
-               connection_path = nm_active_connection_get_connection (active);
+               conn = nm_active_connection_get_connection (active);
 
-               if (!devices || !connection_path)
+               if (!devices || !conn)
                        continue;
 
                if (!nm_g_ptr_array_contains (devices, device))
                        continue;
 
-               tmp = nm_remote_settings_get_connection_by_path (applet->settings, connection_path);
-               if (tmp) {
-                       connection = NM_CONNECTION (tmp);
-                       if (out_active)
-                               *out_active = active;
-                       break;
-               }
+               if (out_active)
+                       *out_active = active;
+               return NM_CONNECTION (conn);
        }
 
-       return connection;
+       return NULL;
 }
 
 static NMConnection *
@@ -1445,7 +1412,6 @@ applet_find_active_connection_for_virtual_device (const char *iface,
                                                   NMActiveConnection **out_active)
 {
        const GPtrArray *active_connections;
-       NMConnection *connection = NULL;
        int i;
 
        g_return_val_if_fail (iface != NULL, NULL);
@@ -1454,30 +1420,24 @@ applet_find_active_connection_for_virtual_device (const char *iface,
                g_return_val_if_fail (*out_active == NULL, NULL);
 
        active_connections = nm_client_get_active_connections (applet->nm_client);
-       for (i = 0; active_connections && (i < active_connections->len); i++) {
-               NMRemoteConnection *tmp;
+       for (i = 0; i < active_connections->len; i++) {
+               NMRemoteConnection *conn;
                NMActiveConnection *active;
-               const char *connection_path;
 
                active = NM_ACTIVE_CONNECTION (g_ptr_array_index (active_connections, i));
-               connection_path = nm_active_connection_get_connection (active);
-
-               if (!connection_path)
-                       continue;
+               conn = nm_active_connection_get_connection (active);
 
-               tmp = nm_remote_settings_get_connection_by_path (applet->settings, connection_path);
-               if (!tmp)
+               if (!conn)
                        continue;
 
-               if (!g_strcmp0 (nm_connection_get_virtual_iface_name (NM_CONNECTION (tmp)), iface)) {
-                       connection = NM_CONNECTION (tmp);
+               if (!g_strcmp0 (nm_connection_get_interface_name (NM_CONNECTION (conn)), iface)) {
                        if (out_active)
                                *out_active = active;
-                       break;
+                       return NM_CONNECTION (conn);
                }
        }
 
-       return connection;
+       return NULL;
 }
 
 gboolean
@@ -1580,7 +1540,8 @@ nma_menu_device_get_menu_item (NMDevice *device,
 }
 
 static int
-add_device_items (NMDeviceType type, const GPtrArray *all_devices, GSList *all_connections,
+add_device_items (NMDeviceType type, const GPtrArray *all_devices,
+                  const GPtrArray *all_connections,
                   GtkWidget *menu, NMApplet *applet)
 {
        GSList *devices = NULL, *iter;
@@ -1600,7 +1561,7 @@ add_device_items (NMDeviceType type, const GPtrArray *all_devices, GSList *all_c
                NMDevice *device = iter->data;
                NMADeviceClass *dclass;
                NMConnection *active;
-               GSList *connections;
+               GPtrArray *connections;
 
                dclass = get_device_class (device, applet);
                g_assert (dclass != NULL);
@@ -1610,7 +1571,7 @@ add_device_items (NMDeviceType type, const GPtrArray *all_devices, GSList *all_c
 
                dclass->add_menu_item (device, n_devices > 1, connections, active, menu, applet);
 
-               g_slist_free (connections);
+               g_ptr_array_unref (connections);
        }
 
        g_slist_free (devices);
@@ -1623,58 +1584,54 @@ sort_connections_by_ifname (gconstpointer a, gconstpointer b)
        NMConnection *aa = NM_CONNECTION (a);
        NMConnection *bb = NM_CONNECTION (b);
 
-       return strcmp (nm_connection_get_virtual_iface_name (aa),
-                      nm_connection_get_virtual_iface_name (bb));
+       return strcmp (nm_connection_get_interface_name (aa),
+                      nm_connection_get_interface_name (bb));
 }
 
 static int
 add_virtual_items (const char *type, const GPtrArray *all_devices,
-                   GSList *all_connections, GtkWidget *menu, NMApplet *applet)
+                   const GPtrArray *all_connections, GtkWidget *menu, NMApplet *applet)
 {
-       GSList *iter, *connections = NULL;
-       int n_devices = 0;
+       GPtrArray *connections;
+       int i, n_devices = 0;
 
-       for (iter = all_connections; iter; iter = iter->next) {
-               NMConnection *connection = iter->data;
+       connections = g_ptr_array_sized_new (5);
+       for (i = 0; i < all_connections->len; i++) {
+               NMConnection *connection = all_connections->pdata[i];
 
-               if (!nm_connection_get_virtual_iface_name (connection))
+               if (!nm_connection_get_interface_name (connection))
                        continue;
 
                if (nm_connection_is_type (connection, type))
-                       connections = g_slist_prepend (connections, connection);
+                       g_ptr_array_add (connections, connection);
        }
 
-       if (!connections)
-               return 0;
-
-       connections = g_slist_sort (connections, sort_connections_by_ifname);
+       g_ptr_array_sort (connections, sort_connections_by_ifname);
        /* Count the number of unique interface names */
-       iter = connections;
-       while (iter) {
-               NMConnection *connection = iter->data;
+       for (i = 0; i < connections->len; i++) {
+               NMConnection *connection = connections->pdata[i];
 
                n_devices++;
 
                /* Skip ahead until we find a connection with a different ifname
                 * (or reach the end of the list).
                 */
-               while (iter && sort_connections_by_ifname (connection, iter->data) == 0)
-                       iter = iter->next;
+               while (   i < connections->len
+                      && sort_connections_by_ifname (connection, connections->pdata[i]) == 0)
+                       i++;
        }
 
-
-       iter = connections;
-       while (iter) {
-               NMConnection *connection = iter->data;
+       for (i = 0; i < connections->len; i++) {
+               NMConnection *connection = connections->pdata[i];
                NMDevice *device = NULL;
-               const char *iface = nm_connection_get_virtual_iface_name (connection);
-               GSList *iface_connections = NULL;
+               const char *iface = nm_connection_get_interface_name (connection);
+               GPtrArray *iface_connections;
                NMADeviceClass *dclass;
                NMConnection *active;
-               int i;
+               int d;
 
-               for (i = 0; all_devices && (i < all_devices->len); i++) {
-                       NMDevice *candidate = all_devices->pdata[i];
+               for (d = 0; d < all_devices->len; d++) {
+                       NMDevice *candidate = all_devices->pdata[d];
 
                        if (!strcmp (nm_device_get_iface (candidate), iface)) {
                                device = candidate;
@@ -1682,9 +1639,11 @@ add_virtual_items (const char *type, const GPtrArray *all_devices,
                        }
                }
 
-               while (iter && sort_connections_by_ifname (connection, iter->data) == 0) {
-                       iface_connections = g_slist_prepend (iface_connections, connection);
-                       iter = iter->next;
+               iface_connections = g_ptr_array_sized_new (5);
+               while (   i < connections->len
+                      && sort_connections_by_ifname (connection, connections->pdata[i]) == 0) {
+                       g_ptr_array_add (iface_connections, connections->pdata[i]);
+                       i++;
                }
 
                active = applet_find_active_connection_for_virtual_device (iface, applet, NULL);
@@ -1692,10 +1651,10 @@ add_virtual_items (const char *type, const GPtrArray *all_devices,
                dclass = get_device_class_from_connection (connection, applet);
                dclass->add_menu_item (device, n_devices > 1, iface_connections, active, menu, applet);
 
-               g_slist_free (iface_connections);
+               g_ptr_array_unref (iface_connections);
        }
 
-       g_slist_free (connections);
+       g_ptr_array_unref (connections);
        return n_devices;
 }
 
@@ -1703,7 +1662,7 @@ static void
 nma_menu_add_devices (GtkWidget *menu, NMApplet *applet)
 {
        const GPtrArray *all_devices;
-       GSList *all_connections;
+       GPtrArray *all_connections;
        gint n_items;
 
        all_connections = applet_get_all_connections (applet);
@@ -1729,7 +1688,7 @@ nma_menu_add_devices (GtkWidget *menu, NMApplet *applet)
        n_items += add_device_items  (NM_DEVICE_TYPE_BT,
                                      all_devices, all_connections, menu, applet);
 
-       g_slist_free (all_connections);
+       g_ptr_array_unref (all_connections);
 
        if (!n_items)
                nma_menu_add_text_item (menu, _("No network devices available"));
@@ -1741,17 +1700,17 @@ sort_vpn_connections (gconstpointer a, gconstpointer b)
        return strcmp (get_connection_id (NM_CONNECTION (a)), get_connection_id (NM_CONNECTION (b)));
 }
 
-static GSList *
+static GPtrArray *
 get_vpn_connections (NMApplet *applet)
 {
-       GSList *all_connections;
-       GSList *iter;
-       GSList *list = NULL;
+       GPtrArray *all_connections, *vpn_connections;
+       int i;
 
        all_connections = applet_get_all_connections (applet);
+       vpn_connections = g_ptr_array_new_full (5, g_object_unref);
 
-       for (iter = all_connections; iter; iter = iter->next) {
-               NMConnection *connection = NM_CONNECTION (iter->data);
+       for (i = 0; i < all_connections->len; i++) {
+               NMConnection *connection = NM_CONNECTION (all_connections->pdata[i]);
                NMSettingConnection *s_con;
 
                s_con = nm_connection_get_setting_connection (connection);
@@ -1765,12 +1724,13 @@ get_vpn_connections (NMApplet *applet)
                        continue;
                }
 
-               list = g_slist_prepend (list, connection);
+               g_ptr_array_add (vpn_connections, g_object_ref (connection));
        }
 
-       g_slist_free (all_connections);
+       g_ptr_array_unref (all_connections);
 
-       return g_slist_sort (list, sort_vpn_connections);
+       g_ptr_array_sort (vpn_connections, sort_vpn_connections);
+       return vpn_connections;
 }
 
 static void
@@ -1778,8 +1738,8 @@ nma_menu_add_vpn_submenu (GtkWidget *menu, NMApplet *applet)
 {
        GtkMenu *vpn_menu;
        GtkMenuItem *item;
-       GSList *list, *iter;
-       int num_vpn_active = 0;
+       GPtrArray *list;
+       int i, num_vpn_active = 0;
 
        nma_menu_add_separator_item (menu);
 
@@ -1790,15 +1750,15 @@ nma_menu_add_vpn_submenu (GtkWidget *menu, NMApplet *applet)
        gtk_menu_shell_append (GTK_MENU_SHELL (menu), GTK_WIDGET (item));
 
        list = get_vpn_connections (applet);
-       for (iter = list; iter; iter = g_slist_next (iter)) {
-               NMConnection *connection = NM_CONNECTION (iter->data);
+       for (i = 0; i < list->len; i++) {
+               NMConnection *connection = NM_CONNECTION (list->pdata[i]);
 
                if (applet_get_active_for_connection (applet, connection))
                        num_vpn_active++;
        }
 
-       for (iter = list; iter; iter = g_slist_next (iter)) {
-               NMConnection *connection = NM_CONNECTION (iter->data);
+       for (i = 0; i < list->len; i++) {
+               NMConnection *connection = NM_CONNECTION (list->pdata[i]);
                NMActiveConnection *active;
                const char *name;
                GtkWidget *image;
@@ -1838,8 +1798,8 @@ nma_menu_add_vpn_submenu (GtkWidget *menu, NMApplet *applet)
                gtk_menu_shell_append (GTK_MENU_SHELL (vpn_menu), GTK_WIDGET (item));
        }
 
-       /* Draw a seperator, but only if we have VPN connections above it */
-       if (list)
+       /* Draw a separator, but only if we have VPN connections above it */
+       if (list->len)
                nma_menu_add_separator_item (GTK_WIDGET (vpn_menu));
 
        item = GTK_MENU_ITEM (gtk_menu_item_new_with_mnemonic (_("_Configure VPN...")));
@@ -1852,7 +1812,7 @@ nma_menu_add_vpn_submenu (GtkWidget *menu, NMApplet *applet)
        if (num_vpn_active == 0)
                gtk_widget_set_sensitive (GTK_WIDGET (item), FALSE);
 
-       g_slist_free (list);
+       g_ptr_array_unref (list);
 }
 
 
@@ -1897,7 +1857,7 @@ nma_set_networking_enabled_cb (GtkWidget *widget, NMApplet *applet)
        g_return_if_fail (applet != NULL);
 
        state = gtk_check_menu_item_get_active (GTK_CHECK_MENU_ITEM (widget));
-       nm_client_networking_set_enabled (applet->nm_client, state);
+       nm_client_networking_set_enabled (applet->nm_client, state, NULL);
 }
 
 
@@ -1961,7 +1921,7 @@ static void nma_menu_show_cb (GtkWidget *menu, NMApplet *applet)
 
        gtk_status_icon_set_tooltip_text (applet->status_icon, NULL);
 
-       if (!nm_client_get_manager_running (applet->nm_client)) {
+       if (!nm_client_get_nm_running (applet->nm_client)) {
                nma_menu_add_text_item (menu, _("NetworkManager is not running..."));
                return;
        }
@@ -2311,18 +2271,18 @@ applet_menu_item_activate (GtkMenuItem *item, gpointer user_data)
 
 void
 applet_add_connection_items (NMDevice *device,
-                             GSList *connections,
+                             const GPtrArray *connections,
                              gboolean sensitive,
                              NMConnection *active,
                              NMAAddActiveInactiveEnum flag,
                              GtkWidget *menu,
                              NMApplet *applet)
 {
-       GSList *iter;
+       int i;
        AppletMenuItemInfo *info;
 
-       for (iter = connections; iter; iter = iter->next) {
-               NMConnection *connection = NM_CONNECTION (iter->data);
+       for (i = 0; i < connections->len; i++) {
+               NMConnection *connection = NM_CONNECTION (connections->pdata[i]);
                GtkWidget *item;
 
                if (active == connection) {
@@ -2435,7 +2395,6 @@ applet_get_exported_connection_for_device (NMDevice *device, NMApplet *applet)
        for (i = 0; active_connections && (i < active_connections->len); i++) {
                NMActiveConnection *active;
                NMRemoteConnection *connection;
-               const char *connection_path;
                const GPtrArray *devices;
 
                active = g_ptr_array_index (active_connections, i);
@@ -2443,16 +2402,14 @@ applet_get_exported_connection_for_device (NMDevice *device, NMApplet *applet)
                        continue;
 
                devices = nm_active_connection_get_devices (active);
-               connection_path = nm_active_connection_get_connection (active);
-               if (!devices || !connection_path)
+               connection = nm_active_connection_get_connection (active);
+               if (!devices || !connection)
                        continue;
 
                if (!nm_g_ptr_array_contains (devices, device))
                        continue;
 
-               connection = nm_remote_settings_get_connection_by_path (applet->settings, connection_path);
-               if (connection)
-                       return connection;
+               return connection;
        }
        return NULL;
 }
@@ -2582,7 +2539,7 @@ foo_manager_running_cb (NMClient *client,
 {
        NMApplet *applet = NM_APPLET (user_data);
 
-       if (nm_client_get_manager_running (client)) {
+       if (nm_client_get_nm_running (client)) {
                g_debug ("NM appeared");
        } else {
                g_debug ("NM disappeared");
@@ -2656,7 +2613,7 @@ foo_client_setup (NMApplet *applet)
 {
        NMClientPermission perm;
 
-       applet->nm_client = nm_client_new ();
+       applet->nm_client = nm_client_new (NULL, NULL);
        if (!applet->nm_client)
                return;
 
@@ -2682,7 +2639,7 @@ foo_client_setup (NMApplet *applet)
                applet->permissions[perm] = nm_client_get_permission_result (applet->nm_client, perm);
        }
 
-       if (nm_client_get_manager_running (applet->nm_client))
+       if (nm_client_get_nm_running (applet->nm_client))
                g_idle_add (foo_set_initial_state, applet);
 
        applet_schedule_update_icon (applet);
@@ -2871,28 +2828,12 @@ out:
 }
 
 static char *
-get_tip_for_vpn (NMActiveConnection *active, NMVPNConnectionState state, NMApplet *applet)
+get_tip_for_vpn (NMActiveConnection *active, NMVpnConnectionState state, NMApplet *applet)
 {
        char *tip = NULL;
-       const char *path, *id = NULL;
-       GSList *iter, *list;
-
-       path = nm_active_connection_get_connection (active);
-       g_return_val_if_fail (path != NULL, NULL);
-
-       list = applet_get_all_connections (applet);
-       for (iter = list; iter; iter = g_slist_next (iter)) {
-               NMConnection *candidate = NM_CONNECTION (iter->data);
-               NMSettingConnection *s_con;
-
-               if (!strcmp (nm_connection_get_path (candidate), path)) {
-                       s_con = nm_connection_get_setting_connection (candidate);
-                       id = nm_setting_connection_get_id (s_con);
-                       break;
-               }
-       }
-       g_slist_free (list);
+       const char *id = NULL;
 
+       id = nm_active_connection_get_id (active);
        if (!id)
                return NULL;
 
@@ -2924,13 +2865,13 @@ applet_update_icon (gpointer user_data)
        GdkPixbuf *pixbuf = NULL;
        NMState state;
        char *dev_tip = NULL, *vpn_tip = NULL;
-       NMVPNConnectionState vpn_state = NM_VPN_CONNECTION_STATE_UNKNOWN;
+       NMVpnConnectionState vpn_state = NM_VPN_SERVICE_STATE_UNKNOWN;
        gboolean nm_running;
        NMActiveConnection *active_vpn = NULL;
 
        applet->update_icon_id = 0;
 
-       nm_running = nm_client_get_manager_running (applet->nm_client);
+       nm_running = nm_client_get_nm_running (applet->nm_client);
 
        /* Handle device state first */
 
@@ -3067,7 +3008,7 @@ applet_secrets_request_set_free_func (SecretsRequest *req,
 
 void
 applet_secrets_request_complete (SecretsRequest *req,
-                                 GHashTable *settings,
+                                 GVariant *settings,
                                  GError *error)
 {
        req->callback (req->applet->agent, error ? NULL : settings, error, req->callback_data);
@@ -3079,38 +3020,29 @@ applet_secrets_request_complete_setting (SecretsRequest *req,
                                          GError *error)
 {
        NMSetting *setting;
-       GHashTable *settings = NULL, *secrets;
+       GVariant *secrets_dict = NULL;
 
        if (setting_name && !error) {
                setting = nm_connection_get_setting_by_name (req->connection, setting_name);
                if (setting) {
-                       secrets = nm_setting_to_hash (NM_SETTING (setting), NM_SETTING_HASH_FLAG_ALL);
-                       if (secrets) {
-                               /* Returned secrets are a{sa{sv}}; this is the outer a{s...} hash that
-                                * will contain all the individual settings hashes.
-                                */
-                               settings = g_hash_table_new_full (g_str_hash,
-                                                                 g_str_equal,
-                                                                 g_free,
-                                                                 (GDestroyNotify) g_hash_table_destroy);
-                               g_hash_table_insert (settings, g_strdup (setting_name), secrets);
-                       } else {
+                       secrets_dict = nm_connection_to_dbus (req->connection, NM_CONNECTION_SERIALIZE_ALL);
+                       if (!secrets_dict) {
                                g_set_error (&error,
-                                                    NM_SECRET_AGENT_ERROR,
-                                                    NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
-                                                    "%s.%d (%s): failed to hash setting '%s'.",
-                                                    __FILE__, __LINE__, __func__, setting_name);
+                                            NM_SECRET_AGENT_ERROR,
+                                            NM_SECRET_AGENT_ERROR_FAILED,
+                                            "%s.%d (%s): failed to hash setting '%s'.",
+                                            __FILE__, __LINE__, __func__, setting_name);
                        }
                } else {
                        g_set_error (&error,
-                                        NM_SECRET_AGENT_ERROR,
-                                        NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
-                                        "%s.%d (%s): unhandled setting '%s'",
-                                        __FILE__, __LINE__, __func__, setting_name);
+                                    NM_SECRET_AGENT_ERROR,
+                                    NM_SECRET_AGENT_ERROR_FAILED,
+                                    "%s.%d (%s): unhandled setting '%s'",
+                                    __FILE__, __LINE__, __func__, setting_name);
                }
        }
 
-       req->callback (req->applet->agent, settings, error, req->callback_data);
+       req->callback (req->applet->agent, secrets_dict, error, req->callback_data);
 }
 
 void
@@ -3131,9 +3063,9 @@ applet_secrets_request_free (SecretsRequest *req)
 }
 
 static void
-get_existing_secrets_cb (NMSecretAgent *agent,
+get_existing_secrets_cb (NMSecretAgentOld *agent,
                          NMConnection *connection,
-                         GHashTable *secrets,
+                         GVariant *secrets,
                          GError *secrets_error,
                          gpointer user_data)
 {
@@ -3198,7 +3130,7 @@ applet_agent_get_secrets_cb (AppletAgent *agent,
        dclass = get_device_class_from_connection (connection, applet);
        if (!dclass) {
                error = g_error_new (NM_SECRET_AGENT_ERROR,
-                                    NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+                                    NM_SECRET_AGENT_ERROR_FAILED,
                                     "%s.%d (%s): device type unknown",
                                     __FILE__, __LINE__, __func__);
                goto error;
@@ -3225,13 +3157,13 @@ applet_agent_get_secrets_cb (AppletAgent *agent,
        applet->secrets_reqs = g_slist_prepend (applet->secrets_reqs, req);
 
        /* Get existing secrets, if any */
-       nm_secret_agent_get_secrets (NM_SECRET_AGENT (applet->agent),
-                                            connection,
-                                            setting_name,
-                                            hints,
-                                            NM_SECRET_AGENT_GET_SECRETS_FLAG_NONE,
-                                            get_existing_secrets_cb,
-                                            req);
+       nm_secret_agent_old_get_secrets (NM_SECRET_AGENT_OLD (applet->agent),
+                                        connection,
+                                        setting_name,
+                                        hints,
+                                        NM_SECRET_AGENT_GET_SECRETS_FLAG_NONE,
+                                        get_existing_secrets_cb,
+                                        req);
        return;
 
 error:
@@ -3560,7 +3492,7 @@ shell_version_changed_cb (NMShellWatcher *watcher, GParamSpec *pspec, gpointer u
                        g_signal_handlers_disconnect_by_func (applet->agent,
                                                              G_CALLBACK (applet_agent_cancel_secrets_cb),
                                                              applet);
-                       nm_secret_agent_unregister (NM_SECRET_AGENT (applet->agent));
+                       nm_secret_agent_old_unregister (NM_SECRET_AGENT_OLD (applet->agent), NULL, NULL);
                        g_clear_object (&applet->agent);
                }
 
@@ -3656,7 +3588,6 @@ initable_init (GInitable *initable, GCancellable *cancellable, GError **error)
                g_prefix_error (error, "Failed to initialize D-Bus: ");
                return FALSE;
        }
-       applet->settings = nm_remote_settings_new (NULL);
 
        /* Initialize device classes */
        applet->ethernet_class = applet_device_ethernet_get_class (applet);
@@ -3782,9 +3713,6 @@ static void finalize (GObject *object)
        if (applet->agent)
                g_object_unref (applet->agent);
 
-       if (applet->settings)
-               g_object_unref (applet->settings);
-
        if (applet->session_bus)
                dbus_g_connection_unref (applet->session_bus);
 
diff --git a/src/applet.h b/src/applet.h
index cd5ac97..98ec37c 100644
--- a/src/applet.h
+++ b/src/applet.h
@@ -15,8 +15,8 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * Copyright (C) 2004 - 2011 Red Hat, Inc.
- * Copyright (C) 2005 - 2008 Novell, Inc.
+ * Copyright 2004 - 2014 Red Hat, Inc.
+ * Copyright 2005 - 2008 Novell, Inc.
  */
 
 #ifndef APPLET_H
@@ -36,13 +36,8 @@
 
 #include <libnotify/notify.h>
 
-#include <nm-connection.h>
-#include <nm-client.h>
-#include <nm-access-point.h>
-#include <nm-device.h>
 #include <NetworkManager.h>
-#include <nm-active-connection.h>
-#include <nm-remote-settings.h>
+
 #include "applet-agent.h"
 #include "shell-watcher.h"
 
@@ -91,7 +86,6 @@ typedef struct
        guint agent_start_id;
 
        NMClient *nm_client;
-       NMRemoteSettings *settings;
        AppletAgent *agent;
 
        GSettings *gsettings;
@@ -220,7 +214,7 @@ struct _SecretsRequest {
 void applet_secrets_request_set_free_func (SecretsRequest *req,
                                            SecretsRequestFreeFunc free_func);
 void applet_secrets_request_complete (SecretsRequest *req,
-                                      GHashTable *settings,
+                                      GVariant *settings,
                                       GError *error);
 void applet_secrets_request_complete_setting (SecretsRequest *req,
                                               const char *setting_name,
@@ -235,7 +229,7 @@ struct NMADeviceClass {
 
        void           (*add_menu_item)        (NMDevice *device,
                                                gboolean multiple_devices,
-                                               GSList *connections,
+                                               const GPtrArray *connections,
                                                NMConnection *active,
                                                GtkWidget *menu,
                                                NMApplet *applet);
@@ -272,9 +266,9 @@ NMApplet *nm_applet_new (void);
 
 void applet_schedule_update_icon (NMApplet *applet);
 
-NMRemoteSettings *applet_get_settings (NMApplet *applet);
+NMClient *applet_get_settings (NMApplet *applet);
 
-GSList *applet_get_all_connections (NMApplet *applet);
+GPtrArray *applet_get_all_connections (NMApplet *applet);
 
 gboolean nma_menu_device_check_unusable (NMDevice *device);
 
@@ -346,7 +340,7 @@ typedef enum {
 } NMAAddActiveInactiveEnum;
 
 void applet_add_connection_items (NMDevice *device,
-                                  GSList *connections,
+                                  const GPtrArray *connections,
                                   gboolean sensitive,
                                   NMConnection *active,
                                   NMAAddActiveInactiveEnum flag,
diff --git a/src/ethernet-dialog.c b/src/ethernet-dialog.c
index 9fd7c1a..a35ae61 100644
--- a/src/ethernet-dialog.c
+++ b/src/ethernet-dialog.c
@@ -17,8 +17,8 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * (C) Copyright 2008 Novell, Inc.
- * (C) Copyright 2008 - 2011 Red Hat, Inc.
+ * Copyright 2008 Novell, Inc.
+ * Copyright 2008 - 2014 Red Hat, Inc.
  */
 
 #ifdef HAVE_CONFIG_H
@@ -26,10 +26,7 @@
 #endif
 
 #include <glib/gi18n.h>
-#include <nm-setting-connection.h>
-#include <nm-setting-8021x.h>
-#include <nm-setting-wireless.h>
-#include <nm-utils.h>
+
 #include "ethernet-dialog.h"
 #include "wireless-security.h"
 #include "applet-dialogs.h"
@@ -142,7 +139,7 @@ nma_ethernet_dialog_get_connection (GtkWidget *dialog)
        /* Here's a nice hack to work around the fact that ws_802_1x_fill_connection()
         * needs a wireless setting and a connection setting for various things.
         */
-       tmp_connection = nm_connection_new ();
+       tmp_connection = nm_simple_connection_new ();
 
        /* Add the fake connection setting (mainly for the UUID for cert ignore checking) */
        s_con = nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
diff --git a/src/ethernet-dialog.h b/src/ethernet-dialog.h
index 8e2f198..b2a685f 100644
--- a/src/ethernet-dialog.h
+++ b/src/ethernet-dialog.h
@@ -17,15 +17,16 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * (C) Copyright 2008 Novell, Inc.
- * (C) Copyright 2008 - 2011 Red Hat, Inc.
+ * Copyright 2008 Novell, Inc.
+ * Copyright 2008 - 2014 Red Hat, Inc.
  */
 
 #ifndef ETHERNET_DIALOG_H
 #define ETHERNET_DIALOG_H
 
 #include <gtk/gtk.h>
-#include <nm-connection.h>
+
+#include <NetworkManager.h>
 
 GtkWidget *nma_ethernet_dialog_new (NMConnection *connection);
 
diff --git a/src/mobile-helpers.c b/src/mobile-helpers.c
index b8f8d5c..7d806f9 100644
--- a/src/mobile-helpers.c
+++ b/src/mobile-helpers.c
@@ -17,12 +17,11 @@
  * with this program; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *
- * (C) Copyright 2010 Red Hat, Inc.
+ * Copyright 2010 - 2014 Red Hat, Inc.
  */
 
 #include <ctype.h>
 #include <glib/gi18n.h>
-#include <nm-utils.h>
 
 #define SECRET_API_SUBJECT_TO_CHANGE
 #include <libsecret/secret.h>
@@ -163,7 +162,7 @@ mobile_wizard_done (NMAMobileWizard *wizard,
                        goto done;
                }
 
-               connection = nm_connection_new ();
+               connection = nm_simple_connection_new ();
 
                if (method->devtype == NM_DEVICE_MODEM_CAPABILITY_CDMA_EVDO) {
                        setting_name = NM_SETTING_CDMA_SETTING_NAME;
@@ -375,7 +374,7 @@ get_secrets_cb (GtkDialog *dialog,
                                              NULL);
                        } else {
                                error = g_error_new (NM_SECRET_AGENT_ERROR,
-                                                    NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+                                                    NM_SECRET_AGENT_ERROR_FAILED,
                                                     "%s.%d (%s): no GSM setting",
                                                     __FILE__, __LINE__, __func__);
                        }
@@ -389,7 +388,7 @@ get_secrets_cb (GtkDialog *dialog,
                                                      NULL);
                                } else {
                                        error = g_error_new (NM_SECRET_AGENT_ERROR,
-                                                            NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+                                                            NM_SECRET_AGENT_ERROR_FAILED,
                                                             "%s.%d (%s): no CDMA setting",
                                                             __FILE__, __LINE__, __func__);
                                }
@@ -496,7 +495,7 @@ mobile_helper_get_secrets (NMDeviceModemCapabilities capabilities,
        if (!req->hints || !g_strv_length (req->hints)) {
                g_set_error (error,
                             NM_SECRET_AGENT_ERROR,
-                            NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+                            NM_SECRET_AGENT_ERROR_FAILED,
                             "%s.%d (%s): missing secrets hints.",
                             __FILE__, __LINE__, __func__);
                return FALSE;
@@ -514,7 +513,7 @@ mobile_helper_get_secrets (NMDeviceModemCapabilities capabilities,
        else {
                g_set_error (error,
                             NM_SECRET_AGENT_ERROR,
-                            NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+                            NM_SECRET_AGENT_ERROR_FAILED,
                             "%s.%d (%s): unknown modem capabilities (0x%X).",
                             __FILE__, __LINE__, __func__, capabilities);
                return FALSE;
@@ -528,7 +527,7 @@ mobile_helper_get_secrets (NMDeviceModemCapabilities capabilities,
        else {
                g_set_error (error,
                             NM_SECRET_AGENT_ERROR,
-                            NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+                            NM_SECRET_AGENT_ERROR_FAILED,
                             "%s.%d (%s): unknown secrets hint '%s'.",
                             __FILE__, __LINE__, __func__, info->secret_name);
                return FALSE;
@@ -539,7 +538,7 @@ mobile_helper_get_secrets (NMDeviceModemCapabilities capabilities,
        if (!widget || !secret_entry) {
                g_set_error (error,
                             NM_SECRET_AGENT_ERROR,
-                            NM_SECRET_AGENT_ERROR_INTERNAL_ERROR,
+                            NM_SECRET_AGENT_ERROR_FAILED,
                             "%s.%d (%s): error asking for mobile secrets.",
                             __FILE__, __LINE__, __func__);
                return FALSE;
diff --git a/src/mobile-helpers.h b/src/mobile-helpers.h
index ce20135..82c8daf 100644
--- a/src/mobile-helpers.h
+++ b/src/mobile-helpers.h
@@ -28,8 +28,8 @@
 #include <libsecret/secret.h>
 
 #include "applet.h"
-#include "nm-mobile-wizard.h"
-#include "nm-mobile-providers.h"
+#include "nma-mobile-wizard.h"
+#include "nma-mobile-providers.h"
 
 enum {
        MB_STATE_UNKNOWN = 0,


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