summary refs log tree commit diff
path: root/src/devices/bluetooth
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/bluetooth')
-rw-r--r--src/devices/bluetooth/Makefile.am18
-rw-r--r--src/devices/bluetooth/Makefile.in39
-rw-r--r--src/devices/bluetooth/nm-bluez-common.h2
-rw-r--r--src/devices/bluetooth/nm-bluez-device.c48
-rw-r--r--src/devices/bluetooth/nm-bluez-device.h6
-rw-r--r--src/devices/bluetooth/nm-bluez-manager.c28
-rw-r--r--src/devices/bluetooth/nm-bluez-manager.h3
-rw-r--r--src/devices/bluetooth/nm-bluez4-adapter.c95
-rw-r--r--src/devices/bluetooth/nm-bluez4-adapter.h3
-rw-r--r--src/devices/bluetooth/nm-bluez4-manager.c173
-rw-r--r--src/devices/bluetooth/nm-bluez4-manager.h7
-rw-r--r--src/devices/bluetooth/nm-bluez5-dun.c7
-rw-r--r--src/devices/bluetooth/nm-bluez5-dun.h3
-rw-r--r--src/devices/bluetooth/nm-bluez5-manager.c130
-rw-r--r--src/devices/bluetooth/nm-bluez5-manager.h7
-rw-r--r--src/devices/bluetooth/nm-bt-enum-types.c2
-rw-r--r--src/devices/bluetooth/nm-bt-error.c2
-rw-r--r--src/devices/bluetooth/nm-device-bt-glue.h73
-rw-r--r--src/devices/bluetooth/nm-device-bt.c107
-rw-r--r--src/devices/bluetooth/nm-device-bt.h2
20 files changed, 251 insertions, 504 deletions
diff --git a/src/devices/bluetooth/Makefile.am b/src/devices/bluetooth/Makefile.am
index e6e378f0..2054ea0f 100644
--- a/src/devices/bluetooth/Makefile.am
+++ b/src/devices/bluetooth/Makefile.am
@@ -9,25 +9,22 @@ AM_CPPFLAGS = \
 	-I${top_srcdir}/src/settings \
 	-I${top_srcdir}/src/platform \
 	-I${top_srcdir}/src/devices/wwan \
-	-I${top_srcdir}/include \
-	-I$(top_builddir)/include \
+	-I${top_builddir}/introspection \
+	-I${top_srcdir}/shared \
+	-I$(top_builddir)/shared \
 	-I${top_builddir}/libnm-core \
 	-I${top_srcdir}/libnm-core \
 	-DG_LOG_DOMAIN=\""NetworkManager-bluetooth"\" \
-	-DNETWORKMANAGER_COMPILATION \
+	-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_INSIDE_DAEMON \
 	-DNM_VERSION_MAX_ALLOWED=NM_VERSION_NEXT_STABLE \
-	$(GLIB_CFLAGS) \
-	$(DBUS_CFLAGS)
+	$(GLIB_CFLAGS)
 
 GLIB_GENERATED = nm-bt-enum-types.h nm-bt-enum-types.c
 GLIB_MKENUMS_H_FLAGS = --identifier-prefix NM
 GLIB_MKENUMS_C_FLAGS = --identifier-prefix NM
 nm_bt_enum_types_sources = $(srcdir)/nm-bt-error.h
 
-nm-device-bt-glue.h: $(top_srcdir)/introspection/nm-device-bt.xml
-	dbus-binding-tool --prefix=nm_device_bt --mode=glib-server --output=$@ $<
-
-BUILT_SOURCES = $(GLIB_GENERATED) nm-device-bt-glue.h
+BUILT_SOURCES = $(GLIB_GENERATED)
 
 pkglib_LTLIBRARIES = libnm-device-plugin-bluetooth.la
 
@@ -58,8 +55,9 @@ libnm_device_plugin_bluetooth_la_LDFLAGS = \
 	-Wl,--version-script=$(SYMBOL_VIS_FILE)
 
 libnm_device_plugin_bluetooth_la_LIBADD = \
+	$(top_builddir)/introspection/libnmdbus.la \
 	$(top_builddir)/src/devices/wwan/libnm-wwan.la \
-	$(DBUS_LIBS) \
+	$(GLIB_LIBS) \
 	$(GUDEV_LIBS)
 
 if WITH_BLUEZ5_DUN
diff --git a/src/devices/bluetooth/Makefile.in b/src/devices/bluetooth/Makefile.in
index bdc3b5cb..f93f7242 100644
--- a/src/devices/bluetooth/Makefile.in
+++ b/src/devices/bluetooth/Makefile.in
@@ -148,6 +148,7 @@ LTLIBRARIES = $(pkglib_LTLIBRARIES)
 am__DEPENDENCIES_1 =
 @WITH_BLUEZ5_DUN_TRUE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1)
 libnm_device_plugin_bluetooth_la_DEPENDENCIES =  \
+	$(top_builddir)/introspection/libnmdbus.la \
 	$(top_builddir)/src/devices/wwan/libnm-wwan.la \
 	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
 	$(am__DEPENDENCIES_2)
@@ -157,8 +158,7 @@ am__libnm_device_plugin_bluetooth_la_SOURCES_DIST =  \
 	nm-bluez4-adapter.h nm-bluez4-manager.c nm-bluez4-manager.h \
 	nm-bluez5-manager.c nm-bluez5-manager.h nm-bt-error.h \
 	nm-bt-error.c nm-device-bt.c nm-device-bt.h nm-bt-enum-types.h \
-	nm-bt-enum-types.c nm-device-bt-glue.h nm-bluez5-dun.c \
-	nm-bluez5-dun.h
+	nm-bt-enum-types.c nm-bluez5-dun.c nm-bluez5-dun.h
 am__objects_1 = nm-bt-enum-types.lo
 am__objects_2 = $(am__objects_1)
 @WITH_BLUEZ5_DUN_TRUE@am__objects_3 = nm-bluez5-dun.lo
@@ -254,7 +254,6 @@ BLUEZ5_LIBS = @BLUEZ5_LIBS@
 CC = @CC@
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
-CKDB_PATH = @CKDB_PATH@
 CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@
 CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@
 CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@
@@ -266,8 +265,6 @@ CXXDEPMODE = @CXXDEPMODE@
 CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
 DBUS_CFLAGS = @DBUS_CFLAGS@
-DBUS_GLIB_100_CFLAGS = @DBUS_GLIB_100_CFLAGS@
-DBUS_GLIB_100_LIBS = @DBUS_GLIB_100_LIBS@
 DBUS_LIBS = @DBUS_LIBS@
 DBUS_SYS_DIR = @DBUS_SYS_DIR@
 DEFS = @DEFS@
@@ -277,6 +274,7 @@ DHCPCD_PATH = @DHCPCD_PATH@
 DISTRO_NETWORK_SERVICE = @DISTRO_NETWORK_SERVICE@
 DLLTOOL = @DLLTOOL@
 DNSMASQ_PATH = @DNSMASQ_PATH@
+DNSSEC_TRIGGER_SCRIPT = @DNSSEC_TRIGGER_SCRIPT@
 DSYMUTIL = @DSYMUTIL@
 DUMPBIN = @DUMPBIN@
 ECHO_C = @ECHO_C@
@@ -331,16 +329,13 @@ INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@
 INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@
 INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@
 IPTABLES_PATH = @IPTABLES_PATH@
-IWMX_SDK_CFLAGS = @IWMX_SDK_CFLAGS@
-IWMX_SDK_LIBS = @IWMX_SDK_LIBS@
 KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@
 LCOV = @LCOV@
 LD = @LD@
 LDFLAGS = @LDFLAGS@
+LIBAUDIT_CFLAGS = @LIBAUDIT_CFLAGS@
+LIBAUDIT_LIBS = @LIBAUDIT_LIBS@
 LIBDL = @LIBDL@
-LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
-LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
-LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
 LIBICONV = @LIBICONV@
 LIBINTL = @LIBINTL@
 LIBM = @LIBM@
@@ -377,6 +372,8 @@ NEWT_LIBS = @NEWT_LIBS@
 NM = @NM@
 NMEDIT = @NMEDIT@
 NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@
+NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@
+NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@
 NM_MAJOR_VERSION = @NM_MAJOR_VERSION@
 NM_MICRO_VERSION = @NM_MICRO_VERSION@
 NM_MINOR_VERSION = @NM_MINOR_VERSION@
@@ -405,7 +402,6 @@ POLKIT_LIBS = @POLKIT_LIBS@
 POSUB = @POSUB@
 PPPD_PATH = @PPPD_PATH@
 PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@
-PPPOE_PATH = @PPPOE_PATH@
 QT_CFLAGS = @QT_CFLAGS@
 QT_LIBS = @QT_LIBS@
 RANLIB = @RANLIB@
