From: Ryan Lortie Date: Tue, 2 Dec 2014 19:45:30 +0000 (-0500) Subject: gdbus-tool: add support for new bus types X-Git-Url: http://review.tizen.org/git/?p=platform%2Fupstream%2Fglib.git;a=commitdiff_plain;h=120da17318c01d4c9408242f0b24e365217bf78a gdbus-tool: add support for new bus types Add support for 'machine' and 'user' busses to the commandline tool. --- diff --git a/gio/gdbus-tool.c b/gio/gdbus-tool.c index db23b43..f17a579 100644 --- a/gio/gdbus-tool.c +++ b/gio/gdbus-tool.c @@ -351,8 +351,8 @@ static const GOptionEntry connection_entries[] = { { "system", 'y', 0, G_OPTION_ARG_NONE, &opt_connection_system, N_("Connect to the system bus"), NULL}, { "session", 'e', 0, G_OPTION_ARG_NONE, &opt_connection_session, N_("Connect to the session bus"), NULL}, - { "user", 'u', 0, G_OPTION_ARG_NONE, &opt_connection_user, N_("Connect to the system bus"), NULL}, - { "machine", 'm', 0, G_OPTION_ARG_NONE, &opt_connection_machine, N_("Connect to the session bus"), NULL}, + { "machine", 'm', 0, G_OPTION_ARG_NONE, &opt_connection_machine, N_("Connect to the machine bus"), NULL}, + { "user", 'u', 0, G_OPTION_ARG_NONE, &opt_connection_user, N_("Connect to the user bus"), NULL}, { "address", 'a', 0, G_OPTION_ARG_STRING, &opt_connection_address, N_("Connect to given D-Bus address"), NULL}, { NULL } }; @@ -383,6 +383,8 @@ connection_get_dbus_connection (GError **error) count = !!opt_connection_system + !!opt_connection_session + + !!opt_connection_machine + + !!opt_connection_user + !!opt_connection_address; /* First, ensure we have exactly one connect */ @@ -411,6 +413,14 @@ connection_get_dbus_connection (GError **error) { c = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, error); } + else if (opt_connection_machine) + { + c = g_bus_get_sync (G_BUS_TYPE_MACHINE, NULL, error); + } + else if (opt_connection_user) + { + c = g_bus_get_sync (G_BUS_TYPE_USER, NULL, error); + } else if (opt_connection_address != NULL) { c = g_dbus_connection_new_for_address_sync (opt_connection_address, @@ -603,7 +613,7 @@ handle_emit (gint *argc, } else { - g_print ("--system \n--session \n--address \n"); + g_print ("--system \n--session \n--machine \n--user \n--address \n"); } } else @@ -835,7 +845,7 @@ handle_call (gint *argc, } else { - g_print ("--system \n--session \n--address \n"); + g_print ("--system \n--session \n--machine \n--user \n--address \n"); } } else @@ -1570,7 +1580,7 @@ handle_introspect (gint *argc, } else { - g_print ("--system \n--session \n--address \n"); + g_print ("--system \n--session \n--machine \n--user \n--address \n"); } } else @@ -1798,7 +1808,7 @@ handle_monitor (gint *argc, } else { - g_print ("--system \n--session \n--address \n"); + g_print ("--system \n--session \n--machine \n--user \n--address \n"); } } else