aboutsummaryrefslogtreecommitdiff
path: root/tests/test-glib-proxy-proxy.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-02-09 15:38:03 -0600
committerTed Gould <ted@gould.cx>2010-02-09 15:38:03 -0600
commitaeed270838d07165aa76f95ac445e384fbb94ea5 (patch)
treef249f3c658ef4d208190b334c7e8215e20ee23d8 /tests/test-glib-proxy-proxy.c
parenta52f4ea9d88394aca3992f4c9ca8093d7f07993f (diff)
downloadlibdbusmenu-aeed270838d07165aa76f95ac445e384fbb94ea5.tar.gz
libdbusmenu-aeed270838d07165aa76f95ac445e384fbb94ea5.tar.bz2
libdbusmenu-aeed270838d07165aa76f95ac445e384fbb94ea5.zip
First setup a server.
Diffstat (limited to 'tests/test-glib-proxy-proxy.c')
-rw-r--r--tests/test-glib-proxy-proxy.c58
1 files changed, 58 insertions, 0 deletions
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 <glib.h>
+
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
+#include <dbus/dbus-glib-lowlevel.h>
+#include <dbus/dbus-glib-bindings.h>
+
+#include <libdbusmenu-glib/menuitem.h>
+#include <libdbusmenu-glib/server.h>
+
+#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;
+}