about summary refs log tree commit diff
path: root/libnm/nm-vpn-service-plugin.c
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2019-07-31 10:51:42 +0200
committerMichael Biebl <biebl@debian.org>2019-07-31 10:51:42 +0200
commit2e5fa45ddfbb5cffa1e78221f1cea706e2f298af (patch)
tree86f69d36c56de3074280456eddc854a780b8e04b /libnm/nm-vpn-service-plugin.c
parent85563b7fc7ec2cd21e38debb9b28db342e2e8e7c (diff)
New upstream version 1.19.90 upstream/1.19.90
Diffstat (limited to 'libnm/nm-vpn-service-plugin.c')
-rw-r--r--libnm/nm-vpn-service-plugin.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/libnm/nm-vpn-service-plugin.c b/libnm/nm-vpn-service-plugin.c
index abd02f18..a2201428 100644
--- a/libnm/nm-vpn-service-plugin.c
+++ b/libnm/nm-vpn-service-plugin.c
@@ -1,4 +1,3 @@
-/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
 /*
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -27,6 +26,7 @@
 #include <stdlib.h>
 
 #include "nm-glib-aux/nm-secret-utils.h"
+#include "nm-glib-aux/nm-dbus-aux.h"
 #include "nm-enum-types.h"
 #include "nm-utils.h"
 #include "nm-connection.h"
@@ -499,16 +499,11 @@ watch_peer (NMVpnServicePlugin *plugin,
 	GDBusConnection *connection = g_dbus_method_invocation_get_connection (context);
 	const char *peer = g_dbus_message_get_sender (g_dbus_method_invocation_get_message (context));
 
-	return g_dbus_connection_signal_subscribe (connection,
-	                                           "org.freedesktop.DBus",
-	                                           "org.freedesktop.DBus",
-	                                           "NameOwnerChanged",
-	                                           "/org/freedesktop/DBus",
-	                                           peer,
-	                                           G_DBUS_SIGNAL_FLAGS_NONE,
-	                                           peer_vanished,
-	                                           plugin,
-	                                           NULL);
+	return nm_dbus_connection_signal_subscribe_name_owner_changed (connection,
+	                                                               peer,
+	                                                               peer_vanished,
+	                                                               plugin,
+	                                                               NULL);
 }
 
 static void
@@ -1190,11 +1185,8 @@ state_changed (NMVpnServicePlugin *plugin, NMVpnServiceState state)
 			nm_vpn_service_plugin_emit_quit (plugin);
 		else
 			schedule_quit_timer (plugin);
-		if (priv->peer_watch_id) {
-			g_dbus_connection_signal_unsubscribe (nm_vpn_service_plugin_get_connection (plugin),
-			                                      priv->peer_watch_id);
-			priv->peer_watch_id = 0;
-		}
+		nm_clear_g_dbus_connection_signal (nm_vpn_service_plugin_get_connection (plugin),
+		                                   &priv->peer_watch_id);
 		break;
 	default:
 		/* Clean up all timers we might have set up. */