From e888647a70094d5761f931e1a812764330ee5a2b Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Fri, 8 Jul 2005 16:25:39 +0000 Subject: 2005-07-08 Colin Walters * tools/Makefile.am: Kill of print-introspect in favor of using dbus-send --print-reply=literal. * tools/print-introspect.c: Deleted. * test/glib/test-service-glib.xml: * test/glib/test-service-glib.c (my_object_get_objs): New test for "ao". * test/glib/test-dbus-glib.c (echo_received_cb): Free echo data. (main): Test GetObjs. * glib/examples/statemachine/Makefile.am: * glib/examples/statemachine/sm-marshal.list: * glib/examples/statemachine/statemachine-client.c: * glib/examples/statemachine/statemachine-server.c: * glib/examples/statemachine/statemachine-server.xml: * glib/examples/statemachine/statemachine.c: * glib/examples/statemachine/statemachine.h: * glib/examples/statemachine/statemachine.xml: New example. * glib/examples/example-service.c (main): Move invocation of dbus_g_object_type_install_info earlier, to emphasize it should only be done once. * glib/examples/example-signal-emitter.c (main): Ditto. * glib/examples/Makefile.am (SUBDIRS): Include statemachine. * glib/dbus-gvalue.h (dbus_gtype_to_signature) (dbus_gvalue_marshal): Update prototypes. * glib/dbus-gvalue.c: Update all marshalling functions to take const GValue instead of GValue. (signature_iter_to_g_type_array): Return a GPtrArray for nonfixed types. (dbus_gvalue_to_signature): Update for dbus_gtype_to_signature change. (dbus_gtype_to_signature): Handle generic collecitons and maps. Return a newly-allocated string. (demarshal_proxy, demarshal_object_path, demarshal_object) (demarshal_strv, demarshal_ghashtable): Set error, don't assert if we get the wrong types from message. (get_type_demarshaller): New function, extracted from dbus_gvalue_demarshal. (demarshal_collection): New function, demarshals generic collection. (dbus_gvalue_demarshal): Just invoke result of get_type_demarshaller. Throw error if we don't have one. (marshal_garray_basic): Abort on OOM. (get_type_marshaller): New function, extracted from dbus_gvalue_marshal. (collection_marshal_iterator, marshal_collection): New functions; implements generic marshalling for an iteratable specialized collection. (dbus_gvalue_marshal): Just invoke result of get_type_marshaller. * glib/dbus-gvalue-utils.c (gvalue_from_ptrarray_value): Handle G_TYPE_STRING. (ptrarray_value_from_gvalue): Ditto. (ptrarray_append, ptrarray_free): New functions. (slist_constructor, slist_iterator, slist_copy_elt, slist_copy) (slist_append, slist_end_append, slist_free): New functions. (dbus_g_type_specialized_builtins_init): Add append fuctions for GPtrArray and GSList. Register GSList. (test_specialized_hash, _dbus_gvalue_utils_test): New functions. * glib/dbus-gtype-specialized.h (DBusGTypeSpecializedAppendContext): New. (dbus_g_type_specialized_collection_init_append) (dbus_g_type_specialized_collection_append) (dbus_g_type_specialized_collection_end_append): Prototype. (DBusGTypeSpecializedCollectionVtable): Add append_func and end_append_func. * glib/dbus-gtype-specialized.c (dbus_g_type_specialized_collection_init_append) (dbus_g_type_specialized_collection_append) (dbus_g_type_specialized_collection_end_append): New functions. (dbus_g_type_map_value_iterate): Take const GValue. (dbus_g_type_collection_value_iterate): Ditto. * glib/dbus-gtest.c (dbus_glib_internal_do_not_use_run_tests): Run _dbus_gvalue_utils_test. * glib/dbus-gtest.h: Prototype it. * glib/dbus-gproxy.c (dbus_g_proxy_manager_filter): Avoid using uninitialized owner_list. (dbus_g_proxy_begin_call_internal): Move return_if_fail to public API. (dbus_g_proxy_end_call_internal): Update to use error set from dbus_gvalue_demarshal instead of setting it here. (dbus_g_proxy_begin_call): Move return_if_fail here. * glib/dbus-gobject.c (write_interface): Update for dbus_gtype_to_signature returning new string. * configure.in: Add glib/examples/statemachine. --- tools/Makefile.am | 9 ++---- tools/print-introspect.c | 83 ------------------------------------------------ 2 files changed, 2 insertions(+), 90 deletions(-) delete mode 100644 tools/print-introspect.c (limited to 'tools') diff --git a/tools/Makefile.am b/tools/Makefile.am index 71db5203..6a37198d 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -22,13 +22,8 @@ GTK_TOOLS= endif if HAVE_GLIB -noinst_PROGRAMS = print-introspect - -print_introspect_SOURCES = print-introspect.c -print_introspect_LDADD = $(top_builddir)/glib/libdbus-glib-1.la - -dbus-bus-introspect.xml: $(top_builddir)/bus/dbus-daemon dbus-launch 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 +dbus-bus-introspect.xml: $(top_builddir)/bus/dbus-daemon dbus-launch dbus-send $(top_builddir)/bus/dbus-daemon Makefile + DBUS_TOP_BUILDDIR=$(top_builddir) $(srcdir)/run-with-tmp-session-bus.sh ./dbus-send --print-reply=literal --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.Introspectable.Introspect > dbus-bus-introspect.xml.tmp && mv dbus-bus-introspect.xml.tmp dbus-bus-introspect.xml endif bin_PROGRAMS=dbus-send $(GLIB_TOOLS) dbus-launch dbus-cleanup-sockets $(GTK_TOOLS) diff --git a/tools/print-introspect.c b/tools/print-introspect.c deleted file mode 100644 index 91052cf6..00000000 --- a/tools/print-introspect.c +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- mode: C; c-file-style: "gnu" -*- */ -/* gather-introspect.c Dump introspection data from service to stdout - * - * Copyright (C) 2005 Red Hat, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include -#include -#include - -#include - -static void -usage (char *name, int ecode) -{ - fprintf (stderr, "Usage: %s \n", name); - exit (ecode); -} - -int -main (int argc, char *argv[]) -{ - DBusGConnection *connection; - DBusGProxy *proxy; - GError *error; - const char *service; - const char *path; - char *introspect_data; - - if (argc != 3) - usage (argv[0], 1); - - service = argv[1]; - path = argv[2]; - - 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); - g_clear_error (&error); - exit (1); - } - - proxy = dbus_g_proxy_new_for_name (connection, - service, path, - DBUS_INTERFACE_INTROSPECTABLE); - if (!dbus_g_proxy_call (proxy, "Introspect", &error, - G_TYPE_INVALID, - G_TYPE_STRING, &introspect_data, - G_TYPE_INVALID)) - { - fprintf (stderr, "Failed to get introspection data: %s\n", - error->message); - g_clear_error (&error); - exit (1); - } - - printf ("%s", introspect_data); - g_free (introspect_data); - - g_object_unref (proxy); - - exit (0); -} -- cgit