@@ -420,6 +416,8 @@ SYSTEMD_200_CFLAGS = @SYSTEMD_200_CFLAGS@
 SYSTEMD_200_LIBS = @SYSTEMD_200_LIBS@
 SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@
 SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@
+SYSTEMD_JOURNAL_CFLAGS = @SYSTEMD_JOURNAL_CFLAGS@
+SYSTEMD_JOURNAL_LIBS = @SYSTEMD_JOURNAL_LIBS@
 SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@
 SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@
 SYSTEM_CA_PATH = @SYSTEM_CA_PATH@
@@ -480,6 +478,7 @@ mkdir_p = @mkdir_p@
 nmbinary = @nmbinary@
 nmconfdir = @nmconfdir@
 nmdatadir = @nmdatadir@
+nmlibdir = @nmlibdir@
 nmrundir = @nmrundir@
 nmstatedir = @nmstatedir@
 oldincludedir = @oldincludedir@
@@ -487,6 +486,7 @@ pdfdir = @pdfdir@
 prefix = @prefix@
 program_transform_name = @program_transform_name@
 psdir = @psdir@
+runstatedir = @runstatedir@
 sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 srcdir = @srcdir@
@@ -505,17 +505,18 @@ with_valgrind = @with_valgrind@
 AM_CPPFLAGS = -I${top_srcdir}/src -I${top_builddir}/src \
 	-I${top_srcdir}/src/devices -I${top_srcdir}/src/settings \
 	-I${top_srcdir}/src/platform -I${top_srcdir}/src/devices/wwan \
-	-I${top_srcdir}/include -I$(top_builddir)/include \
-	-I${top_builddir}/libnm-core -I${top_srcdir}/libnm-core \
+	-I${top_builddir}/introspection -I${top_srcdir}/shared \
+	-I$(top_builddir)/shared -I${top_builddir}/libnm-core \
+	-I${top_srcdir}/libnm-core \
 	-DG_LOG_DOMAIN=\""NetworkManager-bluetooth"\" \
-	-DNETWORKMANAGER_COMPILATION \
+	-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_INSIDE_DAEMON \
 	-DNM_VERSION_MAX_ALLOWED=NM_VERSION_NEXT_STABLE $(GLIB_CFLAGS) \
-	$(DBUS_CFLAGS) $(am__append_1)
+	$(am__append_1)
 GLIB_GENERATED = nm-bt-enum-types.h nm-bt-enum-types.c
 GLIB_MKENUMS_H_FLAGS = --identifier-prefix NM
 GLIB_MKENUMS_C_FLAGS = --identifier-prefix NM
 nm_bt_enum_types_sources = $(srcdir)/nm-bt-error.h
-BUILT_SOURCES = $(GLIB_GENERATED) nm-device-bt-glue.h
+BUILT_SOURCES = $(GLIB_GENERATED)
 pkglib_LTLIBRARIES = libnm-device-plugin-bluetooth.la
 SYMBOL_VIS_FILE = $(srcdir)/exports.ver
 libnm_device_plugin_bluetooth_la_SOURCES = nm-bluez-manager.c \
@@ -529,7 +530,8 @@ libnm_device_plugin_bluetooth_la_LDFLAGS = \
 	-Wl,--version-script=$(SYMBOL_VIS_FILE)
 
 libnm_device_plugin_bluetooth_la_LIBADD =  \
-	$(top_builddir)/src/devices/wwan/libnm-wwan.la $(DBUS_LIBS) \
+	$(top_builddir)/introspection/libnmdbus.la \
+	$(top_builddir)/src/devices/wwan/libnm-wwan.la $(GLIB_LIBS) \
 	$(GUDEV_LIBS) $(am__append_3)
 CLEANFILES = $(BUILT_SOURCES)
 EXTRA_DIST = $(SYMBOL_VIS_FILE)
@@ -868,9 +870,6 @@ include $(GLIB_MAKEFILE)
 
 @GNOME_CODE_COVERAGE_RULES@
 
-nm-device-bt-glue.h: $(top_srcdir)/introspection/nm-device-bt.xml
-	dbus-binding-tool --prefix=nm_device_bt --mode=glib-server --output=$@ $<
-
 @ENABLE_TESTS_TRUE@check-local:
 @ENABLE_TESTS_TRUE@	$(top_srcdir)/tools/check-exports.sh $(builddir)/.libs/libnm-device-plugin-bluetooth.so $(SYMBOL_VIS_FILE)
 
diff --git a/src/devices/bluetooth/nm-bluez-common.h b/src/devices/bluetooth/nm-bluez-common.h
index f0cab43b..4262fa76 100644
--- a/src/devices/bluetooth/nm-bluez-common.h
+++ b/src/devices/bluetooth/nm-bluez-common.h
@@ -21,7 +21,7 @@
 #ifndef __NETWORKMANAGER_BLUEZ_COMMON_H__
 #define __NETWORKMANAGER_BLUEZ_COMMON_H__
 
-#include <config.h>
+#include "config.h"
 
 #define BLUETOOTH_CONNECT_DUN "dun"
 #define BLUETOOTH_CONNECT_NAP "nap"
diff --git a/src/devices/bluetooth/nm-bluez-device.c b/src/devices/bluetooth/nm-bluez-device.c
index 89ad8270..b7032143 100644
--- a/src/devices/bluetooth/nm-bluez-device.c
+++ b/src/devices/bluetooth/nm-bluez-device.c
@@ -21,17 +21,14 @@
 
 #include "config.h"
 
-#include <glib.h>
-#include <glib/gi18n.h>
-#include <gio/gio.h>
 #include <string.h>
 
+#include "nm-default.h"
 #include "nm-core-internal.h"
 
 #include "nm-bt-error.h"
 #include "nm-bluez-common.h"
 #include "nm-bluez-device.h"
-#include "nm-logging.h"
 #include "nm-settings-connection.h"
 #include "NetworkManagerUtils.h"
 
@@ -869,21 +866,14 @@ properties_changed (GDBusProxy *proxy,
 
 static void
 bluez4_property_changed (GDBusProxy *proxy,
-                         const char *sender,
-                         const char *signal_name,
-                         GVariant   *parameters,
-                         gpointer user_data)
+                         const char *property,
+                         GVariant   *v,
+                         gpointer    user_data)
 {
 	NMBluezDevice *self = NM_BLUEZ_DEVICE (user_data);
 
-	if (g_strcmp0 (signal_name, "PropertyChanged") == 0) {
-		const char *property = NULL;
-		GVariant *v = NULL;
-
-		g_variant_get (parameters, "(&sv)", &property, &v);
-		_take_one_variant_property (self, property, v);
-		check_emit_usable (self);
-	}
+	_take_one_variant_property (self, property, v);
+	check_emit_usable (self);
 }
 
 static void
@@ -893,27 +883,22 @@ get_properties_cb_4 (GObject *source_object, GAsyncResult *res, gpointer user_da
 	NMBluezDevicePrivate *priv = NM_BLUEZ_DEVICE_GET_PRIVATE (self);
 	GError *err = NULL;
 	GVariant *v_properties, *v_dict;
-	GVariantType *v_type;
 
-	v_properties = g_dbus_proxy_call_finish (priv->proxy, res, &err);
+	v_properties = _nm_dbus_proxy_call_finish (priv->proxy, res,
+	                                           G_VARIANT_TYPE ("(a{sv})"),
+	                                           &err);
 	if (!v_properties) {
+		g_dbus_error_strip_remote_error (err);
 		nm_log_warn (LOGD_BT, "bluez[%s] error getting device properties: %s",
-		             priv->path, err && err->message ? err->message : "(unknown)");
+		             priv->path, err->message);
 		g_error_free (err);
 		g_signal_emit (self, signals[INITIALIZED], 0, FALSE);
 		goto END;
 	}
 
-	v_type = g_variant_type_new ("(a{sv})");
-	if (g_variant_is_of_type (v_properties, v_type)) {
-		v_dict = g_variant_get_child_value (v_properties, 0);
-		_set_properties (self, v_dict);
-		g_variant_unref (v_dict);
-	} else {
-		nm_log_warn (LOGD_BT, "bluez[%s] GetProperties returns unexpected result of type %s", priv->path, g_variant_get_type_string (v_properties));
-	}
-	g_variant_type_free (v_type);
-
+	v_dict = g_variant_get_child_value (v_properties, 0);
+	_set_properties (self, v_dict);
+	g_variant_unref (v_dict);
 	g_variant_unref (v_properties);
 
 	/* Check if any connections match this device */
@@ -922,7 +907,6 @@ get_properties_cb_4 (GObject *source_object, GAsyncResult *res, gpointer user_da
 	priv->initialized = TRUE;
 	g_signal_emit (self, signals[INITIALIZED], 0, TRUE);
 
-
 	check_emit_usable (self);
 
 END:
@@ -990,8 +974,8 @@ on_proxy_acquired (GObject *object, GAsyncResult *res, NMBluezDevice *self)
 		                  G_CALLBACK (properties_changed), self);
 		if (priv->bluez_version == 4) {
 			/* Watch for custom Bluez4 PropertyChanged signals */
-			g_signal_connect (priv->proxy, "g-signal",
-			                  G_CALLBACK (bluez4_property_changed), self);
+			_nm_dbus_signal_connect (priv->proxy, "PropertyChanged", G_VARIANT_TYPE ("(sv)"),
+			                         G_CALLBACK (bluez4_property_changed), self);
 		}
 
 		query_properties (self);
