[network-manager-iodine/lr/multiple-vpn: 7/8] service: add --bus-name argument
- From: Lubomir Rintel <lkundrak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-iodine/lr/multiple-vpn: 7/8] service: add --bus-name argument
- Date: Fri, 23 Oct 2015 14:10:53 +0000 (UTC)
commit 93c0a7282d5cbceac3b2d7eebc530e583d06c3ef
Author: Lubomir Rintel <lkundrak v3 sk>
Date: Tue Oct 13 19:39:16 2015 +0200
service: add --bus-name argument
Make it possible to specify a different bus name to acquire.
This makes it possible to run multiple instances of the plugin a the same time.
nm-iodine-service.name.in | 1 +
src/nm-iodine-service.c | 14 +++++++++++---
src/nm-iodine-service.h | 2 +-
3 files changed, 13 insertions(+), 4 deletions(-)
---
diff --git a/nm-iodine-service.name.in b/nm-iodine-service.name.in
index 4061b43..afd9c88 100644
--- a/nm-iodine-service.name.in
+++ b/nm-iodine-service.name.in
@@ -2,6 +2,7 @@
name=iodine
service=org.freedesktop.NetworkManager.iodine
program= LIBEXECDIR@/nm-iodine-service
+supports-multiple-connections=true
[libnm]
plugin= PLUGINDIR@/libnm-vpn-plugin-iodine.so
diff --git a/src/nm-iodine-service.c b/src/nm-iodine-service.c
index 89023d4..9604320 100644
--- a/src/nm-iodine-service.c
+++ b/src/nm-iodine-service.c
@@ -624,14 +624,14 @@ nm_iodine_plugin_class_init (NMIodinePluginClass *iodine_class)
}
NMIodinePlugin *
-nm_iodine_plugin_new (void)
+nm_iodine_plugin_new (const char *bus_name)
{
NMIodinePlugin *plugin;
GError *error = NULL;
plugin = (NMIodinePlugin *) g_initable_new (NM_TYPE_IODINE_PLUGIN, NULL, &error,
NM_VPN_SERVICE_PLUGIN_DBUS_SERVICE_NAME,
- NM_DBUS_SERVICE_IODINE,
+ bus_name,
NULL);
if (!plugin) {
@@ -652,12 +652,20 @@ int main (int argc, char *argv[])
{
NMIodinePlugin *plugin;
GMainLoop *main_loop;
+ gchar *bus_name = NM_DBUS_SERVICE_IODINE;
#if !GLIB_CHECK_VERSION(2,36,0)
g_type_init ();
#endif
- plugin = nm_iodine_plugin_new ();
+ if (argc == 3 && !strcmp (argv[1], "--bus-name"))
+ bus_name = argv[2];
+ else if (argc != 1) {
+ g_printerr ("Usage: %s [--bus-name <bus-name>]\n", argv[0]);
+ exit (EXIT_FAILURE);
+ }
+
+ plugin = nm_iodine_plugin_new (bus_name);
if (!plugin)
exit (EXIT_FAILURE);
diff --git a/src/nm-iodine-service.h b/src/nm-iodine-service.h
index 1102cc0..2c6b313 100644
--- a/src/nm-iodine-service.h
+++ b/src/nm-iodine-service.h
@@ -44,6 +44,6 @@ typedef struct {
GType nm_iodine_plugin_get_type (void);
-NMIodinePlugin *nm_iodine_plugin_new (void);
+NMIodinePlugin *nm_iodine_plugin_new (const char *bus_name);
#endif /* NM_IODINE_PLUGIN_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]