summary refs log tree commit diff
path: root/libnm-glib
diff options
context:
space:
mode:
Diffstat (limited to 'libnm-glib')
-rw-r--r--libnm-glib/libnm-glib-test.c6
-rw-r--r--libnm-glib/libnm_glib.c118
-rw-r--r--libnm-glib/libnm_glib.h2
-rw-r--r--libnm-glib/meson.build295
-rw-r--r--libnm-glib/nm-access-point.c11
-rw-r--r--libnm-glib/nm-access-point.h1
-rw-r--r--libnm-glib/nm-active-connection.c1
-rw-r--r--libnm-glib/nm-client.c13
-rw-r--r--libnm-glib/nm-device-ethernet.c4
-rw-r--r--libnm-glib/nm-device.c5
-rw-r--r--libnm-glib/nm-dhcp4-config.c4
-rw-r--r--libnm-glib/nm-dhcp6-config.c4
-rw-r--r--libnm-glib/nm-glib-enum-types.c.template62
-rw-r--r--libnm-glib/nm-glib-enum-types.h.template21
-rw-r--r--libnm-glib/nm-ip4-config.c4
-rw-r--r--libnm-glib/nm-ip6-config.c2
-rw-r--r--libnm-glib/nm-object.c5
-rw-r--r--libnm-glib/nm-remote-connection.c3
-rw-r--r--libnm-glib/nm-remote-connection.h1
-rw-r--r--libnm-glib/nm-remote-settings.c4
-rw-r--r--libnm-glib/nm-remote-settings.h3
-rw-r--r--libnm-glib/nm-secret-agent.c13
-rw-r--r--libnm-glib/nm-vpn-connection.c1
-rw-r--r--libnm-glib/nm-vpn-enum-types.c.template37
-rw-r--r--libnm-glib/nm-vpn-enum-types.h.template21
-rw-r--r--libnm-glib/nm-vpn-plugin-ui-interface.c23
-rw-r--r--libnm-glib/nm-vpn-plugin-ui-interface.h6
-rw-r--r--libnm-glib/nm-vpn-plugin.c2
-rw-r--r--libnm-glib/nm-wimax-nsp.c1
-rw-r--r--libnm-glib/tests/meson.build31
-rw-r--r--libnm-glib/tests/test-nm-client.c22
-rw-r--r--libnm-glib/tests/test-remote-settings-client.c21
32 files changed, 591 insertions, 156 deletions
diff --git a/libnm-glib/libnm-glib-test.c b/libnm-glib/libnm-glib-test.c
index c3c0ff19..c4723c95 100644
--- a/libnm-glib/libnm-glib-test.c
+++ b/libnm-glib/libnm-glib-test.c
@@ -47,12 +47,12 @@ test_wireless_enabled (NMClient *client)
 	wireless = nm_client_wireless_get_enabled (client);
 	g_print ("Wireless enabled? %s\n", wireless ? "yes" : "no");
 
-//	nm_client_wireless_set_enabled (client, !wireless);
+// nm_client_wireless_set_enabled (client, !wireless);
 
 	wireless = nm_client_wireless_hardware_get_enabled (client);
 	g_print ("Wireless HW enabled? %s\n", wireless ? "yes" : "no");
 
-//	nm_client_wireless_set_enabled (client, !wireless);
+// nm_client_wireless_set_enabled (client, !wireless);
 
 	return TRUE;
 }
@@ -400,8 +400,6 @@ main (int argc, char *argv[])
 {
 	NMClient *client;
 
-	nm_g_type_init ();
-
 	client = nm_client_new ();
 	if (!client) {
 		exit (1);
diff --git a/libnm-glib/libnm_glib.c b/libnm-glib/libnm_glib.c
index ec25a2d9..1e0725ca 100644
--- a/libnm-glib/libnm_glib.c
+++ b/libnm-glib/libnm_glib.c
@@ -32,51 +32,48 @@
 #include "NetworkManager.h"
 #include "libnm_glib.h"
 
-#define	DBUS_NO_SERVICE_ERROR			"org.freedesktop.DBus.Error.ServiceDoesNotExist"
-
+#define DBUS_NO_SERVICE_ERROR "org.freedesktop.DBus.Error.ServiceDoesNotExist"
 
 struct libnm_glib_ctx
 {
-	unsigned char		check;
+	unsigned char           check;
 
-	GMainContext *		g_main_ctx;
-	GMainLoop *		g_main_loop;
-	DBusConnection	*	dbus_con;
-	guint			dbus_watcher;
-	guint			dbus_watch_interval;
+	GMainContext *          g_main_ctx;
+	GMainLoop *             g_main_loop;
+	DBusConnection  *       dbus_con;
+	guint                   dbus_watcher;
+	guint                   dbus_watch_interval;
 
-	gboolean			thread_done;
-	gboolean			thread_inited;
-	GThread *			thread;
+	gboolean                thread_done;
+	gboolean                thread_inited;
+	GThread *               thread;
 
-	GSList *			callbacks;
-	GMutex *			callbacks_lock;
-	guint			callback_id_last;
+	GSList *                callbacks;
+	GMutex *                callbacks_lock;
+	guint                   callback_id_last;
 
-	libnm_glib_state	nm_state;
+	libnm_glib_state        nm_state;
 };
 
 typedef struct libnm_glib_callback
 {
-	guint				id;
-	GMainContext *			gmain_ctx;
-	libnm_glib_ctx *		libnm_glib_ctx;
-	libnm_glib_callback_func	func;
-	gpointer				user_data;
+	guint                       id;
+	GMainContext *              gmain_ctx;
+	libnm_glib_ctx *            libnm_glib_ctx;
+	libnm_glib_callback_func    func;
+	gpointer                    user_data;
 } libnm_glib_callback;
 
-
 static void _libnm_glib_schedule_dbus_watcher (libnm_glib_ctx *ctx);
 static DBusConnection * _libnm_glib_dbus_init (gpointer *user_data, GMainContext *context);
 static void _libnm_glib_update_state (libnm_glib_ctx *ctx, NMState state);
 
-
 static void
 _libnm_glib_nm_state_cb (DBusPendingCall *pcall, void *user_data)
 {
-	DBusMessage *		reply;
-	libnm_glib_ctx *	ctx = (libnm_glib_ctx *) user_data;
-	NMState			nm_state;
+	DBusMessage *reply;
+	libnm_glib_ctx *ctx = (libnm_glib_ctx *) user_data;
+	NMState nm_state;
 
 	g_return_if_fail (pcall != NULL);
 	g_return_if_fail (ctx != NULL);
@@ -108,8 +105,8 @@ out:
 static void
 _libnm_glib_get_nm_state (libnm_glib_ctx *ctx)
 {
-	DBusMessage *		message;
-	DBusPendingCall *	pcall = NULL;
+	DBusMessage *message;
+	DBusPendingCall *pcall = NULL;
 
 	g_return_if_fail (ctx != NULL);
 
@@ -125,7 +122,7 @@ _libnm_glib_get_nm_state (libnm_glib_ctx *ctx)
 static gboolean
 _libnm_glib_callback_helper (gpointer user_data)
 {
-	libnm_glib_callback	*cb_data = (libnm_glib_callback *)user_data;
+	libnm_glib_callback *cb_data = (libnm_glib_callback *)user_data;
 
 	g_return_val_if_fail (cb_data != NULL, FALSE);
 	g_return_val_if_fail (cb_data->func != NULL, FALSE);
@@ -140,7 +137,7 @@ static void
 _libnm_glib_schedule_single_callback (libnm_glib_ctx *ctx,
                                       libnm_glib_callback *callback)
 {
-	GSource				*source;
+	GSource *source;
 
 	g_return_if_fail (ctx != NULL);
 	g_return_if_fail (callback != NULL);
@@ -170,7 +167,7 @@ _libnm_glib_unschedule_single_callback (libnm_glib_ctx *ctx,
 static void
 _libnm_glib_call_callbacks (libnm_glib_ctx *ctx)
 {
-	GSList	*elem;
+	GSList *elem;
 
 	g_return_if_fail (ctx != NULL);
 
@@ -184,11 +181,10 @@ _libnm_glib_call_callbacks (libnm_glib_ctx *ctx)
 	g_mutex_unlock (ctx->callbacks_lock);
 }
 
-
 static void
 _libnm_glib_update_state (libnm_glib_ctx *ctx, NMState state)
 {
-	libnm_glib_state	old_state;
+	libnm_glib_state old_state;
 
 	g_return_if_fail (ctx != NULL);
 
@@ -215,15 +211,14 @@ _libnm_glib_update_state (libnm_glib_ctx *ctx, NMState state)
 		_libnm_glib_call_callbacks (ctx);
 }
 
-
 static DBusHandlerResult
 _libnm_glib_dbus_filter (DBusConnection *connection,
                          DBusMessage *message,
                          void *user_data)
 {
-	libnm_glib_ctx		*ctx = (libnm_glib_ctx *)user_data;
-	gboolean		 handled = TRUE;
-	DBusError	 	 error;
+	libnm_glib_ctx *ctx = (libnm_glib_ctx *)user_data;
+	gboolean handled = TRUE;
+	DBusError error;
 
 	g_return_val_if_fail (ctx != NULL, DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
 	g_return_val_if_fail (connection != NULL, DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
@@ -242,9 +237,9 @@ _libnm_glib_dbus_filter (DBusConnection *connection,
 	else if (dbus_message_is_signal (message, DBUS_INTERFACE_DBUS, "NameOwnerChanged"))
 	{
 		/* New signal for dbus 0.23... */
-		char 	*service;
-		char		*old_owner;
-		char		*new_owner;
+		char *service;
+		char *old_owner;
+		char *new_owner;
 
 		if (    dbus_message_get_args (message, &error,
 									DBUS_TYPE_STRING, &service,
@@ -257,9 +252,9 @@ _libnm_glib_dbus_filter (DBusConnection *connection,
 				gboolean old_owner_good = (old_owner && (strlen (old_owner) > 0));
 				gboolean new_owner_good = (new_owner && (strlen (new_owner) > 0));
 
-				if (!old_owner_good && new_owner_good)	/* Equivalent to old ServiceCreated signal */
+				if (!old_owner_good && new_owner_good) /* Equivalent to old ServiceCreated signal */
 					_libnm_glib_get_nm_state (ctx);
-				else if (old_owner_good && !new_owner_good)	/* Equivalent to old ServiceDeleted signal */
+				else if (old_owner_good && !new_owner_good) /* Equivalent to old ServiceDeleted signal */
 					ctx->nm_state = LIBNM_NO_NETWORKMANAGER;
 			}
 		}
@@ -273,7 +268,7 @@ _libnm_glib_dbus_filter (DBusConnection *connection,
 	}
 	else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE, "StateChanged"))
 	{
-		NMState	state = NM_STATE_UNKNOWN;
+		NMState state = NM_STATE_UNKNOWN;
 
 		dbus_message_get_args (message, &error, DBUS_TYPE_UINT32, &state, DBUS_TYPE_INVALID);
 		_libnm_glib_update_state (ctx, state);
@@ -287,7 +282,6 @@ _libnm_glib_dbus_filter (DBusConnection *connection,
 	return (handled ? DBUS_HANDLER_RESULT_HANDLED : DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
 }
 
-
 /*
  * libnm_glib_dbus_init
  *
@@ -297,8 +291,8 @@ _libnm_glib_dbus_filter (DBusConnection *connection,
 static DBusConnection *
 _libnm_glib_dbus_init (gpointer *user_data, GMainContext *context)
 {
-	DBusConnection	*connection = NULL;
-	DBusError		 error;
+	DBusConnection *connection = NULL;
+	DBusError error;
 
 	dbus_error_init (&error);
 	connection = dbus_bus_get_private (DBUS_BUS_SYSTEM, &error);
@@ -339,7 +333,6 @@ _libnm_glib_dbus_init (gpointer *user_data, GMainContext *context)
 	return (connection);
 }
 
-
 /*
  * libnm_glib_dbus_watcher
  *
@@ -349,7 +342,7 @@ _libnm_glib_dbus_init (gpointer *user_data, GMainContext *context)
 static gboolean
 _libnm_glib_dbus_watcher (gpointer user_data)
 {
-	libnm_glib_ctx	*ctx = (libnm_glib_ctx *)user_data;
+	libnm_glib_ctx *ctx = (libnm_glib_ctx *)user_data;
 
 	g_return_val_if_fail (ctx != NULL, FALSE);
 
@@ -369,7 +362,7 @@ _libnm_glib_dbus_watcher (gpointer user_data)
 		/* Wait 3 seconds longer each time we fail to reconnect to dbus,
 		 * with a maximum wait of one minute.
 		 */
-		ctx->dbus_watch_interval = MIN(ctx->dbus_watch_interval + 3000, 60000); 
+		ctx->dbus_watch_interval = MIN(ctx->dbus_watch_interval + 3000, 60000);
 
 		/* Reschule ourselves if we _still_ don't have a connection to dbus */
 		_libnm_glib_schedule_dbus_watcher (ctx);
@@ -378,7 +371,6 @@ _libnm_glib_dbus_watcher (gpointer user_data)
 	return FALSE;
 }
 
-
 /*
  * libnm_glib_schedule_dbus_watcher
  *
@@ -393,14 +385,13 @@ _libnm_glib_schedule_dbus_watcher (libnm_glib_ctx *ctx)
 
 	if (ctx->dbus_watcher == 0)
 	{
-		GSource *	source = g_timeout_source_new (ctx->dbus_watch_interval);
+		GSource *source = g_timeout_source_new (ctx->dbus_watch_interval);
 		g_source_set_callback (source, _libnm_glib_dbus_watcher, (gpointer) ctx, NULL);
 		ctx->dbus_watcher = g_source_attach (source, ctx->g_main_ctx);
 		g_source_unref (source);
 	}
 }
 
-
 /*
  * libnm_glib_dbus_worker
  *
@@ -410,7 +401,7 @@ _libnm_glib_schedule_dbus_watcher (libnm_glib_ctx *ctx)
 static gpointer
 _libnm_glib_dbus_worker (gpointer user_data)
 {
-	libnm_glib_ctx	*ctx = (libnm_glib_ctx *)user_data;
+	libnm_glib_ctx *ctx = (libnm_glib_ctx *)user_data;
 
 	g_return_val_if_fail (ctx != NULL, NULL);
 
@@ -431,7 +422,6 @@ _libnm_glib_dbus_worker (gpointer user_data)
 	return NULL;
 }
 
-
 static void
 _libnm_glib_ctx_free (libnm_glib_ctx *ctx)
 {
@@ -468,7 +458,6 @@ _libnm_glib_ctx_free (libnm_glib_ctx *ctx)
 	g_free (ctx);
 }
 
-
 static libnm_glib_ctx *
 _libnm_glib_ctx_new (void)
 {
@@ -489,13 +478,10 @@ error:
 	return NULL;
 }
 
-
 libnm_glib_ctx *
 libnm_glib_init (void)
 {
-	libnm_glib_ctx	*ctx = NULL;
-
-	nm_g_type_init ();
+	libnm_glib_ctx *ctx = NULL;
 
 	if (!g_thread_supported ())
 		g_thread_init (NULL);
@@ -506,7 +492,7 @@ libnm_glib_init (void)
 
 	ctx->thread = g_thread_create (_libnm_glib_dbus_worker, ctx, TRUE, NULL);
 	if (!ctx->thread)
-		goto error;	
+		goto error;
 
 	/* Wait until initialization of the thread */
 	while (!ctx->thread_inited)
@@ -519,7 +505,6 @@ error:
 	return NULL;
 }
 
-
 void
 libnm_glib_shutdown (libnm_glib_ctx *ctx)
 {
@@ -532,7 +517,6 @@ libnm_glib_shutdown (libnm_glib_ctx *ctx)
 	_libnm_glib_ctx_free (ctx);
 }
 
-
 libnm_glib_state
 libnm_glib_get_network_state (const libnm_glib_ctx *ctx)
 {
@@ -542,14 +526,13 @@ libnm_glib_get_network_state (const libnm_glib_ctx *ctx)
 	return ctx->nm_state;
 }
 
-
 guint
-libnm_glib_register_callback	(libnm_glib_ctx *ctx,
-                               libnm_glib_callback_func func,
-                               gpointer user_data,
-                               GMainContext *g_main_ctx)
+libnm_glib_register_callback (libnm_glib_ctx *ctx,
+                              libnm_glib_callback_func func,
+                              gpointer user_data,
+                              GMainContext *g_main_ctx)
 {
-	libnm_glib_callback		*callback = NULL;
+	libnm_glib_callback *callback = NULL;
 
 	g_return_val_if_fail (ctx != NULL, 0);
 	g_return_val_if_fail (func != NULL, 0);
@@ -570,7 +553,6 @@ libnm_glib_register_callback	(libnm_glib_ctx *ctx,
 	return (callback->id);
 }
 
-
 void
 libnm_glib_unregister_callback (libnm_glib_ctx *ctx,
                                 guint id)
diff --git a/libnm-glib/libnm_glib.h b/libnm-glib/libnm_glib.h
index 01c055d0..4137a8ca 100644
--- a/libnm-glib/libnm_glib.h
+++ b/libnm-glib/libnm_glib.h
@@ -41,10 +41,8 @@ typedef enum libnm_glib_state
 
 typedef struct libnm_glib_ctx libnm_glib_ctx G_GNUC_DEPRECATED;
 
-
 typedef void (*libnm_glib_callback_func) (libnm_glib_ctx *libnm_ctx, gpointer user_data) G_GNUC_DEPRECATED;
 
-
 G_GNUC_DEPRECATED libnm_glib_ctx *  libnm_glib_init                (void);
 G_GNUC_DEPRECATED void              libnm_glib_shutdown            (libnm_glib_ctx *ctx);
 
diff --git a/libnm-glib/meson.build b/libnm-glib/meson.build
new file mode 100644
index 00000000..fabd8818
--- /dev/null
+++ b/libnm-glib/meson.build
@@ -0,0 +1,295 @@
+libnm_glib_inc = include_directories('.')
+
+dbus_binding_tool = find_program('dbus-binding-tool')
+
+common_deps = [
+  dbus_dep,
+  dbus_glib_dep,
+  shared_dep
+]
+
+common_cflags = [
+  '-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_GLIB',
+]
+
+cflags = common_cflags + [
+  '-DG_LOG_DOMAIN="@0@"'.format(libnm_glib_name)
+]
+
+vpn_headers = files(
+  'nm-vpn-plugin.h',
+  'nm-vpn-plugin-ui-interface.h',
+  'nm-vpn-plugin-utils.h'
+)
+
+headers = files(
+  'nm-access-point.h',
+  'nm-active-connection.h',
+  'nm-client.h',
+  'nm-device-adsl.h',
+  'nm-device-bond.h',
+  'nm-device-bridge.h',
+  'nm-device-bt.h',
+  'nm-device-ethernet.h',
+  'nm-device-generic.h',
+  'nm-device.h',
+  'nm-device-infiniband.h',
+  'nm-device-modem.h',
+  'nm-device-olpc-mesh.h',
+  'nm-device-team.h',
+  'nm-device-vlan.h',
+  'nm-device-wifi.h',
+  'nm-device-wimax.h',
+  'nm-dhcp4-config.h',
+  'nm-dhcp6-config.h',
+  'nm-ip4-config.h',
+  'nm-ip6-config.h',
+  'nm-object.h',
+  'nm-remote-connection.h',
+  'nm-remote-settings.h',
+  'nm-secret-agent.h',
+  'nm-types.h',
+  'nm-vpn-connection.h',
+  'nm-wimax-nsp.h'
+)
+
+deprecated_headers = files('libnm_glib.h')
+
+install_headers(
+  headers + vpn_headers + deprecated_headers,
+  subdir: libnm_glib_name
+)
+
+libdeprecated_nm_glib = static_library(
+  'deprecated-nm-glib',
+  sources: 'libnm_glib.c',
+  include_directories: libnm_util_inc,
+  dependencies: common_deps,
+  c_args: cflags + [
+    '-Wno-deprecated-declarations',
+    '-Wno-deprecated',
+  ],
+)
+
+sources = files(
+  'nm-vpn-plugin.c',
+  'nm-vpn-plugin-ui-interface.c',
+  'nm-vpn-plugin-utils.c'
+)
+
+glue = 'nm-vpn-plugin-glue.h'
+
+enum_types = 'nm-vpn-enum-types'
+
+libnm_glib_vpn_enum = gnome.mkenums(
+  enum_types,
+  sources: vpn_headers,
+  identifier_prefix: nm_id_prefix,
+  c_template: enum_types + '.c.template',
+  h_template: enum_types + '.h.template',
+  install_header: true,
+  install_dir: libnm_glib_pkgincludedir
+)
+
+deps = common_deps + [libnm_util_dep]
+
+linker_script = join_paths(meson.current_source_dir(), 'libnm-glib-vpn.ver')
+
+libnm_glib_vpn = shared_library(
+  'nm-glib-vpn',
+  sources: files(
+    'nm-vpn-plugin.c',
+    'nm-vpn-plugin-ui-interface.c',
+    'nm-vpn-plugin-utils.c',
+  ) + [
+    custom_target(
+      glue,
+      input: ifaces_vpn_plugin_xml,
+      output: glue,
+      command: [dbus_binding_tool, '--prefix=nm_vpn_plugin', '--mode=glib-server', '--output=@OUTPUT@', '@INPUT@'],
+    ),
+  ] + libnm_glib_vpn_enum,
+  version: libnm_glib_vpn_version,
+  dependencies: deps,
+  c_args: cflags,
+  link_args: [
+    '-Wl,--version-script,@0@'.format(linker_script),
+  ],
+  link_depends: linker_script,
+  install: true
+)
+
+libnm_glib_vpn_dep = declare_dependency(
+  include_directories: libnm_glib_inc,
+  link_with: libnm_glib_vpn
+)
+
+pkg.generate(
+  libraries: libnm_glib_vpn,
+  version: nm_version,
+  name: libnm_glib_vpn_name,
+  description: 'Convenience library for NetworkManager VPN plugins',
+  filebase: libnm_glib_vpn_name,
+  subdirs: libnm_glib_name,
+  requires: 'NetworkManager >= ' + nm_version + ' glib-2.0 dbus-glib-1',
+  variables: 'exec_prefix=${prefix}'
+)
+
+libnm_glib_sources = shared_files_libnm_glib + files(
+  'nm-access-point.c',
+  'nm-active-connection.c',
+  'nm-client.c',
+  'nm-dbus-helpers.c',
+  'nm-device-adsl.c',
+  'nm-device-bond.c',
+  'nm-device-bridge.c',
+  'nm-device-bt.c',
+  'nm-device.c',
+  'nm-device-ethernet.c',
+  'nm-device-generic.c',
+  'nm-device-infiniband.c',
+  'nm-device-olpc-mesh.c',
+  'nm-device-modem.c',
+  'nm-device-team.c',
+  'nm-device-vlan.c',
+  'nm-device-wifi.c',
+  'nm-device-wimax.c',
+  'nm-dhcp4-config.c',
+  'nm-dhcp6-config.c',
+  'nm-ip4-config.c',
+  'nm-ip6-config.c',
+  'nm-object.c',
+  'nm-object-cache.c',
+  'nm-remote-connection.c',
+  'nm-remote-settings.c',
+  'nm-secret-agent.c',
+  'nm-types.c',
+  'nm-vpn-connection.c',
+  'nm-wimax-nsp.c'
+)
+
+glue = 'nm-secret-agent-glue.h'
+
+nm_secret_agent_glue = custom_target(
+  glue,
+  input: ifaces_secret_agent_xml,
+  output: glue,
+  command: [dbus_binding_tool, '--prefix=nm_secret_agent', '--mode=glib-server', '--output=@OUTPUT@', '@INPUT@']
+)
+
+enum_types = 'nm-glib-enum-types'
+
+libnm_glib_enum = gnome.mkenums(
+  enum_types,
+  sources: headers,
+  identifier_prefix: nm_id_prefix,
+  c_template: enum_types + '.c.template',
+  h_template: enum_types + '.h.template',
+  install_header: true,
+  install_dir: libnm_glib_pkgincludedir
+)
+
+deps = common_deps + [
+  libnm_util_dep,
+  libudev_dep
+]
+
+linker_script = join_paths(meson.current_source_dir(), 'libnm-glib.ver')
+
+libnm_glib = shared_library(
+  'nm-glib',
+  sources: libnm_glib_sources + libnm_glib_enum + [nm_secret_agent_glue],
+  version: libnm_glib_version,
+  dependencies: deps,
+  c_args: cflags,
+  link_whole: libdeprecated_nm_glib,
+  link_args: [
+    '-Wl,--version-script,@0@'.format(linker_script),
+  ],
+  link_depends: linker_script,
+  install: true
+)
+
+libnm_glib_dep = declare_dependency(
+  include_directories: libnm_glib_inc,
+  link_with: libnm_glib
+)
+
+pkg.generate(
+  libraries: libnm_glib,
+  version: nm_version,
+  name: libnm_glib_name,
+  description: 'Convenience library for clients of NetworkManager',
+  filebase: libnm_glib_name,
+  subdirs: libnm_glib_name,
+  requires: 'libnm-util >= ' + nm_version + ' NetworkManager >= ' + nm_version + ' gobject-2.0 dbus-glib-1',
+  variables: 'exec_prefix=${prefix}'
+)
+
+if enable_introspection
+  gir_sources = libnm_glib_sources + headers + libnm_glib_enum
+
+  deps = [
+    dbus_glib_dep,
+    libnm_glib_dep,
+    libnm_util_gir_dep
+  ]
+
+  gir_includes = [
+    'DBusGLib-1.0',
+    'Gio-2.0'
+  ]
+
+  libnm_glib_gir = gnome.generate_gir(
+    libnm_glib,
+    sources: gir_sources,
+    dependencies: deps,
+    nsversion: nm_gir_version,
+    namespace: 'NMClient',
+    identifier_prefix: nm_id_prefix,
+    symbol_prefix: nm_id_prefix.to_lower(),
+    export_packages: [libnm_glib_name, libnm_glib_vpn_name],
+    includes: gir_includes,
+    extra_args: cflags + [
+      '--include-uninstalled=' + libnm_util_gir[0].full_path(),
+    ],
+    install: true
+  )
+endif
+
+name = libnm_glib_name + '-test'
+
+deps = common_deps + [libnm_util_dep]
+
+executable(
+  name,
+  name + '.c',
+  dependencies: deps,
+  c_args: cflags,
+  link_with: libnm_glib
+)
+
+run_target(
+  'check-local-exports-' + libnm_glib_name,
+  command: [check_exports, libnm_glib.full_path(), linker_script],
+  depends: libnm_glib
+)
+
+if enable_tests
+  subdir('tests')
+endif
+
+pkg.generate(
+  version: nm_version,
+  name: nm_name,
+  description: 'System for maintaining active network connection',
+  filebase: nm_name,
+  subdirs: nm_name,
+  requires: '',
+  variables: [
+    'exec_prefix=${prefix}',
+    'libgnome_serverdir=' + nm_libexecdir,
+    'plugindir=' + nm_vpndir,
+    'configdir=' + nm_pkgconfdir
+  ]
+)
diff --git a/libnm-glib/nm-access-point.c b/libnm-glib/nm-access-point.c
index 70b98f6d..592818fa 100644
--- a/libnm-glib/nm-access-point.c
+++ b/libnm-glib/nm-access-point.c
@@ -166,9 +166,9 @@ nm_access_point_get_ssid (NMAccessPoint *ap)
  * nm_access_point_get_frequency:
  * @ap: a #NMAccessPoint
  *
- * Gets the frequency of the access point.
+ * Gets the frequency of the access point in MHz.
  *
- * Returns: the frequency
+ * Returns: the frequency in MHz
  **/
 guint32
 nm_access_point_get_frequency (NMAccessPoint *ap)
@@ -252,9 +252,9 @@ nm_access_point_get_max_bitrate (NMAccessPoint *ap)
  * nm_access_point_get_strength:
  * @ap: a #NMAccessPoint
  *
- * Gets the current signal strength of the access point.
+ * Gets the current signal strength of the access point as a percentage.
  *
- * Returns: the signal strength
+ * Returns: the signal strength (0 to 100)
  **/
 guint8
 nm_access_point_get_strength (NMAccessPoint *ap)
@@ -563,7 +563,6 @@ constructed (GObject *object)
 	register_properties (NM_ACCESS_POINT (object));
 }
 
-
 static void
 nm_access_point_class_init (NMAccessPointClass *ap_class)
 {
@@ -664,7 +663,7 @@ nm_access_point_class_init (NMAccessPointClass *ap_class)
 		                      NULL,
 		                      G_PARAM_READABLE |
 		                      G_PARAM_STATIC_STRINGS));
-	
+
 	/**
 	 * NMAccessPoint:mode:
 	 *
diff --git a/libnm-glib/nm-access-point.h b/libnm-glib/nm-access-point.h
index 5750c76c..e9a3fc6b 100644
--- a/libnm-glib/nm-access-point.h
+++ b/libnm-glib/nm-access-point.h
@@ -51,7 +51,6 @@ G_BEGIN_DECLS
 /* DEPRECATED */
 #define NM_ACCESS_POINT_HW_ADDRESS  "hw-address"
 
-
 typedef struct {
 	NMObject parent;
 } NMAccessPoint;
diff --git a/libnm-glib/nm-active-connection.c b/libnm-glib/nm-active-connection.c
index aa79e1ac..a8150755 100644
--- a/libnm-glib/nm-active-connection.c
+++ b/libnm-glib/nm-active-connection.c
@@ -638,7 +638,6 @@ constructed (GObject *object)
 	register_properties (NM_ACTIVE_CONNECTION (object));
 }
 
-
 static void
 nm_active_connection_class_init (NMActiveConnectionClass *ap_class)
 {
diff --git a/libnm-glib/nm-client.c b/libnm-glib/nm-client.c
index db15c4b3..0da7b0f4 100644
--- a/libnm-glib/nm-client.c
+++ b/libnm-glib/nm-client.c
@@ -157,7 +157,7 @@ nm_client_init (NMClient *client)
 
 	priv->state = NM_STATE_UNKNOWN;
 
-	priv->permissions = g_hash_table_new (g_direct_hash, g_direct_equal);
+	priv->permissions = g_hash_table_new (NULL, NULL);
 }
 
 static void
@@ -674,7 +674,7 @@ nm_client_activate_connection (NMClient *client,
 	                         activate_cb, info, NULL,
 	                         DBUS_TYPE_G_OBJECT_PATH, connection ? nm_connection_get_path (connection) : "/",
 	                         DBUS_TYPE_G_OBJECT_PATH, device ? nm_object_get_path (NM_OBJECT (device)) : "/",
-	                         DBUS_TYPE_G_OBJECT_PATH, specific_object ? specific_object : "/",
+	                         DBUS_TYPE_G_OBJECT_PATH, specific_object ?: "/",
 	                         G_TYPE_INVALID);
 }
 
@@ -762,7 +762,7 @@ nm_client_add_and_activate_connection (NMClient *client,
 		                         add_activate_cb, info, NULL,
 		                         DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT, hash,
 		                         DBUS_TYPE_G_OBJECT_PATH, nm_object_get_path (NM_OBJECT (device)),
-		                         DBUS_TYPE_G_OBJECT_PATH, specific_object ? specific_object : "/",
+		                         DBUS_TYPE_G_OBJECT_PATH, specific_object ?: "/",
 		                         G_TYPE_INVALID);
 	} else
 		info->idle_id = g_idle_add (activate_nm_not_running, info);
@@ -1257,8 +1257,8 @@ nm_client_set_logging (NMClient *client, const char *level, const char *domains,
 		return TRUE;
 
 	return dbus_g_proxy_call (priv->client_proxy, "SetLogging", error,
-	                          G_TYPE_STRING, level ? level : "",
-	                          G_TYPE_STRING, domains ? domains : "",
+	                          G_TYPE_STRING, level ?: "",
+	                          G_TYPE_STRING, domains ?: "",
 	                          G_TYPE_INVALID,
 	                          G_TYPE_INVALID);
 }
@@ -2329,10 +2329,9 @@ nm_client_class_init (NMClientClass *client_class)
 		                       G_PARAM_STATIC_STRINGS));
 
 	/**
-	 * NMClient:active-connections:
+	 * NMClient:active-connections: (type GPtrArray):
 	 *
 	 * The active connections.
-	 * Type: GLib.PtrArray
 	 **/
 	g_object_class_install_property
 		(object_class, PROP_ACTIVE_CONNECTIONS,
diff --git a/libnm-glib/nm-device-ethernet.c b/libnm-glib/nm-device-ethernet.c
index 2817a320..df677b29 100644
--- a/libnm-glib/nm-device-ethernet.c
+++ b/libnm-glib/nm-device-ethernet.c
@@ -137,9 +137,9 @@ nm_device_ethernet_get_permanent_hw_address (NMDeviceEthernet *device)
  * nm_device_ethernet_get_speed:
  * @device: a #NMDeviceEthernet
  *
- * Gets the speed of the #NMDeviceEthernet.
+ * Gets the speed of the #NMDeviceEthernet in Mbit/s.
  *
- * Returns: the speed of the device
+ * Returns: the speed of the device in Mbit/s
  **/
 guint32
 nm_device_ethernet_get_speed (NMDeviceEthernet *device)
diff --git a/libnm-glib/nm-device.c b/libnm-glib/nm-device.c
index be86a246..6179b757 100644
--- a/libnm-glib/nm-device.c
+++ b/libnm-glib/nm-device.c
@@ -1311,7 +1311,6 @@ nm_device_set_autoconnect (NMDevice *device, gboolean autoconnect)
 	g_value_init (&value, G_TYPE_BOOLEAN);
 	g_value_set_boolean (&value, autoconnect);
 
-
 	NM_DEVICE_GET_PRIVATE (device)->autoconnect = autoconnect;
 
 	_nm_object_set_property (NM_OBJECT (device),
@@ -2006,7 +2005,7 @@ nm_device_disambiguate_names (NMDevice **devices,
 
 			g_free (names[i]);
 			name = get_device_type_name_with_iface (devices[i]);
-			/* Translators: the first %s is a bus name (eg, "USB") or
+			/* TRANSLATORS: the first %s is a bus name (eg, "USB") or
 			 * product name, the second is a device type (eg,
 			 * "Ethernet"). You can change this to something like
 			 * "%2$s (%1$s)" if there's no grammatical way to combine
@@ -2100,7 +2099,7 @@ nm_device_get_physical_port_id (NMDevice *device)
  *
  * Gets the  MTU of the #NMDevice.
  *
- * Returns: the MTU of the device.
+ * Returns: the MTU of the device in bytes.
  *
  * Since: 0.9.10
  **/
diff --git a/libnm-glib/nm-dhcp4-config.c b/libnm-glib/nm-dhcp4-config.c
index 4acdeae7..e446280f 100644
--- a/libnm-glib/nm-dhcp4-config.c
+++ b/libnm-glib/nm-dhcp4-config.c
@@ -148,11 +148,9 @@ nm_dhcp4_config_class_init (NMDHCP4ConfigClass *config_class)
 	/* properties */
 
 	/**
-	 * NMDHCP4Config:options:
+	 * NMDHCP4Config:options: (type GHashTable(utf8,GObject.Value)):
 	 *
 	 * The #GHashTable containing options of the configuration.
-	 *
-	 * Type: GLib.HashTable(utf8,GObject.Value)
 	 **/
 	g_object_class_install_property
 		(object_class, PROP_OPTIONS,
diff --git a/libnm-glib/nm-dhcp6-config.c b/libnm-glib/nm-dhcp6-config.c
index aebea8df..c35fb3ba 100644
--- a/libnm-glib/nm-dhcp6-config.c
+++ b/libnm-glib/nm-dhcp6-config.c
@@ -148,11 +148,9 @@ nm_dhcp6_config_class_init (NMDHCP6ConfigClass *config_class)
 	/* properties */
 
 	/**
-	 * NMDHCP6Config:options:
+	 * NMDHCP6Config:options: (type GHashTable(utf8,GObject.Value)):
 	 *
 	 * The #GHashTable containing options of the configuration.
-	 *
-	 * Type: GLib.HashTable(utf8,GObject.Value)
 	 **/
 	g_object_class_install_property
 		(object_class, PROP_OPTIONS,
diff --git a/libnm-glib/nm-glib-enum-types.c.template b/libnm-glib/nm-glib-enum-types.c.template
new file mode 100644
index 00000000..8bd4732e
--- /dev/null
+++ b/libnm-glib/nm-glib-enum-types.c.template
@@ -0,0 +1,62 @@
+/*** BEGIN file-header ***/
+#include "config.h"
+
+#include "nm-glib-enum-types.h"
+
+#include "nm-object.h"
+#include "nm-client.h"
+#include "nm-device.h"
+#include "nm-device-ethernet.h"
+#include "nm-device-infiniband.h"
+#include "nm-device-adsl.h"
+#include "nm-device-wifi.h"
+#include "nm-device-bt.h"
+#include "nm-device-olpc-mesh.h"
+#include "nm-device-bond.h"
+#include "nm-device-team.h"
+#include "nm-device-bridge.h"
+#include "nm-device-vlan.h"
+#include "nm-device-generic.h"
+#include "nm-access-point.h"
+#include "nm-ip4-config.h"
+#include "nm-device-modem.h"
+#include "nm-vpn-connection.h"
+#include "nm-types.h"
+#include "nm-active-connection.h"
+#include "nm-dhcp4-config.h"
+#include "nm-ip6-config.h"
+#include "nm-dhcp6-config.h"
+#include "nm-remote-connection.h"
+#include "nm-remote-settings.h"
+#include "nm-secret-agent.h"
+#include "nm-device-wimax.h"
+#include "nm-wimax-nsp.h"
+/*** END file-header ***/
+
+/*** BEGIN value-header ***/
+GType
+@enum_name@_get_type (void)
+{
+  static volatile gsize g_define_type_id__volatile = 0;
+
+  if (g_once_init_enter (&g_define_type_id__volatile))
+    {
+      static const G@Type@Value values[] = {
+/*** END value-header ***/
+
+/*** BEGIN value-production ***/
+        { @VALUENAME@, "@VALUENAME@", "@valuenick@" },
+/*** END value-production ***/
+
+/*** BEGIN value-tail ***/
+        { 0, NULL, NULL }
+      };
+      GType g_define_type_id =
+        g_@type@_register_static (g_intern_static_string ("@EnumName@"), values);
+      g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
+    }
+
+  return g_define_type_id__volatile;
+}
+
+/*** END value-tail ***/
diff --git a/libnm-glib/nm-glib-enum-types.h.template b/libnm-glib/nm-glib-enum-types.h.template
new file mode 100644
index 00000000..c0699560
--- /dev/null
+++ b/libnm-glib/nm-glib-enum-types.h.template
@@ -0,0 +1,21 @@
+/*** BEGIN file-header ***/
+#ifndef __NM_GLIB_ENUM_TYPES_H__
+#define __NM_GLIB_ENUM_TYPES_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+/*** END file-header ***/
+
+/*** BEGIN enumeration-production ***/
+GType @enum_name@_get_type (void) G_GNUC_CONST;
+#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type ())
+
+/*** END enumeration-production ***/
+
+/*** BEGIN file-tail ***/
+G_END_DECLS
+
+#endif /* __NM_GLIB_ENUM_TYPES_H__ */
+/*** END file-tail ***/
diff --git a/libnm-glib/nm-ip4-config.c b/libnm-glib/nm-ip4-config.c
index 9e0e2e2d..8954ee7b 100644
--- a/libnm-glib/nm-ip4-config.c
+++ b/libnm-glib/nm-ip4-config.c
@@ -259,7 +259,7 @@ nm_ip4_config_class_init (NMIP4ConfigClass *config_class)
 	/**
 	 * NMIP4Config:routes:
 	 *
-	 * The #GPtrArray containing #NMSettingIP4Routes of the configuration.
+	 * The #GPtrArray containing #NMSettingIP4Route<!-- -->s of the configuration.
 	 **/
 	g_object_class_install_property
 	    (object_class, PROP_ROUTES,
@@ -459,7 +459,7 @@ nm_ip4_config_get_wins_servers (NMIP4Config *config)
  * Gets the routes.
  *
  * Returns: (element-type NMIP4Route): the #GSList containing
- * #NMIP4Routes. This is the internal copy used by the configuration,
+ * #NMIP4Route<!-- -->s. This is the internal copy used by the configuration,
  * and must not be modified.
  **/
 const GSList *
diff --git a/libnm-glib/nm-ip6-config.c b/libnm-glib/nm-ip6-config.c
index 5ec02dae..b655b239 100644
--- a/libnm-glib/nm-ip6-config.c
+++ b/libnm-glib/nm-ip6-config.c
@@ -310,7 +310,7 @@ nm_ip6_config_get_searches (NMIP6Config *config)
  * Gets the routes.
  *
  * Returns: (element-type NMIP6Route): the #GSList containing
- * #NMIP6Routes. This is the internal copy used by the configuration,
+ * #NMIP6Route<!-- -->s. This is the internal copy used by the configuration,
  * and must not be modified.
  **/
 const GSList *
diff --git a/libnm-glib/nm-object.c b/libnm-glib/nm-object.c
index d3f8c830..5956b344 100644
--- a/libnm-glib/nm-object.c
+++ b/libnm-glib/nm-object.c
@@ -1328,7 +1328,7 @@ _nm_object_register_properties (NMObject *object,
 		}
 
 		pi = g_malloc0 (sizeof (PropertyInfo));
-		pi->func = tmp->func ? tmp->func : demarshal_generic;
+		pi->func = tmp->func ?: demarshal_generic;
 		pi->object_type = tmp->object_type;
 		pi->field = tmp->field;
 		pi->signal_prefix = tmp->signal_prefix;
@@ -1374,7 +1374,6 @@ _nm_object_suppress_property_updates (NMObject *object, gboolean suppress)
 	priv->suppress_property_updates = suppress;
 }
 
-
 void
 _nm_object_ensure_inited (NMObject *object)
 {
@@ -1573,5 +1572,5 @@ _nm_object_new_proxy (NMObject *self, const char *path, const char *interface)
 {
 	NMObjectPrivate *priv = NM_OBJECT_GET_PRIVATE (self);
 
-	return _nm_dbus_new_proxy_for_connection (priv->connection, path ? path : priv->path, interface);
+	return _nm_dbus_new_proxy_for_connection (priv->connection, path ?: priv->path, interface);
 }
diff --git a/libnm-glib/nm-remote-connection.c b/libnm-glib/nm-remote-connection.c
index 820f9e5c..eb99ef35 100644
--- a/libnm-glib/nm-remote-connection.c
+++ b/libnm-glib/nm-remote-connection.c
@@ -67,7 +67,6 @@ static guint signals[LAST_SIGNAL] = { 0 };
 typedef struct RemoteCall RemoteCall;
 typedef void (*RemoteCallFetchResultCb) (RemoteCall *call, DBusGProxyCall *proxy_call, GError *error);
 
-
 struct RemoteCall {
 	NMRemoteConnection *self;
 	DBusGProxyCall *call;
@@ -390,7 +389,6 @@ get_secrets_cb (RemoteCall *call, DBusGProxyCall *proxy_call, GError *error)
 		g_hash_table_destroy (secrets);
 }
 
-
 /**
  * nm_remote_connection_get_secrets:
  * @connection: the #NMRemoteConnection
@@ -708,7 +706,6 @@ init_async (GAsyncInitable *initable, int io_priority,
 	NMRemoteConnectionInitData *init_data;
 	NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (initable);
 
-
 	init_data = g_slice_new0 (NMRemoteConnectionInitData);
 	init_data->connection = NM_REMOTE_CONNECTION (initable);
 	init_data->result = g_simple_async_result_new (G_OBJECT (initable), callback,
diff --git a/libnm-glib/nm-remote-connection.h b/libnm-glib/nm-remote-connection.h
index 5b746a44..1f951cfa 100644
--- a/libnm-glib/nm-remote-connection.h
+++ b/libnm-glib/nm-remote-connection.h
@@ -36,7 +36,6 @@ G_BEGIN_DECLS
 #define NM_IS_REMOTE_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_REMOTE_CONNECTION))
 #define NM_REMOTE_CONNECTION_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_REMOTE_CONNECTION, NMRemoteConnectionClass))
 
-
 /**
  * NMRemoteConnectionError:
  * @NM_REMOTE_CONNECTION_ERROR_UNKNOWN: unknown or unclassified error
diff --git a/libnm-glib/nm-remote-settings.c b/libnm-glib/nm-remote-settings.c
index be6b7ee3..e8a80f6f 100644
--- a/libnm-glib/nm-remote-settings.c
+++ b/libnm-glib/nm-remote-settings.c
@@ -576,7 +576,7 @@ fetch_connections_done (DBusGProxy *proxy,
 		    && priv->service_running) {
 			g_warning ("%s: error fetching connections: %s.",
 			           __func__,
-			           error->message ? error->message : "(unknown)");
+			           error->message ?: "(unknown)");
 		}
 		g_clear_error (&error);
 
@@ -964,7 +964,7 @@ nm_remote_settings_save_hostname (NMRemoteSettings *settings,
 	                         save_hostname_cb,
 	                         info,
 	                         g_free,
-	                         G_TYPE_STRING, hostname ? hostname : "",
+	                         G_TYPE_STRING, hostname ?: "",
 	                         G_TYPE_INVALID);
 	return TRUE;
 }
diff --git a/libnm-glib/nm-remote-settings.h b/libnm-glib/nm-remote-settings.h
index af6cc603..2f9e00a0 100644
--- a/libnm-glib/nm-remote-settings.h
+++ b/libnm-glib/nm-remote-settings.h
@@ -59,7 +59,6 @@ typedef enum {
 #define NM_REMOTE_SETTINGS_ERROR nm_remote_settings_error_quark ()
 GQuark nm_remote_settings_error_quark (void);
 
-
 #define NM_REMOTE_SETTINGS_BUS             "bus"
 #define NM_REMOTE_SETTINGS_SERVICE_RUNNING "service-running"
 #define NM_REMOTE_SETTINGS_HOSTNAME        "hostname"
@@ -71,7 +70,6 @@ GQuark nm_remote_settings_error_quark (void);
 typedef struct _NMRemoteSettings NMRemoteSettings;
 typedef struct _NMRemoteSettingsClass NMRemoteSettingsClass;
 
-
 typedef void (*NMRemoteSettingsAddConnectionFunc) (NMRemoteSettings *settings,
                                                    NMRemoteConnection *connection,
                                                    GError *error,
@@ -86,7 +84,6 @@ typedef void (*NMRemoteSettingsSaveHostnameFunc) (NMRemoteSettings *settings,
                                                   GError *error,
                                                   gpointer user_data);
 
-
 struct _NMRemoteSettings {
 	GObject parent;
 };
diff --git a/libnm-glib/nm-secret-agent.c b/libnm-glib/nm-secret-agent.c
index 75129e06..16e3199d 100644
--- a/libnm-glib/nm-secret-agent.c
+++ b/libnm-glib/nm-secret-agent.c
@@ -98,7 +98,6 @@ enum {
 
 static guint signals[LAST_SIGNAL] = { 0 };
 
-
 /*****************************************************************************/
 
 GQuark
@@ -695,7 +694,7 @@ auto_register_cb (gpointer user_data)
 /*****************************************************************************/
 
 /**
- * nm_secret_agent_get_secrets:
+ * nm_secret_agent_get_secrets: (virtual get_secrets):
  * @self: a #NMSecretAgent
  * @connection: the #NMConnection for which we're asked secrets
  * @setting_name: the name of the secret setting
@@ -709,8 +708,6 @@ auto_register_cb (gpointer user_data)
  * agent should use when performing the request, for example returning only
  * existing secrets without user interaction, or requesting entirely new
  * secrets from the user.
- *
- * Virtual: get_secrets
  */
 void
 nm_secret_agent_get_secrets (NMSecretAgent *self,
@@ -739,7 +736,7 @@ nm_secret_agent_get_secrets (NMSecretAgent *self,
 }
 
 /**
- * nm_secret_agent_save_secrets:
+ * nm_secret_agent_save_secrets: (virtual save_secrets):
  * @self: a #NMSecretAgent
  * @connection: a #NMConnection
  * @callback: (scope async): a callback, to be invoked when the operation is done
@@ -747,8 +744,6 @@ nm_secret_agent_get_secrets (NMSecretAgent *self,
  *
  * Asyncronously ensure that all secrets inside @connection
  * are stored to disk.
- *
- * Virtual: save_secrets
  */
 void
 nm_secret_agent_save_secrets (NMSecretAgent *self,
@@ -768,7 +763,7 @@ nm_secret_agent_save_secrets (NMSecretAgent *self,
 }
 
 /**
- * nm_secret_agent_delete_secrets:
+ * nm_secret_agent_delete_secrets: (virtual delete_secrets):
  * @self: a #NMSecretAgent
  * @connection: a #NMConnection
  * @callback: (scope async): a callback, to be invoked when the operation is done
@@ -776,8 +771,6 @@ nm_secret_agent_save_secrets (NMSecretAgent *self,
  *
  * Asynchronously ask the agent to delete all saved secrets belonging to
  * @connection.
- *
- * Virtual: delete_secrets
  */
 void
 nm_secret_agent_delete_secrets (NMSecretAgent *self,
diff --git a/libnm-glib/nm-vpn-connection.c b/libnm-glib/nm-vpn-connection.c
index 7670d2ef..68f495a9 100644
--- a/libnm-glib/nm-vpn-connection.c
+++ b/libnm-glib/nm-vpn-connection.c
@@ -55,7 +55,6 @@ enum {
 
 static guint signals[LAST_SIGNAL] = { 0 };
 
-
 /**
  * nm_vpn_connection_new:
  * @connection: the #DBusGConnection
diff --git a/libnm-glib/nm-vpn-enum-types.c.template b/libnm-glib/nm-vpn-enum-types.c.template
new file mode 100644
index 00000000..8aa02ff7
--- /dev/null
+++ b/libnm-glib/nm-vpn-enum-types.c.template
@@ -0,0 +1,37 @@
+/*** BEGIN file-header ***/
+#include "config.h"
+
+#include "nm-vpn-enum-types.h"
+
+#include "nm-vpn-plugin.h"
+#include "nm-vpn-plugin-ui-interface.h"
+#include "nm-vpn-plugin-utils.h"
+/*** END file-header ***/
+
+/*** BEGIN value-header ***/
+GType
+@enum_name@_get_type (void)
+{
+  static volatile gsize g_define_type_id__volatile = 0;
+
+  if (g_once_init_enter (&g_define_type_id__volatile))
+    {
+      static const G@Type@Value values[] = {
+/*** END value-header ***/
+
+/*** BEGIN value-production ***/
+        { @VALUENAME@, "@VALUENAME@", "@valuenick@" },
+/*** END value-production ***/
+
+/*** BEGIN value-tail ***/
+        { 0, NULL, NULL }
+      };
+      GType g_define_type_id =
+        g_@type@_register_static (g_intern_static_string ("@EnumName@"), values);
+      g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
+    }
+
+  return g_define_type_id__volatile;
+}
+
+/*** END value-tail ***/
diff --git a/libnm-glib/nm-vpn-enum-types.h.template b/libnm-glib/nm-vpn-enum-types.h.template
new file mode 100644
index 00000000..47fd96be
--- /dev/null
+++ b/libnm-glib/nm-vpn-enum-types.h.template
@@ -0,0 +1,21 @@
+/*** BEGIN file-header ***/
+#ifndef __NM_VPN_ENUM_TYPES_H__
+#define __NM_VPN_ENUM_TYPES_H__
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+/*** END file-header ***/
+
+/*** BEGIN enumeration-production ***/
+GType @enum_name@_get_type (void) G_GNUC_CONST;
+#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type ())
+
+/*** END enumeration-production ***/
+
+/*** BEGIN file-tail ***/
+G_END_DECLS
+
+#endif /* __NM_VPN_ENUM_TYPES_H__ */
+/*** END file-tail ***/
diff --git a/libnm-glib/nm-vpn-plugin-ui-interface.c b/libnm-glib/nm-vpn-plugin-ui-interface.c
index fee6fc9f..ec554e6c 100644
--- a/libnm-glib/nm-vpn-plugin-ui-interface.c
+++ b/libnm-glib/nm-vpn-plugin-ui-interface.c
@@ -69,7 +69,6 @@ interface_init (gpointer g_iface)
 	initialized = TRUE;
 }
 
-
 GType
 nm_vpn_plugin_ui_interface_get_type (void)
 {
@@ -78,13 +77,13 @@ nm_vpn_plugin_ui_interface_get_type (void)
 	if (!vpn_plugin_ui_interface_type) {
 		const GTypeInfo vpn_plugin_ui_interface_info = {
 			sizeof (NMVpnPluginUiInterface), /* class_size */
-			interface_init,   /* base_init */
-			NULL,		/* base_finalize */
+			interface_init, /* base_init */
+			NULL, /* base_finalize */
 			NULL,
-			NULL,		/* class_finalize */
-			NULL,		/* class_data */
+			NULL, /* class_finalize */
+			NULL, /* class_data */
 			0,
-			0,              /* n_preallocs */
+			0,    /* n_preallocs */
 			NULL
 		};
 
@@ -99,7 +98,6 @@ nm_vpn_plugin_ui_interface_get_type (void)
 	return vpn_plugin_ui_interface_type;
 }
 
-
 NMVpnPluginUiWidgetInterface *
 nm_vpn_plugin_ui_interface_ui_factory (NMVpnPluginUiInterface *iface,
                                        NMConnection *connection,
@@ -167,7 +165,6 @@ nm_vpn_plugin_ui_interface_delete_connection (NMVpnPluginUiInterface *iface,
 	return TRUE;
 }
 
-
 static void
 widget_interface_init (gpointer g_iface)
 {
@@ -197,13 +194,13 @@ nm_vpn_plugin_ui_widget_interface_get_type (void)
 	if (!vpn_plugin_ui_widget_interface_type) {
 		const GTypeInfo vpn_plugin_ui_widget_interface_info = {
 			sizeof (NMVpnPluginUiWidgetInterface), /* class_size */
-			widget_interface_init,   /* base_init */
-			NULL,		/* base_finalize */
+			widget_interface_init, /* base_init */
+			NULL, /* base_finalize */
 			NULL,
-			NULL,		/* class_finalize */
-			NULL,		/* class_data */
+			NULL, /* class_finalize */
+			NULL, /* class_data */
 			0,
-			0,              /* n_preallocs */
+			0,    /* n_preallocs */
 			NULL
 		};
 
diff --git a/libnm-glib/nm-vpn-plugin-ui-interface.h b/libnm-glib/nm-vpn-plugin-ui-interface.h
index b5ea2a7e..7d870128 100644
--- a/libnm-glib/nm-vpn-plugin-ui-interface.h
+++ b/libnm-glib/nm-vpn-plugin-ui-interface.h
@@ -37,7 +37,6 @@ typedef struct _NMVpnPluginUiWidgetInterface NMVpnPluginUiWidgetInterface;
 typedef NMVpnPluginUiInterface * (*NMVpnPluginUiFactory) (GError **error);
 NMVpnPluginUiInterface *nm_vpn_plugin_ui_factory (GError **error);
 
-
 /*****************************************************************************/
 /* Plugin interface                               */
 /*****************************************************************************/
@@ -93,7 +92,6 @@ typedef enum {
 	NM_VPN_PLUGIN_UI_INTERFACE_PROP_SERVICE
 } NMVpnPluginUiInterfaceProp;
 
-
 struct _NMVpnPluginUiInterface {
 	GTypeInterface g_iface;
 
@@ -173,7 +171,6 @@ gboolean nm_vpn_plugin_ui_interface_delete_connection (NMVpnPluginUiInterface *i
                                                        NMConnection *connection,
                                                        GError **error);
 
-
 /*****************************************************************************/
 /* UI widget interface                            */
 /*****************************************************************************/
@@ -224,7 +221,6 @@ gboolean nm_vpn_plugin_ui_widget_interface_save_secrets (NMVpnPluginUiWidgetInte
                                                          NMConnection *connection,
                                                          GError **error);
 
-
 #ifdef NM_VPN_LIBNM_COMPAT
 #define nm_vpn_editor_plugin_factory nm_vpn_plugin_ui_factory
 
@@ -272,4 +268,4 @@ gboolean nm_vpn_plugin_ui_widget_interface_save_secrets (NMVpnPluginUiWidgetInte
 
 G_END_DECLS
 
-#endif	/* NM_VPN_PLUGIN_UI_INTERFACE_H */
+#endif /* NM_VPN_PLUGIN_UI_INTERFACE_H */
diff --git a/libnm-glib/nm-vpn-plugin.c b/libnm-glib/nm-vpn-plugin.c
index 316939ca..c7c68a8d 100644
--- a/libnm-glib/nm-vpn-plugin.c
+++ b/libnm-glib/nm-vpn-plugin.c
@@ -122,7 +122,6 @@ enum {
 
 static GSList *active_plugins = NULL;
 
-
 GQuark
 nm_vpn_plugin_error_quark (void)
 {
@@ -134,7 +133,6 @@ nm_vpn_plugin_error_quark (void)
 	return quark;
 }
 
-
 static void
 nm_vpn_plugin_set_connection (NMVPNPlugin *plugin,
                               DBusGConnection *connection)
diff --git a/libnm-glib/nm-wimax-nsp.c b/libnm-glib/nm-wimax-nsp.c
index 9e36e5b9..d0ab1f5c 100644
--- a/libnm-glib/nm-wimax-nsp.c
+++ b/libnm-glib/nm-wimax-nsp.c
@@ -278,7 +278,6 @@ constructed (GObject *object)
 	register_properties (NM_WIMAX_NSP (object));
 }
 
-
 static void
 nm_wimax_nsp_class_init (NMWimaxNspClass *nsp_class)
 {
diff --git a/libnm-glib/tests/meson.build b/libnm-glib/tests/meson.build
new file mode 100644
index 00000000..34779018
--- /dev/null
+++ b/libnm-glib/tests/meson.build
@@ -0,0 +1,31 @@
+deps = [
+  dbus_dep,
+  dbus_glib_dep,
+  libnm_glib_dep,
+  libnm_util_dep,
+  shared_dep
+]
+
+test_units = [
+  'test-nm-client',
+  'test-remote-settings-client'
+]
+
+foreach test_unit: test_units
+  exe = executable(
+    test_unit,
+    [test_unit + '.c'] + shared_nm_test_utils_impl_c,
+    dependencies: deps,
+    c_args:
+      common_cflags + [
+        '-DNETWORKMANAGER_COMPILATION_TEST',
+      ] +
+      nm_build_cflags,
+  )
+
+  test(
+    'libnm-glib/' + test_unit,
+    test_script,
+    args: test_args + [exe.full_path()]
+  )
+endforeach
diff --git a/libnm-glib/tests/test-nm-client.c b/libnm-glib/tests/test-nm-client.c
index b6b5968b..df857215 100644
--- a/libnm-glib/tests/test-nm-client.c
+++ b/libnm-glib/tests/test-nm-client.c
@@ -155,6 +155,9 @@ test_device_added (void)
 	DeviceAddedInfo info = { loop, FALSE, FALSE, 0, 0 };
 
 	sinfo = nmtstc_service_init ();
+	if (!nmtstc_service_available (sinfo))
+		return;
+
 	client = nmtstc_nm_client_new ();
 
 	devices = nm_client_get_devices (client);
@@ -312,6 +315,9 @@ test_wifi_ap_added_removed (void)
 	char *expected_path = NULL;
 
 	sinfo = nmtstc_service_init ();
+	if (!nmtstc_service_available (sinfo))
+		return;
+
 	client = nmtstc_nm_client_new ();
 
 	/*************************************/
@@ -535,6 +541,9 @@ test_wimax_nsp_added_removed (void)
 	char *expected_path = NULL;
 
 	sinfo = nmtstc_service_init ();
+	if (!nmtstc_service_available (sinfo))
+		return;
+
 	client = nmtstc_nm_client_new ();
 
 	/*************************************/
@@ -720,6 +729,9 @@ test_devices_array (void)
 	GVariant *ret;
 
 	sinfo = nmtstc_service_init ();
+	if (!nmtstc_service_available (sinfo))
+		return;
+
 	client = nmtstc_nm_client_new ();
 
 	/*************************************/
@@ -820,7 +832,8 @@ manager_running_changed (GObject *client,
 static void
 test_client_manager_running (void)
 {
-	NMClient *client1, *client2;
+	gs_unref_object NMClient *client1 = NULL;
+	gs_unref_object NMClient *client2 = NULL;
 	guint quit_id;
 	int running_changed = 0;
 	GError *error = NULL;
@@ -842,6 +855,9 @@ test_client_manager_running (void)
 
 	/* Now start the test service. */
 	sinfo = nmtstc_service_init ();
+	if (!nmtstc_service_available (sinfo))
+		return;
+
 	client2 = nmtstc_nm_client_new ();
 
 	/* client2 should know that NM is running, but the previously-created
@@ -868,9 +884,6 @@ test_client_manager_running (void)
 	g_assert_cmpint (running_changed, ==, 2);
 	g_assert (!nm_client_get_manager_running (client1));
 	g_source_remove (quit_id);
-
-	g_object_unref (client1);
-	g_object_unref (client2);
 }
 
 /*****************************************************************************/
@@ -1078,7 +1091,6 @@ test_connection_invalid (void)
 	nmtst_assert_connection_unnormalizable (connections->pdata[idx[1]], 0, 0);
 	nmtst_assert_connection_verifies_without_normalization (connections->pdata[idx[2]]);
 
-
 	/**************************************************************************
 	 * Modify the invalid connection and make it valid
 	 *************************************************************************/
diff --git a/libnm-glib/tests/test-remote-settings-client.c b/libnm-glib/tests/test-remote-settings-client.c
index 57bc4faa..031e83f8 100644
--- a/libnm-glib/tests/test-remote-settings-client.c
+++ b/libnm-glib/tests/test-remote-settings-client.c
@@ -70,6 +70,9 @@ test_add_connection (void)
 	time_t start, now;
 	gboolean done = FALSE;
 
+	if (!nmtstc_service_available (sinfo))
+		return;
+
 	connection = nm_connection_new ();
 
 	s_con = (NMSettingConnection *) nm_setting_connection_new ();
@@ -145,6 +148,9 @@ test_make_invisible (void)
 	gboolean done = FALSE, has_settings = FALSE;
 	char *path;
 
+	if (!nmtstc_service_available (sinfo))
+		return;
+
 	g_assert (remote != NULL);
 
 	/* Listen for the remove event when the connection becomes invisible */
@@ -212,6 +218,9 @@ test_make_visible (void)
 	char *path;
 	NMRemoteConnection *new = NULL;
 
+	if (!nmtstc_service_available (sinfo))
+		return;
+
 	g_assert (remote != NULL);
 
 	/* Wait for the new-connection signal when the connection is visible again */
@@ -229,7 +238,6 @@ test_make_visible (void)
 	dbus_g_proxy_begin_call (proxy, "SetVisible", set_visible_cb, NULL, NULL,
 	                         G_TYPE_BOOLEAN, TRUE, G_TYPE_INVALID);
 
-
 	/* Wait for the settings service to announce the connection again */
 	start = time (NULL);
 	do {
@@ -293,6 +301,9 @@ test_remove_connection (void)
 	gboolean done = FALSE;
 	char *path;
 
+	if (!nmtstc_service_available (sinfo))
+		return;
+
 	/* Find a connection to delete */
 	list = nm_remote_settings_list_connections (settings);
 	g_assert_cmpint (g_slist_length (list), >, 0);
@@ -361,11 +372,14 @@ settings_service_running_changed (GObject *client,
 static void
 test_service_running (void)
 {
-	NMRemoteSettings *settings2;
+	gs_unref_object NMRemoteSettings *settings2 = NULL;
 	guint quit_id;
 	int running_changed = 0;
 	gboolean running;
 
+	if (!nmtstc_service_available (sinfo))
+		return;
+
 	loop = g_main_loop_new (NULL, FALSE);
 
 	g_object_get (G_OBJECT (settings),
@@ -404,6 +418,7 @@ test_service_running (void)
 
 	/* Now restart it */
 	sinfo =  nmtstc_service_init ();
+	g_assert (nmtstc_service_available (sinfo));
 
 	quit_id = g_timeout_add_seconds (5, loop_quit, loop);
 	g_main_loop_run (loop);
@@ -414,8 +429,6 @@ test_service_running (void)
 	              NM_REMOTE_SETTINGS_SERVICE_RUNNING, &running,
 	              NULL);
 	g_assert (running == TRUE);
-
-	g_object_unref (settings2);
 }
 
 /*****************************************************************************/