diff --git a/src/devices/bluetooth/nm-bluez-device.h b/src/devices/bluetooth/nm-bluez-device.h
index 92d99fa7..0e54fcb0 100644
--- a/src/devices/bluetooth/nm-bluez-device.h
+++ b/src/devices/bluetooth/nm-bluez-device.h
@@ -21,11 +21,9 @@
 #ifndef __NETWORKMANAGER_BLUEZ_DEVICE_H__
 #define __NETWORKMANAGER_BLUEZ_DEVICE_H__
 
-#include <glib.h>
-#include <glib-object.h>
-#include <gio/gio.h>
 
-#include <config.h>
+#include "config.h"
+#include "nm-default.h"
 #include "nm-connection.h"
 #include "nm-connection-provider.h"
 
diff --git a/src/devices/bluetooth/nm-bluez-manager.c b/src/devices/bluetooth/nm-bluez-manager.c
index df4eb46d..6903356c 100644
--- a/src/devices/bluetooth/nm-bluez-manager.c
+++ b/src/devices/bluetooth/nm-bluez-manager.c
@@ -24,9 +24,8 @@
 #include <string.h>
 #include <stdlib.h>
 #include <gmodule.h>
-#include <gio/gio.h>
 
-#include "nm-logging.h"
+#include "nm-default.h"
 #include "nm-bluez-manager.h"
 #include "nm-device-factory.h"
 #include "nm-setting-bluetooth.h"
@@ -36,9 +35,9 @@
 #include "nm-bluez-common.h"
 #include "nm-connection-provider.h"
 #include "nm-device-bt.h"
-
-#include "nm-dbus-manager.h"
+#include "nm-core-internal.h"
 #include "nm-platform.h"
