summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2005-03-17 17:48:29 +0000
committerColin Walters <walters@verbum.org>2005-03-17 17:48:29 +0000
commita65587676f6791ff6a7c9ed98bbc53d740f51fa8 (patch)
tree1e5fb5030cf55dc63dc388e6da4a7918dfa9251f
parent6180ae6941aea083f5b8f3c4d3f16c928935bcaf (diff)
2005-03-17 Colin Walters <walters@verbum.org>
* bus/print-introspect.c: Move to tools/. * bus/run-with-tmp-session-bus.sh: Ditto. * glib/Makefile.am (dbus-glib-bindings.h): Move generation to tools/Makefile.am. * test/glib/run-test.sh: Update to handle move of run-with-tmp-session-bus.sh. * test/glib/test-service-glib.c: Update to handle move of dbus-glib-bindings.h. * tools/print-introspect.c: Moved here from bus/, and ported to GLib bindings. * tools/run-with-tmp-session-bus.sh: Moved here from bus/. * tools/Makefile.am: Generate dbus-glib-bindings.h and dbus-bus-introspect.xml here. * tools/.cvsignore, glib/.cvsignore, bus/.cvsignore: Update.
-rw-r--r--ChangeLog26
-rw-r--r--bus/.cvsignore3
-rw-r--r--bus/Makefile.am15
-rw-r--r--glib/.cvsignore1
-rw-r--r--glib/Makefile.am8
-rwxr-xr-xtest/glib/run-test.sh2
-rw-r--r--test/glib/test-service-glib.c2
-rw-r--r--tools/.cvsignore4
-rw-r--r--tools/Makefile.am21
-rw-r--r--tools/print-introspect.c (renamed from bus/print-introspect.c)67
-rwxr-xr-xtools/run-with-tmp-session-bus.sh (renamed from bus/run-with-tmp-session-bus.sh)0
11 files changed, 77 insertions, 72 deletions
diff --git a/ChangeLog b/ChangeLog
index 8f9582f2..1fbd7654 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,29 @@
+2005-03-17 Colin Walters <walters@verbum.org>
+
+ * bus/print-introspect.c: Move to tools/.
+ * bus/run-with-tmp-session-bus.sh: Ditto.
+
+ * glib/Makefile.am (dbus-glib-bindings.h): Move
+ generation to tools/Makefile.am.
+
+ * test/glib/run-test.sh: Update to handle move
+ of run-with-tmp-session-bus.sh.
+
+ * test/glib/test-service-glib.c: Update to handle
+ move of dbus-glib-bindings.h.
+
+ * tools/print-introspect.c: Moved here
+ from bus/, and ported to GLib bindings.
+
+ * tools/run-with-tmp-session-bus.sh: Moved here
+ from bus/.
+
+ * tools/Makefile.am: Generate dbus-glib-bindings.h
+ and dbus-bus-introspect.xml here.
+
+ * tools/.cvsignore, glib/.cvsignore, bus/.cvsignore:
+ Update.
+
2005-03-14 Colin Walters <walters@verbum.org>
* bus/driver.c (write_args_for_direction): Use
diff --git a/bus/.cvsignore b/bus/.cvsignore
index 2c6c9b7e..e522ea23 100644
--- a/bus/.cvsignore
+++ b/bus/.cvsignore
@@ -14,7 +14,4 @@ rc.messagebus
messagebus
session.conf
system.conf
-run-with-tmp-session-bus.conf
dbus-daemon.1
-print-introspect
-dbus-bus-introspect.xml
diff --git a/bus/Makefile.am b/bus/Makefile.am
index a1fb76a0..56770656 100644
--- a/bus/Makefile.am
+++ b/bus/Makefile.am
@@ -77,7 +77,7 @@ endif
## we use noinst_PROGRAMS not check_PROGRAMS so that we build
## even when not doing "make check"
-noinst_PROGRAMS=$(TESTS) print-introspect
+noinst_PROGRAMS=$(TESTS)
bus_test_SOURCES= \
$(BUS_SOURCES) \
@@ -85,20 +85,9 @@ bus_test_SOURCES= \
bus_test_LDADD=$(top_builddir)/dbus/libdbus-convenience.la $(DBUS_BUS_LIBS)
-print_introspect_SOURCES = print-introspect.c
-print_introspect_LDADD = $(top_builddir)/dbus/libdbus-convenience.la $(DBUS_BUS_LIBS)
-
-run-with-tmp-session-bus.sh: dbus-daemon
-
-all-local: dbus-bus-introspect.xml
-
-dbus-bus-introspect.xml: $(srcdir)/run-with-tmp-session-bus.sh dbus-daemon
- DBUS_TOP_BUILDDIR=$(top_builddir) $(srcdir)/run-with-tmp-session-bus.sh ./print-introspect org.freedesktop.DBus /org/freedesktop/DBus > dbus-bus-introspect.xml.tmp && mv dbus-bus-introspect.xml.tmp dbus-bus-introspect.xml
-
## mop up the gcov files
clean-local:
/bin/rm *.bb *.bbg *.da *.gcov || true
- /bin/rm -f run-with-tmp-session-bus.conf
install-data-hook:
$(mkinstalldirs) $(DESTDIR)/$(localstatedir)/run/dbus
@@ -136,4 +125,4 @@ man_MANS = dbus-daemon.1
#### Extra dist
-EXTRA_DIST=$(CONFIG_IN_FILES) $(SCRIPT_IN_FILES) $(man_MANS) $(MAN_IN_FILES) run-with-tmp-session-bus.sh
+EXTRA_DIST=$(CONFIG_IN_FILES) $(SCRIPT_IN_FILES) $(man_MANS) $(MAN_IN_FILES)
diff --git a/glib/.cvsignore b/glib/.cvsignore
index e1a6372c..4e197a9f 100644
--- a/glib/.cvsignore
+++ b/glib/.cvsignore
@@ -6,7 +6,6 @@ Makefile.in
*.la
dbus-glib-test
dbus-binding-tool
-dbus-glib-bindings.h
*.bb
*.bbg
*.da
diff --git a/glib/Makefile.am b/glib/Makefile.am
index b4256fac..6d81e7d1 100644
--- a/glib/Makefile.am
+++ b/glib/Makefile.am
@@ -2,9 +2,6 @@ INCLUDES=-I$(top_srcdir) $(DBUS_CLIENT_CFLAGS) $(DBUS_GLIB_CFLAGS) $(DBUS_GLIB_T
lib_LTLIBRARIES=libdbus-glib-1.la
-libdbus_glib_HEADERS = dbus-glib-bindings.h
-libdbus_glibdir = $(includedir)/dbus-1.0/dbus
-
libdbus_glib_1_la_SOURCES = \
dbus-glib.c \
dbus-gmain.c \
@@ -50,11 +47,6 @@ dbus_binding_tool_SOURCES = \
dbus_binding_tool_LDADD= -lexpat libdbus-gtool.la
-dbus-glib-bindings.h: $(top_builddir)/bus/dbus-bus-introspect.xml dbus-binding-tool
- ./dbus-binding-tool --ignore-unsupported --mode=glib-client --output=dbus-glib-bindings.h $(top_builddir)/bus/dbus-bus-introspect.xml # FIXME - remove --ignore-unsupported when we can do arrays
-
-BUILT_SOURCES = dbus-glib-bindings.h
-
## we just rebuilt these manually and check them into cvs; easier than
## convincing automake/make to do this properly
regenerate-built-sources:
diff --git a/test/glib/run-test.sh b/test/glib/run-test.sh
index 51d4a713..86f1aee8 100755
--- a/test/glib/run-test.sh
+++ b/test/glib/run-test.sh
@@ -10,7 +10,7 @@ export DBUS_TEST_GLIB_RUN_TEST_SCRIPT=1
if test -z "$DBUS_TEST_GLIB_IN_RUN_TEST"; then
DBUS_TEST_GLIB_IN_RUN_TEST=1
export DBUS_TEST_GLIB_IN_RUN_TEST
- exec $DBUS_TOP_BUILDDIR/bus/run-with-tmp-session-bus.sh $SCRIPTNAME $MODE
+ exec $DBUS_TOP_BUILDDIR/tools/run-with-tmp-session-bus.sh $SCRIPTNAME $MODE
fi
if test x$MODE = xprofile ; then
diff --git a/test/glib/test-service-glib.c b/test/glib/test-service-glib.c
index fef8a9da..d929999d 100644
--- a/test/glib/test-service-glib.c
+++ b/test/glib/test-service-glib.c
@@ -3,7 +3,7 @@
/* NOTE - outside of D-BUS core this would be
* include <dbus/dbus-glib-bindings.h>
*/
-#include "glib/dbus-glib-bindings.h"
+#include "tools/dbus-glib-bindings.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/tools/.cvsignore b/tools/.cvsignore
index c9dffa00..ae3996bd 100644
--- a/tools/.cvsignore
+++ b/tools/.cvsignore
@@ -13,3 +13,7 @@ dbus-launch
*.gcov
*.da
dbus-viewer
+dbus-glib-bindings.h
+run-with-tmp-session-bus.conf
+print-introspect
+dbus-bus-introspect.xml
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 7cc6cadf..aeb6d6ce 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -2,6 +2,15 @@ INCLUDES=-I$(top_srcdir) $(DBUS_CLIENT_CFLAGS) $(DBUS_GLIB_CFLAGS) $(DBUS_X_CFLA
if HAVE_GLIB
GLIB_TOOLS=dbus-monitor
+
+libdbus_glib_HEADERS = dbus-glib-bindings.h
+libdbus_glibdir = $(includedir)/dbus-1.0/dbus
+
+dbus-glib-bindings.h: dbus-bus-introspect.xml $(top_builddir)/glib/dbus-binding-tool
+ $(top_builddir)/glib/dbus-binding-tool --ignore-unsupported --mode=glib-client --output=dbus-glib-bindings.h dbus-bus-introspect.xml # FIXME - remove --ignore-unsupported when we can do arrays
+
+BUILT_SOURCES = dbus-glib-bindings.h
+
else
GLIB_TOOLS=
endif
@@ -12,6 +21,16 @@ else
GTK_TOOLS=
endif
+noinst_PROGRAMS = print-introspect
+
+print_introspect_SOURCES = print-introspect.c
+print_introspect_LDADD = $(top_builddir)/glib/libdbus-glib-1.la
+
+run-with-tmp-session-bus.sh: $(top_builddir)/bus/dbus-daemon dbus-launch
+
+dbus-bus-introspect.xml: $(srcdir)/run-with-tmp-session-bus.sh print-introspect $(top_builddir)/bus/dbus-daemon
+ DBUS_TOP_BUILDDIR=$(top_builddir) $(srcdir)/run-with-tmp-session-bus.sh ./print-introspect org.freedesktop.DBus /org/freedesktop/DBus > dbus-bus-introspect.xml.tmp && mv dbus-bus-introspect.xml.tmp dbus-bus-introspect.xml
+
bin_PROGRAMS=dbus-send $(GLIB_TOOLS) dbus-launch dbus-cleanup-sockets $(GTK_TOOLS)
dbus_send_SOURCES= \
@@ -43,6 +62,6 @@ dbus_launch_LDADD= $(DBUS_X_LIBS)
dbus_viewer_LDADD= $(DBUS_GLIB_TOOL_LIBS) $(top_builddir)/glib/libdbus-gtool.la $(DBUS_GTK_THREADS_LIBS)
man_MANS = dbus-send.1 dbus-monitor.1 dbus-launch.1 dbus-cleanup-sockets.1
-EXTRA_DIST = $(man_MANS)
+EXTRA_DIST = $(man_MANS) run-with-tmp-session-bus.sh
diff --git a/bus/print-introspect.c b/tools/print-introspect.c
index c040af41..9784af00 100644
--- a/bus/print-introspect.c
+++ b/tools/print-introspect.c
@@ -23,7 +23,7 @@
#include <stdlib.h>
#include <string.h>
-#include <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
static void
usage (char *name, int ecode)
@@ -35,10 +35,10 @@ usage (char *name, int ecode)
int
main (int argc, char *argv[])
{
- DBusConnection *connection;
- DBusError error;
- DBusMessage *message;
- DBusMessage *reply;
+ DBusGConnection *connection;
+ DBusGProxy *proxy;
+ DBusGPendingCall *call;
+ GError *error;
const char *service;
const char *path;
const char *introspect_data;
@@ -49,56 +49,35 @@ main (int argc, char *argv[])
service = argv[1];
path = argv[2];
- dbus_error_init (&error);
- connection = dbus_bus_get (DBUS_BUS_SESSION, &error);
+ g_type_init ();
+
+ error = NULL;
+ connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
if (connection == NULL)
{
fprintf (stderr, "Failed to open connection to session bus: %s\n",
- error.message);
- dbus_error_free (&error);
- exit (1);
- }
-
- message = dbus_message_new_method_call (NULL,
- path,
- DBUS_INTERFACE_INTROSPECTABLE,
- "Introspect");
- if (message == NULL)
- {
- fprintf (stderr, "Couldn't allocate D-BUS message\n");
- exit (1);
- }
-
- if (!dbus_message_set_destination (message, service))
- {
- fprintf (stderr, "Not enough memory\n");
- exit (1);
- }
-
- reply = dbus_connection_send_with_reply_and_block (connection,
- message,
- -1,
- &error);
- dbus_message_unref (message);
- if (dbus_error_is_set (&error))
- {
- fprintf (stderr, "Error: %s\n", error.message);
+ error->message);
+ g_clear_error (&error);
exit (1);
}
- if (!dbus_message_get_args (reply, &error,
- DBUS_TYPE_STRING,
- &introspect_data,
- DBUS_TYPE_INVALID))
+ proxy = dbus_g_proxy_new_for_name (connection,
+ service, path,
+ DBUS_INTERFACE_INTROSPECTABLE);
+ call = dbus_g_proxy_begin_call (proxy, "Introspect", DBUS_TYPE_INVALID);
+ if (!dbus_g_proxy_end_call (proxy, call, &error, DBUS_TYPE_STRING,
+ &introspect_data, DBUS_TYPE_INVALID))
{
- fprintf (stderr, "Error: %s\n", error.message);
+ fprintf (stderr, "Failed to get introspection data: %s\n",
+ error->message);
+ g_clear_error (&error);
exit (1);
}
+
printf ("%s", introspect_data);
- dbus_message_unref (reply);
-
- dbus_connection_disconnect (connection);
+ dbus_g_pending_call_unref (call);
+ g_object_unref (proxy);
exit (0);
}
diff --git a/bus/run-with-tmp-session-bus.sh b/tools/run-with-tmp-session-bus.sh
index ce077d72..ce077d72 100755
--- a/bus/run-with-tmp-session-bus.sh
+++ b/tools/run-with-tmp-session-bus.sh