From aeed270838d07165aa76f95ac445e384fbb94ea5 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 9 Feb 2010 15:38:03 -0600 Subject: First setup a server. --- tests/test-glib-proxy-proxy.c | 58 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) (limited to 'tests/test-glib-proxy-proxy.c') diff --git a/tests/test-glib-proxy-proxy.c b/tests/test-glib-proxy-proxy.c index e69de29..781c13c 100644 --- a/tests/test-glib-proxy-proxy.c +++ b/tests/test-glib-proxy-proxy.c @@ -0,0 +1,58 @@ +#include + +#include +#include +#include +#include + +#include +#include + +#include "test-glib-proxy.h" + +static DbusmenuServer * server = NULL; +static GMainLoop * mainloop = NULL; + +int +main (int argc, char ** argv) +{ + g_type_init(); + + if (argc != 3) { + g_error ("Need two params"); + return 1; + } + + gchar * whoami = argv[1]; + gchar * myproxy = argv[2]; + + g_debug("I am '%s' and I'm proxying '%s'", whoami, myproxy); + + GError * error = NULL; + DBusGConnection * connection = dbus_g_bus_get(DBUS_BUS_SESSION, NULL); + + g_debug("DBus ID: %s", dbus_connection_get_server_id(dbus_g_connection_get_connection(connection))); + + DBusGProxy * bus_proxy = dbus_g_proxy_new_for_name(connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); + guint nameret = 0; + + if (!org_freedesktop_DBus_request_name(bus_proxy, whoami, 0, &nameret, &error)) { + g_error("Unable to call to request name"); + return 1; + } + + if (nameret != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { + g_error("Unable to get name"); + return 1; + } + + server = dbusmenu_server_new("/org/test"); + + mainloop = g_main_loop_new(NULL, FALSE); + g_main_loop_run(mainloop); + + g_object_unref(G_OBJECT(server)); + g_debug("Quiting"); + + return 0; +} -- cgit v1.2.3