mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-05-05 07:38:20 +02:00
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.
This commit is contained in:
parent
6180ae6941
commit
a65587676f
11 changed files with 77 additions and 72 deletions
26
ChangeLog
26
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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ Makefile.in
|
|||
*.la
|
||||
dbus-glib-test
|
||||
dbus-binding-tool
|
||||
dbus-glib-bindings.h
|
||||
*.bb
|
||||
*.bbg
|
||||
*.da
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
error->message);
|
||||
g_clear_error (&error);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
message = dbus_message_new_method_call (NULL,
|
||||
path,
|
||||
DBUS_INTERFACE_INTROSPECTABLE,
|
||||
"Introspect");
|
||||
if (message == NULL)
|
||||
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, "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);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
if (!dbus_message_get_args (reply, &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);
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue