about 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.c102
-rw-r--r--libnm-glib/meson.build293
-rw-r--r--libnm-glib/nm-access-point.c2
-rw-r--r--libnm-glib/nm-client.c5
-rw-r--r--libnm-glib/nm-device.c2
-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-remote-connection.c14
-rw-r--r--libnm-glib/nm-secret-agent.c12
-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.c20
-rw-r--r--libnm-glib/nm-vpn-plugin-ui-interface.h2
-rw-r--r--libnm-glib/nm-vpn-plugin.c10
-rw-r--r--libnm-glib/tests/meson.build30
18 files changed, 552 insertions, 95 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..709d44aa 100644
--- a/libnm-glib/libnm_glib.c
+++ b/libnm-glib/libnm_glib.c
@@ -32,37 +32,37 @@
 #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;
 
 
@@ -74,9 +74,9 @@ 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 +108,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 +125,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 +140,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 +170,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);
 
@@ -188,7 +188,7 @@ _libnm_glib_call_callbacks (libnm_glib_ctx *ctx)
 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);
 
@@ -221,9 +221,9 @@ _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 +242,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 +257,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 +273,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);
@@ -297,8 +297,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);
@@ -349,7 +349,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 +369,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);
@@ -393,7 +393,7 @@ _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);
@@ -410,7 +410,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);
 
@@ -493,9 +493,7 @@ error:
 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 +504,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)
@@ -544,12 +542,12 @@ libnm_glib_get_network_state (const libnm_glib_ctx *ctx)
 
 
 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);
diff --git a/libnm-glib/meson.build b/libnm-glib/meson.build
new file mode 100644
index 00000000..eddf983e
--- /dev/null
+++ b/libnm-glib/meson.build
@@ -0,0 +1,293 @@
+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'
+
+sources += custom_target(
+  glue,
+  input: ifaces_vpn_plugin_xml,
+  output: glue,
+  command: [dbus_binding_tool, '--prefix=nm_vpn_plugin', '--mode=glib-server', '--output=@OUTPUT@', '@INPUT@']
+)
+
+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: sources + 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}'
+)
+
+sources = shared_udev_utils + 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: sources + libnm_glib_enum + [nm_secret_agent_glue],
+  version: libnm_glib_version,
+  dependencies: deps,
+  c_args: cflags + [
+    '-DNMRUNDIR="@0@"'.format(nm_pkgrundir),
+  ],
+  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 = 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_pkglibdir,
+    'configdir=' + nm_pkgconfdir
+  ]
+)
diff --git a/libnm-glib/nm-access-point.c b/libnm-glib/nm-access-point.c
index 70b98f6d..3b923aa2 100644
--- a/libnm-glib/nm-access-point.c
+++ b/libnm-glib/nm-access-point.c
@@ -664,7 +664,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-client.c b/libnm-glib/nm-client.c
index db15c4b3..c14d8c96 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
@@ -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.c b/libnm-glib/nm-device.c
index be86a246..c340d5e5 100644
--- a/libnm-glib/nm-device.c
+++ b/libnm-glib/nm-device.c
@@ -2006,7 +2006,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
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-remote-connection.c b/libnm-glib/nm-remote-connection.c
index 6dcce0ba..820f9e5c 100644
--- a/libnm-glib/nm-remote-connection.c
+++ b/libnm-glib/nm-remote-connection.c
@@ -218,7 +218,7 @@ proxy_destroy_cb (DBusGProxy* proxy, gpointer user_data) {
 static void
 result_cb (RemoteCall *call, DBusGProxyCall *proxy_call, GError *error)
 {
-	NMRemoteConnectionResultFunc func = (NMRemoteConnectionResultFunc) call->callback;
+	NMRemoteConnectionResultFunc func = (NMRemoteConnectionResultFunc)(void (*) (void)) call->callback;
 	GError *local_error = NULL;
 
 	if (!error) {
@@ -254,7 +254,7 @@ nm_remote_connection_commit_changes (NMRemoteConnection *self,
 
 	priv = NM_REMOTE_CONNECTION_GET_PRIVATE (self);
 
-	call = remote_call_new (self, result_cb, (GFunc) callback, user_data);
+	call = remote_call_new (self, result_cb, (GFunc)(void (*) (void)) callback, user_data);
 	if (!call)
 		return;
 
@@ -294,7 +294,7 @@ nm_remote_connection_commit_changes_unsaved (NMRemoteConnection *connection,
 
 	priv = NM_REMOTE_CONNECTION_GET_PRIVATE (connection);
 
-	call = remote_call_new (connection, result_cb, (GFunc) callback, user_data);
+	call = remote_call_new (connection, result_cb, (GFunc)(void (*) (void)) callback, user_data);
 	if (!call)
 		return;
 
@@ -331,7 +331,7 @@ nm_remote_connection_save (NMRemoteConnection *connection,
 
 	priv = NM_REMOTE_CONNECTION_GET_PRIVATE (connection);
 
-	call = remote_call_new (connection, result_cb, (GFunc) callback, user_data);
+	call = remote_call_new (connection, result_cb, (GFunc)(void (*) (void)) callback, user_data);
 	if (!call)
 		return;
 
@@ -359,7 +359,7 @@ nm_remote_connection_delete (NMRemoteConnection *self,
 
 	priv = NM_REMOTE_CONNECTION_GET_PRIVATE (self);
 
-	call = remote_call_new (self, result_cb, (GFunc) callback, user_data);
+	call = remote_call_new (self, result_cb, (GFunc)(void (*) (void)) callback, user_data);
 	if (!call)
 		return;
 
@@ -372,7 +372,7 @@ nm_remote_connection_delete (NMRemoteConnection *self,
 static void
 get_secrets_cb (RemoteCall *call, DBusGProxyCall *proxy_call, GError *error)
 {
-	NMRemoteConnectionGetSecretsFunc func = (NMRemoteConnectionGetSecretsFunc) call->callback;
+	NMRemoteConnectionGetSecretsFunc func = (NMRemoteConnectionGetSecretsFunc)(void (*) (void)) call->callback;
 	GHashTable *secrets = NULL;
 	GError *local_error = NULL;
 
@@ -415,7 +415,7 @@ nm_remote_connection_get_secrets (NMRemoteConnection *self,
 
 	priv = NM_REMOTE_CONNECTION_GET_PRIVATE (self);
 
-	call = remote_call_new (self, get_secrets_cb, (GFunc) callback, user_data);
+	call = remote_call_new (self, get_secrets_cb, (GFunc)(void (*) (void)) callback, user_data);
 	if (!call)
 		return;
 
diff --git a/libnm-glib/nm-secret-agent.c b/libnm-glib/nm-secret-agent.c
index 75129e06..69c81d07 100644
--- a/libnm-glib/nm-secret-agent.c
+++ b/libnm-glib/nm-secret-agent.c
@@ -695,7 +695,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 +709,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 +737,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 +745,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 +764,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 +772,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-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..f06e77c4 100644
--- a/libnm-glib/nm-vpn-plugin-ui-interface.c
+++ b/libnm-glib/nm-vpn-plugin-ui-interface.c
@@ -78,13 +78,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
 		};
 
@@ -197,13 +197,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..bc5d8436 100644
--- a/libnm-glib/nm-vpn-plugin-ui-interface.h
+++ b/libnm-glib/nm-vpn-plugin-ui-interface.h
@@ -272,4 +272,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 4c4c3161..316939ca 100644
--- a/libnm-glib/nm-vpn-plugin.c
+++ b/libnm-glib/nm-vpn-plugin.c
@@ -687,9 +687,17 @@ impl_vpn_plugin_set_failure (NMVPNPlugin *plugin,
 /*****************************************************************************/
 
 static void
+_emit_quit (gpointer data, gpointer user_data)
+{
+	NMVPNPlugin *plugin = data;
+
+	nm_vpn_plugin_emit_quit (plugin);
+}
+
+static void
 sigterm_handler (int signum)
 {
-	g_slist_foreach (active_plugins, (GFunc) nm_vpn_plugin_emit_quit, NULL);
+	g_slist_foreach (active_plugins, _emit_quit, NULL);
 }
 
 static void
diff --git a/libnm-glib/tests/meson.build b/libnm-glib/tests/meson.build
new file mode 100644
index 00000000..029b3c20
--- /dev/null
+++ b/libnm-glib/tests/meson.build
@@ -0,0 +1,30 @@
+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_test_utils,
+    dependencies: deps,
+    c_args: common_cflags + [
+      '-DNETWORKMANAGER_COMPILATION_TEST',
+      '-DTEST_NM_SERVICE="@0@"'.format(join_paths(meson.source_root(), 'tools', 'test-networkmanager-service.py')),
+    ],
+  )
+
+  test(
+    'libnm-glib/' + test_unit,
+    test_script,
+    args: test_args + [exe.full_path()]
+  )
+endforeach