+#include "nm-dbus-compat.h"
 
 typedef struct {
 	int bluez_version;
@@ -57,7 +56,7 @@ typedef struct {
 
 static GType nm_bluez_manager_get_type (void);
 
-static void device_factory_interface_init (NMDeviceFactory *factory_iface);
+static void device_factory_interface_init (NMDeviceFactoryInterface *factory_iface);
 
 G_DEFINE_TYPE_EXTENDED (NMBluezManager, nm_bluez_manager, G_TYPE_OBJECT, 0,
                         G_IMPLEMENT_INTERFACE (NM_TYPE_DEVICE_FACTORY, device_factory_interface_init))
@@ -278,10 +277,13 @@ check_bluez_and_try_setup_do_introspect (GObject *source_object,
 
 	g_clear_object (&priv->async_cancellable);
 
-	result = g_dbus_proxy_call_finish (priv->introspect_proxy, res, &error);
-
+	result = _nm_dbus_proxy_call_finish (priv->introspect_proxy, res,
+	                                     G_VARIANT_TYPE ("(s)"), &error);
 	if (!result) {
-		char *reason2 = g_strdup_printf ("introspect failed with %s", error->message);
+		char *reason2;
+
+		g_dbus_error_strip_remote_error (error);
+		reason2 = g_strdup_printf ("introspect failed with %s", error->message);
 		check_bluez_and_try_setup_final_step (self, 0, reason2);
 		g_error_free (error);
 		g_free (reason2);
@@ -407,7 +409,11 @@ nm_bluez_manager_init (NMBluezManager *self)
 }
 
 static NMDevice *
-new_link (NMDeviceFactory *factory, NMPlatformLink *plink, gboolean *out_ignore, GError **error)
+create_device (NMDeviceFactory *factory,
+               const char *iface,
+               const NMPlatformLink *plink,
+               NMConnection *connection,
+               gboolean *out_ignore)
 {
 	g_warn_if_fail (plink->type == NM_LINK_TYPE_BNEP);
 	*out_ignore = TRUE;
@@ -415,10 +421,10 @@ new_link (NMDeviceFactory *factory, NMPlatformLink *plink, gboolean *out_ignore,
 }
 
 static void
-device_factory_interface_init (NMDeviceFactory *factory_iface)
+device_factory_interface_init (NMDeviceFactoryInterface *factory_iface)
 {
 	factory_iface->get_supported_types = get_supported_types;
-	factory_iface->new_link = new_link;
+	factory_iface->create_device = create_device;
 	factory_iface->start = start;
 }
 
diff --git a/src/devices/bluetooth/nm-bluez-manager.h b/src/devices/bluetooth/nm-bluez-manager.h
index 8320b298..1f5597d8 100644
--- a/src/devices/bluetooth/nm-bluez-manager.h
+++ b/src/devices/bluetooth/nm-bluez-manager.h
@@ -22,8 +22,7 @@
 #ifndef __NETWORKMANAGER_BLUEZ_MANAGER_H__
 #define __NETWORKMANAGER_BLUEZ_MANAGER_H__
 
-#include <glib.h>
-#include <glib-object.h>
+#include "nm-default.h"
 
 G_BEGIN_DECLS
 
diff --git a/src/devices/bluetooth/nm-bluez4-adapter.c b/src/devices/bluetooth/nm-bluez4-adapter.c
index 9d1cfe1f..04ae833a 100644
--- a/src/devices/bluetooth/nm-bluez4-adapter.c
+++ b/src/devices/bluetooth/nm-bluez4-adapter.c
@@ -20,17 +20,14 @@
 
 #include "config.h"
 
-#include <glib.h>
 #include <string.h>
 
+#include "nm-default.h"
 #include "nm-dbus-interface.h"
-#include "nm-dbus-manager.h"
 #include "nm-bluez4-adapter.h"
 #include "nm-bluez-device.h"
 #include "nm-bluez-common.h"
-#include "nm-dbus-glib-types.h"
-#include "nm-logging.h"
-
+#include "nm-core-internal.h"
 
 G_DEFINE_TYPE (NMBluez4Adapter, nm_bluez4_adapter, G_TYPE_OBJECT)
 
@@ -38,7 +35,7 @@ G_DEFINE_TYPE (NMBluez4Adapter, nm_bluez4_adapter, G_TYPE_OBJECT)
 
 typedef struct {
 	char *path;
-	DBusGProxy *proxy;
+	GDBusProxy *proxy;
 	gboolean initialized;
 
 	char *address;
@@ -158,7 +155,7 @@ device_do_remove (NMBluez4Adapter *self, NMBluezDevice *device)
 }
 
 static void
-device_created (DBusGProxy *proxy, const char *path, gpointer user_data)
+device_created (GDBusProxy *proxy, const char *path, gpointer user_data)
 {
 	NMBluez4Adapter *self = NM_BLUEZ4_ADAPTER (user_data);
 	NMBluez4AdapterPrivate *priv = NM_BLUEZ4_ADAPTER_GET_PRIVATE (self);
@@ -173,7 +170,7 @@ device_created (DBusGProxy *proxy, const char *path, gpointer user_data)
 }
 
 static void
-device_removed (DBusGProxy *proxy, const char *path, gpointer user_data)
+device_removed (GDBusProxy *proxy, const char *path, gpointer user_data)
 {
 	NMBluez4Adapter *self = NM_BLUEZ4_ADAPTER (user_data);
 	NMBluez4AdapterPrivate *priv = NM_BLUEZ4_ADAPTER_GET_PRIVATE (self);
@@ -186,37 +183,36 @@ device_removed (DBusGProxy *proxy, const char *path, gpointer user_data)
 		device_do_remove (self, device);
 }
 
-
 static void
-get_properties_cb (DBusGProxy *proxy, DBusGProxyCall *call, gpointer user_data)
+get_properties_cb (GObject *proxy, GAsyncResult *result, gpointer user_data)
 {
 	NMBluez4Adapter *self = NM_BLUEZ4_ADAPTER (user_data);
 	NMBluez4AdapterPrivate *priv = NM_BLUEZ4_ADAPTER_GET_PRIVATE (self);
-	GHashTable *properties = NULL;
 	GError *err = NULL;
-	GValue *value;
-	GPtrArray *devices;
+	GVariant *ret, *properties;
+	char **devices;
 	int i;
 
-	if (!dbus_g_proxy_end_call (proxy, call, &err,
-	                            DBUS_TYPE_G_MAP_OF_VARIANT, &properties,
-	                            G_TYPE_INVALID)) {
-		nm_log_warn (LOGD_BT, "bluez error getting adapter properties: %s",
-		             err && err->message ? err->message : "(unknown)");
+	ret = _nm_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), result,
+	                                  G_VARIANT_TYPE ("(a{sv})"), &err);
+	if (!ret) {
+		g_dbus_error_strip_remote_error (err);
+		nm_log_warn (LOGD_BT, "bluez error getting adapter properties: %s", err->message);
 		g_error_free (err);
 		goto done;
 	}
 
-	value = g_hash_table_lookup (properties, "Address");
-	priv->address = value ? g_value_dup_string (value) : NULL;
-
-	value = g_hash_table_lookup (properties, "Devices");
-	devices = value ? g_value_get_boxed (value) : NULL;
+	properties = g_variant_get_child_value (ret, 0);
 
-	for (i = 0; devices && i < devices->len; i++)
- 		device_created (priv->proxy, g_ptr_array_index (devices, i), self);
+	g_variant_lookup (properties, "Address", "s", &priv->address);
+	if (g_variant_lookup (properties, "Devices", "^ao", &devices)) {
+		for (i = 0; devices[i]; i++)
+			device_created (priv->proxy, devices[i], self);
+		g_strfreev (devices);
+	}
 
-	g_hash_table_unref (properties);
+	g_variant_unref (properties);
+	g_variant_unref (ret);
 
 	priv->initialized = TRUE;
 
@@ -228,16 +224,12 @@ static void
 query_properties (NMBluez4Adapter *self)
 {
 	NMBluez4AdapterPrivate *priv = NM_BLUEZ4_ADAPTER_GET_PRIVATE (self);
-	DBusGProxyCall *call;
-
-	call = dbus_g_proxy_begin_call (priv->proxy, "GetProperties",
-	                                get_properties_cb,
-	                                self,
-	                                NULL, G_TYPE_INVALID);
-	if (!call) {
-		nm_log_warn (LOGD_BT, "failed to request Bluetooth adapter properties for %s.",
-		             priv->path);
-	}
+
+	g_dbus_proxy_call (priv->proxy, "GetProperties",
+	                   NULL,
+	                   G_DBUS_CALL_FLAGS_NONE, -1,
+	                   NULL,
+	                   get_properties_cb, self);
 }
 
 /***********************************************************/
@@ -247,34 +239,25 @@ nm_bluez4_adapter_new (const char *path, NMConnectionProvider *provider)
 {
 	NMBluez4Adapter *self;
 	NMBluez4AdapterPrivate *priv;
-	DBusGConnection *connection;
 
 	self = (NMBluez4Adapter *) g_object_new (NM_TYPE_BLUEZ4_ADAPTER,
 	                                         NM_BLUEZ4_ADAPTER_PATH, path,
 	                                         NULL);
-	if (!self)
-		return NULL;
-
 	priv = NM_BLUEZ4_ADAPTER_GET_PRIVATE (self);
 
 	priv->provider = provider;
 
-	connection = nm_dbus_manager_get_connection (nm_dbus_manager_get ());
-
-	priv->proxy = dbus_g_proxy_new_for_name (connection,
-	                                         BLUEZ_SERVICE,
-	                                         priv->path,
-	                                         BLUEZ4_ADAPTER_INTERFACE);
-
-	dbus_g_proxy_add_signal (priv->proxy, "DeviceCreated",
-	                         DBUS_TYPE_G_OBJECT_PATH, G_TYPE_INVALID);
-	dbus_g_proxy_connect_signal (priv->proxy, "DeviceCreated",
-	                             G_CALLBACK (device_created), self, NULL);
-
-	dbus_g_proxy_add_signal (priv->proxy, "DeviceRemoved",
-	                         DBUS_TYPE_G_OBJECT_PATH, G_TYPE_INVALID);
-	dbus_g_proxy_connect_signal (priv->proxy, "DeviceRemoved",
-	                             G_CALLBACK (device_removed), self, NULL);
+	priv->proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
+	                                             G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
+	                                             NULL,
+	                                             BLUEZ_SERVICE,
+	                                             priv->path,
+	                                             BLUEZ4_ADAPTER_INTERFACE,
+	                                             NULL, NULL);
+	_nm_dbus_signal_connect (priv->proxy, "DeviceCreated", G_VARIANT_TYPE ("(o)"),
+	                         G_CALLBACK (device_created), self);
+	_nm_dbus_signal_connect (priv->proxy, "DeviceRemoved", G_VARIANT_TYPE ("(o)"),
+	                         G_CALLBACK (device_removed), self);
 
 	query_properties (self);
 	return self;
diff --git a/src/devices/bluetooth/nm-bluez4-adapter.h b/src/devices/bluetooth/nm-bluez4-adapter.h
index a6256412..a8a2bfb4 100644
--- a/src/devices/bluetooth/nm-bluez4-adapter.h
+++ b/src/devices/bluetooth/nm-bluez4-adapter.h
@@ -21,9 +21,8 @@
 #ifndef __NETWORKMANAGER_BLUEZ4_ADAPTER_H__
 #define __NETWORKMANAGER_BLUEZ4_ADAPTER_H__
 
-#include <glib.h>
-#include <glib-object.h>
 
+#include "nm-default.h"
 #include "nm-bluez-device.h"
 #include "nm-connection-provider.h"
 
diff --git a/src/devices/bluetooth/nm-bluez4-manager.c b/src/devices/bluetooth/nm-bluez4-manager.c
index 23b13d32..c5ba120c 100644
--- a/src/devices/bluetooth/nm-bluez4-manager.c
+++ b/src/devices/bluetooth/nm-bluez4-manager.c
@@ -24,24 +24,20 @@
 #include <signal.h>
 #include <string.h>
 #include <stdlib.h>
-#include <dbus/dbus-glib.h>
 
-#include "nm-logging.h"
-#include "nm-dbus-glib-types.h"
+#include "nm-default.h"
 #include "nm-bluez-manager.h"
 #include "nm-bluez4-manager.h"
 #include "nm-bluez4-adapter.h"
-#include "nm-dbus-manager.h"
 #include "nm-bluez-common.h"
-
+#include "nm-core-internal.h"
 
 typedef struct {
-	NMDBusManager *dbus_mgr;
 	gulong name_owner_changed_id;
 
 	NMConnectionProvider *provider;
 
-	DBusGProxy *proxy;
+	GDBusProxy *proxy;
 
 	NMBluez4Adapter *adapter;
 } NMBluez4ManagerPrivate;
@@ -120,7 +116,7 @@ adapter_initialized (NMBluez4Adapter *adapter, gboolean success, gpointer user_d
 }
 
 static void
-adapter_removed (DBusGProxy *proxy, const char *path, NMBluez4Manager *self)
+adapter_removed (GDBusProxy *proxy, const char *path, NMBluez4Manager *self)
 {
 	NMBluez4ManagerPrivate *priv = NM_BLUEZ4_MANAGER_GET_PRIVATE (self);
 
@@ -140,7 +136,7 @@ adapter_removed (DBusGProxy *proxy, const char *path, NMBluez4Manager *self)
 }
 
 static void
-default_adapter_changed (DBusGProxy *proxy, const char *path, NMBluez4Manager *self)
+default_adapter_changed (GDBusProxy *proxy, const char *path, NMBluez4Manager *self)
 {
 	NMBluez4ManagerPrivate *priv = NM_BLUEZ4_MANAGER_GET_PRIVATE (self);
 	const char *cur_path = NULL;
@@ -166,130 +162,65 @@ default_adapter_changed (DBusGProxy *proxy, const char *path, NMBluez4Manager *s
 }
 
 static void
-default_adapter_cb (DBusGProxy *proxy, DBusGProxyCall *call, gpointer user_data)
+default_adapter_cb (GObject *proxy, GAsyncResult *result, gpointer user_data)
 {
 	NMBluez4Manager *self = NM_BLUEZ4_MANAGER (user_data);
 	NMBluez4ManagerPrivate *priv = NM_BLUEZ4_MANAGER_GET_PRIVATE (self);
-	const char *default_adapter = NULL;
+	GVariant *ret;
 	GError *err = NULL;
 
-	if (!dbus_g_proxy_end_call (proxy, call, &err,
-	                            DBUS_TYPE_G_OBJECT_PATH, &default_adapter,
-	                            G_TYPE_INVALID)) {
+	ret = _nm_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), result,
+	                                  G_VARIANT_TYPE ("(o)"), &err);
+	if (ret) {
+		const char *default_adapter;
+
+		g_variant_get (ret, "(&o)", &default_adapter);
+		default_adapter_changed (priv->proxy, default_adapter, self);
+		g_variant_unref (ret);
+	} else {
 		/* Ignore "No such adapter" errors; just means bluetooth isn't active */
-		if (   !dbus_g_error_has_name (err, "org.bluez.Error.NoSuchAdapter")
-		    && !dbus_g_error_has_name (err, "org.freedesktop.systemd1.LoadFailed")
-		    && !g_error_matches (err, DBUS_GERROR, DBUS_GERROR_SERVICE_UNKNOWN)) {
+		if (   !_nm_dbus_error_has_name (err, "org.bluez.Error.NoSuchAdapter")
+		    && !_nm_dbus_error_has_name (err, "org.freedesktop.systemd1.LoadFailed")
+		    && !g_error_matches (err, G_DBUS_ERROR, G_DBUS_ERROR_SERVICE_UNKNOWN)) {
+			g_dbus_error_strip_remote_error (err);
 			nm_log_warn (LOGD_BT, "bluez error getting default adapter: %s",
-			             err && err->message ? err->message : "(unknown)");
+			             err->message);
 		}
 		g_error_free (err);
-		return;
 	}
-
-	default_adapter_changed (priv->proxy, default_adapter, self);
 }
 
 static void
 query_default_adapter (NMBluez4Manager *self)
 {
 	NMBluez4ManagerPrivate *priv = NM_BLUEZ4_MANAGER_GET_PRIVATE (self);
-	DBusGProxyCall *call;
-
-	call = dbus_g_proxy_begin_call (priv->proxy, "DefaultAdapter",
-	                                default_adapter_cb,
-	                                self,
-	                                NULL, G_TYPE_INVALID);
-	if (!call)
-		nm_log_warn (LOGD_BT, "failed to request default Bluetooth adapter.");
-}
-
-static void
-bluez_connect (NMBluez4Manager *self)
-{
-	NMBluez4ManagerPrivate *priv = NM_BLUEZ4_MANAGER_GET_PRIVATE (self);
-	DBusGConnection *connection;
-
-	g_return_if_fail (priv->proxy == NULL);
 
-	connection = nm_dbus_manager_get_connection (priv->dbus_mgr);
-	if (!connection)
-		return;
-
-	priv->proxy = dbus_g_proxy_new_for_name (connection,
-	                                         BLUEZ_SERVICE,
-	                                         BLUEZ_MANAGER_PATH,
-	                                         BLUEZ4_MANAGER_INTERFACE);
-
-	dbus_g_proxy_add_signal (priv->proxy, "AdapterRemoved",
-	                         DBUS_TYPE_G_OBJECT_PATH, G_TYPE_INVALID);
-	dbus_g_proxy_connect_signal (priv->proxy, "AdapterRemoved",
-	                             G_CALLBACK (adapter_removed), self, NULL);
-
-	dbus_g_proxy_add_signal (priv->proxy, "DefaultAdapterChanged",
-	                         DBUS_TYPE_G_OBJECT_PATH, G_TYPE_INVALID);
-	dbus_g_proxy_connect_signal (priv->proxy, "DefaultAdapterChanged",
-	                             G_CALLBACK (default_adapter_changed), self, NULL);
-
-	query_default_adapter (self);
+	g_dbus_proxy_call (priv->proxy, "DefaultAdapter",
+	                   NULL,
+	                   G_DBUS_CALL_FLAGS_NONE, -1,
+	                   NULL,
+	                   default_adapter_cb, self);
 }
 
 static void
-name_owner_changed_cb (NMDBusManager *dbus_mgr,
-                       const char *name,
-                       const char *old_owner,
-                       const char *new_owner,
+name_owner_changed_cb (GObject *object,
+                       GParamSpec *pspec,
                        gpointer user_data)
 {
 	NMBluez4Manager *self = NM_BLUEZ4_MANAGER (user_data);
 	NMBluez4ManagerPrivate *priv = NM_BLUEZ4_MANAGER_GET_PRIVATE (self);
-	gboolean old_owner_good = (old_owner && strlen (old_owner));
-	gboolean new_owner_good = (new_owner && strlen (new_owner));
+	char *owner;
 
-	/* Can't handle the signal if its not from the Bluez */
-	if (strcmp (BLUEZ_SERVICE, name))
-		return;
-
-	if (!old_owner_good && new_owner_good)
+	owner = g_dbus_proxy_get_name_owner (priv->proxy);
+	if (owner) {
 		query_default_adapter (self);
-	else if (old_owner_good && !new_owner_good) {
+		g_free (owner);
+	} else {
 		/* Throwing away the adapter removes all devices too */
-		if (priv->adapter) {
-			g_object_unref (priv->adapter);
-			priv->adapter = NULL;
-		}
+		g_clear_object (&priv->adapter);
 	}
 }
 
-static void
-bluez_cleanup (NMBluez4Manager *self, gboolean do_signal)
-{
-	NMBluez4ManagerPrivate *priv = NM_BLUEZ4_MANAGER_GET_PRIVATE (self);
-
-	if (priv->proxy) {
-		g_object_unref (priv->proxy);
-		priv->proxy = NULL;
-	}
-
-	if (priv->adapter) {
-		g_object_unref (priv->adapter);
-		priv->adapter = NULL;
-	}
-}
-
-static void
-dbus_connection_changed_cb (NMDBusManager *dbus_mgr,
-                            DBusGConnection *connection,
-                            gpointer user_data)
-{
-	NMBluez4Manager *self = NM_BLUEZ4_MANAGER (user_data);
-
-	if (!connection)
-		bluez_cleanup (self, TRUE);
-	else
-		bluez_connect (self);
-}
-
 /****************************************************************/
 
 NMBluez4Manager *
@@ -307,20 +238,21 @@ nm_bluez4_manager_init (NMBluez4Manager *self)
 {
 	NMBluez4ManagerPrivate *priv = NM_BLUEZ4_MANAGER_GET_PRIVATE (self);
 
-	priv->dbus_mgr = nm_dbus_manager_get ();
-	g_assert (priv->dbus_mgr);
+	priv->proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
+	                                             G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
+	                                             NULL,
+	                                             BLUEZ_SERVICE,
+	                                             BLUEZ_MANAGER_PATH,
+	                                             BLUEZ4_MANAGER_INTERFACE,
+	                                             NULL, NULL);
+	_nm_dbus_signal_connect (priv->proxy, "AdapterRemoved", G_VARIANT_TYPE ("(o)"),
+	                         G_CALLBACK (adapter_removed), self);
+	_nm_dbus_signal_connect (priv->proxy, "DefaultAdapterChanged", G_VARIANT_TYPE ("(o)"),
+	                         G_CALLBACK (default_adapter_changed), self);
+	g_signal_connect (priv->proxy, "notify::g-name-owner",
+	                  G_CALLBACK (name_owner_changed_cb), self);
 
-	g_signal_connect (priv->dbus_mgr,
-	                  NM_DBUS_MANAGER_NAME_OWNER_CHANGED,
-	                  G_CALLBACK (name_owner_changed_cb),
-	                  self);
-
-	g_signal_connect (priv->dbus_mgr,
-	                  NM_DBUS_MANAGER_DBUS_CONNECTION_CHANGED,
-	                  G_CALLBACK (dbus_connection_changed_cb),
-	                  self);
-
-	bluez_connect (self);
+	query_default_adapter (self);
 }
 
 static void
@@ -329,13 +261,8 @@ dispose (GObject *object)
 	NMBluez4Manager *self = NM_BLUEZ4_MANAGER (object);
 	NMBluez4ManagerPrivate *priv = NM_BLUEZ4_MANAGER_GET_PRIVATE (self);
 
-	bluez_cleanup (self, FALSE);
-
-	if (priv->dbus_mgr) {
-		g_signal_handlers_disconnect_by_func (priv->dbus_mgr, name_owner_changed_cb, self);
-		g_signal_handlers_disconnect_by_func (priv->dbus_mgr, dbus_connection_changed_cb, self);
-		priv->dbus_mgr = NULL;
-	}
+	g_clear_object (&priv->proxy);
+	g_clear_object (&priv->adapter);
 
 	G_OBJECT_CLASS (nm_bluez4_manager_parent_class)->dispose (object);
 }
diff --git a/src/devices/bluetooth/nm-bluez4-manager.h b/src/devices/bluetooth/nm-bluez4-manager.h
index 13cfef93..f6bf7658 100644
--- a/src/devices/bluetooth/nm-bluez4-manager.h
+++ b/src/devices/bluetooth/nm-bluez4-manager.h
@@ -22,11 +22,8 @@
 #ifndef __NETWORKMANAGER_BLUEZ4_MANAGER_H__
 #define __NETWORKMANAGER_BLUEZ4_MANAGER_H__
 
-#include <glib.h>
-#include <glib-object.h>
-
-#include  <config.h>
-#include  "nm-connection-provider.h"
+#include "nm-default.h"
+#include "nm-connection-provider.h"
 
 G_BEGIN_DECLS
 
diff --git a/src/devices/bluetooth/nm-bluez5-dun.c b/src/devices/bluetooth/nm-bluez5-dun.c
index a97eaa77..875a662f 100644
--- a/src/devices/bluetooth/nm-bluez5-dun.c
+++ b/src/devices/bluetooth/nm-bluez5-dun.c
@@ -32,7 +32,7 @@
 
 #include "nm-bluez5-dun.h"
 #include "nm-bt-error.h"
-#include "nm-logging.h"
+#include "nm-default.h"
 #include "NetworkManagerUtils.h"
 
 struct _NMBluez5DunContext {
@@ -137,10 +137,7 @@ sdp_search_cleanup (NMBluez5DunContext *context)
 		context->sdp_session = NULL;
 	}
 
-	if (context->sdp_watch_id) {
-		g_source_remove (context->sdp_watch_id);
-		context->sdp_watch_id = 0;
-	}
+	nm_clear_g_source (&context->sdp_watch_id);
 }
 
 static void
diff --git a/src/devices/bluetooth/nm-bluez5-dun.h b/src/devices/bluetooth/nm-bluez5-dun.h
index 7e259725..c59cbb80 100644
--- a/src/devices/bluetooth/nm-bluez5-dun.h
+++ b/src/devices/bluetooth/nm-bluez5-dun.h
@@ -21,8 +21,7 @@
 #ifndef _NM_BLUEZ5_UTILS_H_
 #define _NM_BLUEZ5_UTILS_H_
 
-#include <glib.h>
-#include <gio/gio.h>
+#include "nm-default.h"
 
 typedef struct _NMBluez5DunContext NMBluez5DunContext;
 
diff --git a/src/devices/bluetooth/nm-bluez5-manager.c b/src/devices/bluetooth/nm-bluez5-manager.c
index b8568523..c9f5828d 100644
--- a/src/devices/bluetooth/nm-bluez5-manager.c
+++ b/src/devices/bluetooth/nm-bluez5-manager.c
@@ -25,20 +25,16 @@
 #include <signal.h>
 #include <string.h>
 #include <stdlib.h>
-#include <gio/gio.h>
 
-#include "nm-logging.h"
+#include "nm-default.h"
 #include "nm-bluez-manager.h"
 #include "nm-bluez5-manager.h"
 #include "nm-bluez-device.h"
 #include "nm-bluez-common.h"
 
-#include "nm-dbus-manager.h"
+#include "nm-core-internal.h"
 
 typedef struct {
-	NMDBusManager *dbus_mgr;
-	gulong name_owner_changed_id;
-
 	NMConnectionProvider *provider;
 
 	GDBusProxy *proxy;
@@ -170,39 +166,23 @@ device_removed (GDBusProxy *proxy, const gchar *path, NMBluez5Manager *self)
 }
 
 static void
-object_manager_g_signal (GDBusProxy     *proxy,
-                         gchar          *sender_name,
-                         gchar          *signal_name,
-                         GVariant       *parameters,
-                         NMBluez5Manager *self)
+object_manager_interfaces_added (GDBusProxy      *proxy,
+                                 const char      *path,
+                                 GVariant        *dict,
+                                 NMBluez5Manager *self)
 {
-	GVariant *variant;
-	const gchar *path;
-
-	if (!strcmp (signal_name, "InterfacesRemoved")) {
-		const gchar **ifaces;
-		gsize i, length;
-
-		g_variant_get (parameters, "(&o*)", &path, &variant);
-
-		ifaces = g_variant_get_strv (variant, &length);
-
-		for (i = 0; i < length; i++) {
-			if (!strcmp (ifaces[i], BLUEZ5_DEVICE_INTERFACE)) {
-				device_removed (proxy, path, self);
-				break;
-			}
-		}
-
-		g_free (ifaces);
-
-	} else if (!strcmp (signal_name, "InterfacesAdded")) {
-		g_variant_get (parameters, "(&o*)", &path, &variant);
+	if (g_variant_lookup (dict, BLUEZ5_DEVICE_INTERFACE, "a{sv}", NULL))
+		device_added (proxy, path, self);
+}
 
-		if (g_variant_lookup_value (variant, BLUEZ5_DEVICE_INTERFACE,
-		                            G_VARIANT_TYPE_DICTIONARY))
-			device_added (proxy, path, self);
-	}
+static void
+object_manager_interfaces_removed (GDBusProxy       *proxy,
+                                   const char       *path,
+                                   const char      **ifaces,
+                                   NMBluez5Manager  *self)
+{
+	if (_nm_utils_string_in_list (BLUEZ5_DEVICE_INTERFACE, ifaces))
+		device_removed (proxy, path, self);
 }
 
 static void
@@ -215,14 +195,15 @@ get_managed_objects_cb (GDBusProxy *proxy,
 	GError *error = NULL;
 	const char *path;
 
-	variant = g_dbus_proxy_call_finish (proxy, res, &error);
-
+	variant = _nm_dbus_proxy_call_finish (proxy, res,
+	                                      G_VARIANT_TYPE ("(a{oa{sa{sv}}})"),
+	                                      &error);
 	if (!variant) {
 		if (g_error_matches (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD))
 			nm_log_warn (LOGD_BT, "Couldn't get managed objects: not running Bluez5?");
 		else {
-			nm_log_warn (LOGD_BT, "Couldn't get managed objects: %s",
-				         error && error->message ? error->message : "(unknown)");
+			g_dbus_error_strip_remote_error (error);
+			nm_log_warn (LOGD_BT, "Couldn't get managed objects: %s", error->message);
 		}
 		g_clear_error (&error);
 		return;
@@ -238,6 +219,8 @@ get_managed_objects_cb (GDBusProxy *proxy,
 	g_variant_unref (variant);
 }
 
+static void name_owner_changed_cb (GObject *object, GParamSpec *pspec, gpointer user_data);
+
 static void
 on_proxy_acquired (GObject *object,
                    GAsyncResult *res,
@@ -255,6 +238,9 @@ on_proxy_acquired (GObject *object,
 		return;
 	}
 
+	g_signal_connect (priv->proxy, "notify::g-name-owner",
+	                  G_CALLBACK (name_owner_changed_cb), self);
+
 	/* Get already managed devices. */
 	g_dbus_proxy_call (priv->proxy, "GetManagedObjects",
 	                   NULL,
@@ -264,8 +250,10 @@ on_proxy_acquired (GObject *object,
 	                   (GAsyncReadyCallback) get_managed_objects_cb,
 	                   self);
 
-	g_signal_connect (priv->proxy, "g-signal",
-	                  G_CALLBACK (object_manager_g_signal), self);
+	_nm_dbus_signal_connect (priv->proxy, "InterfacesAdded", G_VARIANT_TYPE ("(oa{sa{sv}})"),
+	                         G_CALLBACK (object_manager_interfaces_added), self);
+	_nm_dbus_signal_connect (priv->proxy, "InterfacesRemoved", G_VARIANT_TYPE ("(oas)"),
+	                         G_CALLBACK (object_manager_interfaces_removed), self);
 }
 
 static void
@@ -287,24 +275,19 @@ bluez_connect (NMBluez5Manager *self)
 }
 
 static void
-name_owner_changed_cb (NMDBusManager *dbus_mgr,
-                       const char *name,
-                       const char *old_owner,
-                       const char *new_owner,
+name_owner_changed_cb (GObject *object,
+                       GParamSpec *pspec,
                        gpointer user_data)
 {
 	NMBluez5Manager *self = NM_BLUEZ5_MANAGER (user_data);
 	NMBluez5ManagerPrivate *priv = NM_BLUEZ5_MANAGER_GET_PRIVATE (self);
-	gboolean old_owner_good = (old_owner && strlen (old_owner));
-	gboolean new_owner_good = (new_owner && strlen (new_owner));
+	char *owner;
 
-	/* Can't handle the signal if its not from the Bluez */
-	if (strcmp (BLUEZ_SERVICE, name))
-		return;
-
-	if (old_owner_good && !new_owner_good) {
-		if (priv->devices)
+	if (priv->devices) {
+		owner = g_dbus_proxy_get_name_owner (priv->proxy);
+		if (!owner)
 			remove_all_devices (self);
+		g_free (owner);
 	}
 }
 
@@ -314,8 +297,8 @@ bluez_cleanup (NMBluez5Manager *self, gboolean do_signal)
 	NMBluez5ManagerPrivate *priv = NM_BLUEZ5_MANAGER_GET_PRIVATE (self);
 
 	if (priv->proxy) {
-		g_object_unref (priv->proxy);
-		priv->proxy = NULL;
+		g_signal_handlers_disconnect_by_func (priv->proxy, G_CALLBACK (name_owner_changed_cb), self);
+		g_clear_object (&priv->proxy);
 	}
 
 	if (do_signal)
@@ -324,19 +307,6 @@ bluez_cleanup (NMBluez5Manager *self, gboolean do_signal)
 		g_hash_table_remove_all (priv->devices);
 }
 
-static void
-dbus_connection_changed_cb (NMDBusManager *dbus_mgr,
-                            DBusGConnection *connection,
-                            gpointer user_data)
-{
-	NMBluez5Manager *self = NM_BLUEZ5_MANAGER (user_data);
-
-	if (!connection)
-		bluez_cleanup (self, TRUE);
-	else
-		bluez_connect (self);
-}
-
 /****************************************************************/
 
 NMBluez5Manager *
@@ -354,19 +324,6 @@ nm_bluez5_manager_init (NMBluez5Manager *self)
 {
 	NMBluez5ManagerPrivate *priv = NM_BLUEZ5_MANAGER_GET_PRIVATE (self);
 
-	priv->dbus_mgr = nm_dbus_manager_get ();
-	g_assert (priv->dbus_mgr);
-
-	g_signal_connect (priv->dbus_mgr,
-	                  NM_DBUS_MANAGER_NAME_OWNER_CHANGED,
-	                  G_CALLBACK (name_owner_changed_cb),
-	                  self);
-
-	g_signal_connect (priv->dbus_mgr,
-	                  NM_DBUS_MANAGER_DBUS_CONNECTION_CHANGED,
-	                  G_CALLBACK (dbus_connection_changed_cb),
-	                  self);
-
 	bluez_connect (self);
 
 	priv->devices = g_hash_table_new_full (g_str_hash, g_str_equal,
@@ -377,16 +334,9 @@ static void
 dispose (GObject *object)
 {
 	NMBluez5Manager *self = NM_BLUEZ5_MANAGER (object);
-	NMBluez5ManagerPrivate *priv = NM_BLUEZ5_MANAGER_GET_PRIVATE (self);
 
 	bluez_cleanup (self, FALSE);
 
-	if (priv->dbus_mgr) {
-		g_signal_handlers_disconnect_by_func (priv->dbus_mgr, name_owner_changed_cb, self);
-		g_signal_handlers_disconnect_by_func (priv->dbus_mgr, dbus_connection_changed_cb, self);
-		priv->dbus_mgr = NULL;
-	}
-
 	G_OBJECT_CLASS (nm_bluez5_manager_parent_class)->dispose (object);
 }
 
diff --git a/src/devices/bluetooth/nm-bluez5-manager.h b/src/devices/bluetooth/nm-bluez5-manager.h
index 8152976d..ae5512f8 100644
--- a/src/devices/bluetooth/nm-bluez5-manager.h
+++ b/src/devices/bluetooth/nm-bluez5-manager.h
@@ -22,11 +22,8 @@
 #ifndef __NETWORKMANAGER_BLUEZ5_MANAGER_H__
 #define __NETWORKMANAGER_BLUEZ5_MANAGER_H__
 
-#include <glib.h>
-#include <glib-object.h>
-
-#include  <config.h>
-#include  "nm-connection-provider.h"
+#include "nm-default.h"
+#include "nm-connection-provider.h"
 
 G_BEGIN_DECLS
 
diff --git a/src/devices/bluetooth/nm-bt-enum-types.c b/src/devices/bluetooth/nm-bt-enum-types.c
index 16741c9f..207055e1 100644
--- a/src/devices/bluetooth/nm-bt-enum-types.c
+++ b/src/devices/bluetooth/nm-bt-enum-types.c
@@ -3,6 +3,8 @@
 
 /* Generated by glib-mkenums. Do not edit */
 
+#include "config.h"
+
 #include "nm-bt-enum-types.h"
 
 #include "nm-bt-error.h"
diff --git a/src/devices/bluetooth/nm-bt-error.c b/src/devices/bluetooth/nm-bt-error.c
index e3b8e7f5..9c35d8b6 100644
--- a/src/devices/bluetooth/nm-bt-error.c
+++ b/src/devices/bluetooth/nm-bt-error.c
@@ -20,7 +20,7 @@
 
 #include "config.h"
 
-#include <glib.h>
+#include "nm-default.h"
 #include "nm-bt-error.h"
 
 GQuark
diff --git a/src/devices/bluetooth/nm-device-bt-glue.h b/src/devices/bluetooth/nm-device-bt-glue.h
deleted file mode 100644
index b6f851b2..00000000
--- a/src/devices/bluetooth/nm-device-bt-glue.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* Generated by dbus-binding-tool; do not edit! */
-
-
-#ifndef __dbus_glib_marshal_nm_device_bt_MARSHAL_H__
-#define __dbus_glib_marshal_nm_device_bt_MARSHAL_H__
-
-#include	<glib-object.h>
-
-G_BEGIN_DECLS
-
-#ifdef G_ENABLE_DEBUG
-#define g_marshal_value_peek_boolean(v)  g_value_get_boolean (v)
-#define g_marshal_value_peek_char(v)     g_value_get_schar (v)
-#define g_marshal_value_peek_uchar(v)    g_value_get_uchar (v)
-#define g_marshal_value_peek_int(v)      g_value_get_int (v)
-#define g_marshal_value_peek_uint(v)     g_value_get_uint (v)
-#define g_marshal_value_peek_long(v)     g_value_get_long (v)
-#define g_marshal_value_peek_ulong(v)    g_value_get_ulong (v)
-#define g_marshal_value_peek_int64(v)    g_value_get_int64 (v)
-#define g_marshal_value_peek_uint64(v)   g_value_get_uint64 (v)
-#define g_marshal_value_peek_enum(v)     g_value_get_enum (v)
-#define g_marshal_value_peek_flags(v)    g_value_get_flags (v)
-#define g_marshal_value_peek_float(v)    g_value_get_float (v)
-#define g_marshal_value_peek_double(v)   g_value_get_double (v)
-#define g_marshal_value_peek_string(v)   (char*) g_value_get_string (v)
-#define g_marshal_value_peek_param(v)    g_value_get_param (v)
-#define g_marshal_value_peek_boxed(v)    g_value_get_boxed (v)
-#define g_marshal_value_peek_pointer(v)  g_value_get_pointer (v)
-#define g_marshal_value_peek_object(v)   g_value_get_object (v)
-#define g_marshal_value_peek_variant(v)  g_value_get_variant (v)
-#else /* !G_ENABLE_DEBUG */
-/* WARNING: This code accesses GValues directly, which is UNSUPPORTED API.
- *          Do not access GValues directly in your code. Instead, use the
- *          g_value_get_*() functions
- */
-#define g_marshal_value_peek_boolean(v)  (v)->data[0].v_int
-#define g_marshal_value_peek_char(v)     (v)->data[0].v_int
-#define g_marshal_value_peek_uchar(v)    (v)->data[0].v_uint
-#define g_marshal_value_peek_int(v)      (v)->data[0].v_int
-#define g_marshal_value_peek_uint(v)     (v)->data[0].v_uint
-#define g_marshal_value_peek_long(v)     (v)->data[0].v_long
-#define g_marshal_value_peek_ulong(v)    (v)->data[0].v_ulong
-#define g_marshal_value_peek_int64(v)    (v)->data[0].v_int64
-#define g_marshal_value_peek_uint64(v)   (v)->data[0].v_uint64
-#define g_marshal_value_peek_enum(v)     (v)->data[0].v_long
-#define g_marshal_value_peek_flags(v)    (v)->data[0].v_ulong
-#define g_marshal_value_peek_float(v)    (v)->data[0].v_float
-#define g_marshal_value_peek_double(v)   (v)->data[0].v_double
-#define g_marshal_value_peek_string(v)   (v)->data[0].v_pointer
-#define g_marshal_value_peek_param(v)    (v)->data[0].v_pointer
-#define g_marshal_value_peek_boxed(v)    (v)->data[0].v_pointer
-#define g_marshal_value_peek_pointer(v)  (v)->data[0].v_pointer
-#define g_marshal_value_peek_object(v)   (v)->data[0].v_pointer
-#define g_marshal_value_peek_variant(v)  (v)->data[0].v_pointer
-#endif /* !G_ENABLE_DEBUG */
-
-
-G_END_DECLS
-
-#endif /* __dbus_glib_marshal_nm_device_bt_MARSHAL_H__ */
-
-#include <dbus/dbus-glib.h>
-static const DBusGMethodInfo dbus_glib_nm_device_bt_methods[] = {
-};
-
-const DBusGObjectInfo dbus_glib_nm_device_bt_object_info = {  1,
-  dbus_glib_nm_device_bt_methods,
-  0,
-"\0",
-"org.freedesktop.NetworkManager.Device.Bluetooth\0PropertiesChanged\0\0",
-"org.freedesktop.NetworkManager.Device.Bluetooth\0HwAddress\0hw_address\0read\0org.freedesktop.NetworkManager.Device.Bluetooth\0Name\0name\0read\0org.freedesktop.NetworkManager.Device.Bluetooth\0BtCapabilities\0bt_capabilities\0read\0\0"
-};
-
diff --git a/src/devices/bluetooth/nm-device-bt.c b/src/devices/bluetooth/nm-device-bt.c
index 88033e2e..1e3f9cdc 100644
--- a/src/devices/bluetooth/nm-device-bt.c
+++ b/src/devices/bluetooth/nm-device-bt.c
@@ -23,16 +23,11 @@
 #include <stdio.h>
 #include <string.h>
 
-#include <glib/gi18n.h>
-#include <gio/gio.h>
-
-#include "nm-glib-compat.h"
+#include "nm-default.h"
 #include "nm-bluez-common.h"
 #include "nm-bluez-device.h"
-#include "nm-dbus-manager.h"
 #include "nm-device-bt.h"
 #include "nm-device-private.h"
-#include "nm-logging.h"
 #include "ppp-manager/nm-ppp-manager.h"
 #include "nm-setting-connection.h"
 #include "nm-setting-bluetooth.h"
@@ -40,14 +35,17 @@
 #include "nm-setting-gsm.h"
 #include "nm-setting-serial.h"
 #include "nm-setting-ppp.h"
-#include "nm-device-bt-glue.h"
 #include "NetworkManagerUtils.h"
 #include "nm-bt-enum-types.h"
 #include "nm-utils.h"
 #include "nm-bt-error.h"
 #include "nm-bt-enum-types.h"
 
-#define MM_DBUS_SERVICE  "org.freedesktop.ModemManager1"
+#include "nmdbus-device-bt.h"
+
+#define MM_DBUS_SERVICE   "org.freedesktop.ModemManager1"
+#define MM_DBUS_PATH      "/org/freedesktop/ModemManager1"
+#define MM_DBUS_INTERFACE "org.freedesktop.ModemManager1"
 
 #include "nm-device-logging.h"
 _LOG_DECLARE_SELF(NMDeviceBt);
@@ -59,8 +57,7 @@ G_DEFINE_TYPE (NMDeviceBt, nm_device_bt, NM_TYPE_DEVICE)
 static gboolean modem_stage1 (NMDeviceBt *self, NMModem *modem, NMDeviceStateReason *reason);
 
 typedef struct {
-	NMDBusManager *dbus_mgr;
-	guint mm_watch_id;
+	GDBusProxy *mm_proxy;
 	gboolean mm_running;
 
 	NMBluezDevice *bt_device;
@@ -461,7 +458,7 @@ modem_prepare_result (NMModem *modem,
 			 * the device to be auto-activated anymore, which would risk locking
 			 * the SIM if the incorrect PIN continues to be used.
 			 */
-			g_object_set (G_OBJECT (device), NM_DEVICE_AUTOCONNECT, FALSE, NULL);
+			nm_device_set_autoconnect (device, FALSE);
 			_LOGI (LOGD_MB, "disabling autoconnect due to failed SIM PIN");
 		}
 
@@ -635,10 +632,7 @@ component_added (NMDevice *device, GObject *component)
 	g_free (base);
 
 	/* Got the modem */
-	if (priv->timeout_id) {
-		g_source_remove (priv->timeout_id);
-		priv->timeout_id = 0;
-	}
+	nm_clear_g_source (&priv->timeout_id);
 
 	/* Can only accept the modem in stage2, but since the interface matched
 	 * what we were expecting, don't let anything else claim the modem either.
@@ -706,10 +700,7 @@ check_connect_continue (NMDeviceBt *self)
 	       dun ? "DUN" : (pan ? "PAN" : "unknown"));
 
 	/* Kill the connect timeout since we're connected now */
-	if (priv->timeout_id) {
-		g_source_remove (priv->timeout_id);
-		priv->timeout_id = 0;
-	}
+	nm_clear_g_source (&priv->timeout_id);
 
 	if (pan) {
 		/* Bluez says we're connected now.  Start IP config. */
@@ -824,7 +815,7 @@ act_stage2_config (NMDevice *device, NMDeviceStateReason *reason)
 	NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE (device);
 	NMConnection *connection;
 
-	connection = nm_device_get_connection (device);
+	connection = nm_device_get_applied_connection (device);
 	g_assert (connection);
 	priv->bt_type = get_connection_bt_type (connection);
 	if (priv->bt_type == NM_BT_CAPABILITY_NONE) {
@@ -914,10 +905,7 @@ deactivate (NMDevice *device)
 	if (priv->bt_type != NM_BT_CAPABILITY_NONE)
 		nm_bluez_device_disconnect (priv->bt_device);
 
-	if (priv->timeout_id) {
-		g_source_remove (priv->timeout_id);
-		priv->timeout_id = 0;
-	}
+	nm_clear_g_source (&priv->timeout_id);
 
 	priv->bt_type = NM_BT_CAPABILITY_NONE;
 
@@ -967,25 +955,17 @@ set_mm_running (NMDeviceBt *self, gboolean running)
 }
 
 static void
-mm_name_owner_changed (NMDBusManager *dbus_mgr,
-                       const char *name,
-                       const char *old_owner,
-                       const char *new_owner,
+mm_name_owner_changed (GObject *object,
+                       GParamSpec *pspec,
                        NMDeviceBt *self)
 {
-	gboolean old_owner_good;
-	gboolean new_owner_good;
-
-	/* Can't handle the signal if its not from the modem service */
-	if (strcmp (MM_DBUS_SERVICE, name) != 0)
-		return;
-
-	old_owner_good = (old_owner && strlen (old_owner));
-	new_owner_good = (new_owner && strlen (new_owner));
+	char *owner;
 
-	if (!old_owner_good && new_owner_good)
+	owner = g_dbus_proxy_get_name_owner (G_DBUS_PROXY (object));
+	if (owner) {
 		set_mm_running (self, TRUE);
-	else if (old_owner_good && !new_owner_good)
+		g_free (owner);
+	} else
 		set_mm_running (self, FALSE);
 }
 
@@ -1021,18 +1001,27 @@ static void
 nm_device_bt_init (NMDeviceBt *self)
 {
 	NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE (self);
-	gboolean mm_running;
-
-	priv->dbus_mgr = nm_dbus_manager_get ();
-
-	priv->mm_watch_id = g_signal_connect (priv->dbus_mgr,
-	                                      NM_DBUS_MANAGER_NAME_OWNER_CHANGED,
-	                                      G_CALLBACK (mm_name_owner_changed),
-	                                      self);
+	GError *error = NULL;
 
-	/* Initial check to see if ModemManager is running */
-	mm_running = nm_dbus_manager_name_has_owner (priv->dbus_mgr, MM_DBUS_SERVICE);
-	set_mm_running (self, mm_running);
+	priv->mm_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
+	                                                G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES |
+	                                                    G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS |
+	                                                    G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
+	                                                NULL,
+	                                                MM_DBUS_SERVICE,
+	                                                MM_DBUS_PATH,
+	                                                MM_DBUS_INTERFACE,
+	                                                NULL, &error);
+	if (priv->mm_proxy) {
+		g_signal_connect (priv->mm_proxy, "notify::g-name-owner",
+		                  G_CALLBACK (mm_name_owner_changed),
+		                  self);
+		mm_name_owner_changed (G_OBJECT (priv->mm_proxy), NULL, self);
+	} else {
+		_LOGW (LOGD_MB, "Could not create proxy for '%s': %s",
+		       MM_DBUS_SERVICE, error->message);
+		g_clear_error (&error);
+	}
 }
 
 static void
@@ -1106,18 +1095,14 @@ dispose (GObject *object)
 {
 	NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE (object);
 
-	if (priv->timeout_id) {
-		g_source_remove (priv->timeout_id);
-		priv->timeout_id = 0;
-	}
+	nm_clear_g_source (&priv->timeout_id);
 
 	g_signal_handlers_disconnect_matched (priv->bt_device, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, object);
 
-	if (priv->dbus_mgr && priv->mm_watch_id) {
-		g_signal_handler_disconnect (priv->dbus_mgr, priv->mm_watch_id);
-		priv->mm_watch_id = 0;
+	if (priv->mm_proxy) {
+		g_signal_handlers_disconnect_by_func (priv->mm_proxy, G_CALLBACK (mm_name_owner_changed), object);
+		g_clear_object (&priv->mm_proxy);
 	}
-	priv->dbus_mgr = NULL;
 
 	modem_cleanup (NM_DEVICE_BT (object));
 	g_clear_object (&priv->bt_device);
@@ -1197,7 +1182,7 @@ nm_device_bt_class_init (NMDeviceBtClass *klass)
 		              G_TYPE_NONE, 2,
 		              G_TYPE_UINT, G_TYPE_UINT);
 
-	nm_dbus_manager_register_exported_type (nm_dbus_manager_get (),
-	                                        G_TYPE_FROM_CLASS (klass),
-	                                        &dbus_glib_nm_device_bt_object_info);
+	nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass),
+	                                        NMDBUS_TYPE_DEVICE_BLUETOOTH_SKELETON,
+	                                        NULL);
 }
diff --git a/src/devices/bluetooth/nm-device-bt.h b/src/devices/bluetooth/nm-device-bt.h
index c1e95d91..c565745f 100644
--- a/src/devices/bluetooth/nm-device-bt.h
+++ b/src/devices/bluetooth/nm-device-bt.h
@@ -21,7 +21,7 @@
 #ifndef __NETWORKMANAGER_DEVICE_BT_H__
 #define __NETWORKMANAGER_DEVICE_BT_H__
 
-#include <nm-device.h>
+#include "nm-device.h"
 #include "nm-bluez-device.h"
 #include "nm-modem.h"