dbus/test/glib test-service-glib.xml, 1.3, 1.4 test-service-glib.c,
1.11, 1.12 test-dbus-glib.c, 1.16, 1.17 Makefile.am, 1.11, 1.12
Colin Walters
walters at freedesktop.org
Sun Jun 12 20:01:22 PDT 2005
- Previous message: dbus/tools print-introspect.c, 1.1, 1.2 dbus-viewer.c, 1.12,
1.13 dbus-names-model.c, 1.5, 1.6 Makefile.am, 1.14, 1.15
- Next message: dbus/python Makefile.am,1.12,1.13
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvs/dbus/dbus/test/glib
In directory gabe:/tmp/cvs-serv11651/test/glib
Modified Files:
test-service-glib.xml test-service-glib.c test-dbus-glib.c
Makefile.am
Log Message:
2005-06-12 Colin Walters <walters at verbum.org>
Async signals and various bugfixes and testing by
Ross Burton <ross at burtonini.com>.
* glib/dbus-gvalue.h: (struct DBusBasicGValue): Delete.
(dbus_gvalue_genmarshal_name_from_type)
(dbus_gvalue_ctype_from_type): Moved to dbus-binding-tool-glib.c.
(dbus_gtype_to_dbus_type): Renamed to dbus_gtype_from_signature.
(dbus_g_value_types_init, dbus_gtype_from_signature)
(dbus_gtype_from_signature_iter, dbus_gtype_to_signature)
(dbus_gtypes_from_arg_signature): New function prototypes.
(dbus_gvalue_demarshal): Take context and error arguments.
(dbus_gvalue_demarshal_variant): New function.
(dbus_gvalue_demarshal_message): New function.
(dbus_gvalue_store): Delete.
* glib/dbus-gvalue.c:
File has been almost entirely rewritten; now we special-case
more types such as DBUS_TYPE_SIGNATURE, handle arrays and
hash tables correctly, etc. Full support for recursive values
is not yet complete.
* glib/dbus-gproxy.c (dbus_g_proxy_class_init): Change last
argument of signal to G_TYPE_POINTER since we now pass a
structure.
(lookup_g_marshaller): Delete in favor of
_dbus_gobject_lookup_marshaller.
(marshal_dbus_message_to_g_marshaller): Use
_dbus_gobject_lookup_marshaller and dbus_gvalue_demarshal_message
to handle remote signal callbacks.
(dbus_g_proxy_new_from_proxy): New function; creates a new
DBusGProxy by copying an existing one.
(dbus_g_proxy_get_interface, dbus_g_proxy_set_interface)
(dbus_g_proxy_get_path): New functions.
(dbus_g_proxy_marshal_args_to_message): New function;
factored out of existing code.
(DBUS_G_VALUE_ARRAY_COLLECT_ALL): Collect all arguments
from a varargs array.
(dbus_g_proxy_begin_call_internal): New function.
(dbus_g_proxy_end_call_internal): New function.
(dbus_g_proxy_begin_call): Take GTypes instead of DBus types
as arguments; simply invoke dbus_g_proxy_begin_call_internal
after collecting args into value array.
(dbus_g_proxy_end_call): Take GTypes instead of DBus types;
invoke dbus_g_proxy_end_call_internal.
(dbus_g_proxy_invoke): Simply invoke begin_call_interanl and
end_call_internal.
(dbus_g_proxy_call_no_reply): Take GTypes instead of DBus
types.
(array_free_all): New function.
(dbus_g_proxy_add_signal): Take GTypes.
* glib/dbus-gobject.h:
(_dbus_glib_marshal_dbus_message_to_gvalue_array): Delete.
(_dbus_gobject_get_path, _dbus_gobject_lookup_marshaller):
Prototype.
* glib/dbus-gobject.c: Add a global marshal_table hash which
stores mappings from type signatures to marshallers. Change lots
of invocations of dbus_gtype_to_dbus_type to
dbus_gtype_to_signature.
(_dbus_glib_marshal_dbus_message_to_gvalue_array): Delete.
(introspect_signals): Fix test for query.return_type.
(set_object_property): Update invocation of dbus_gvalue_demarshal.
(invoke_object_method): Many changes. Handle asynchronous
invocations. Convert arguments with
dbus_gvalue_demarshal_message. Handle errors. Use
DBusSignatureIter instead of strlen on args. Handle all arguments
generically. Special-case variants.
(dbus_g_method_return, dbus_g_method_return_error): New function.
(DBusGSignalClosure): New structure, closes over signal
information.
(dbus_g_signal_closure_new): New function.
(dbus_g_signal_closure_finalize): New function.
(signal_emitter_marshaller): New function; is special marshaller
which emits signals on bus.
(export_signals): New function; introspects object signals and
connects to them.
(dbus_g_object_type_install_info): Take GType instead of
GObjectClass.
(dbus_g_connection_register_g_object): Invoke export_signals.
(dbus_g_connection_lookup_g_object): New function.
(DBusGFuncSignature) New structure; used for mapping type
signatures to marshallers.
(funcsig_hash): New function; hashes DBusGFuncSignature.
(funcsig_equal): New function; compares DBusGFuncSignature.
(_dbus_gobject_lookup_marshaller): New function.
(dbus_g_object_register_marshaller): New function; used to
register a marshaller at runtime for a particular signature.
* glib/dbus-gmain.c (_dbus_gmain_test): Add various tests.
* glib/dbus-binding-tool-glib.h: Add DBUS_GLIB_ANNOTATION_ASYNC
which notes a server method implementation should be
asynchronous.
* glib/dbus-binding-tool-glib.c
(dbus_binding_tool_output_glib_server): Call
dbus_g_value_types_init.
(write_formal_parameters): Use dbus_gtype_from_signature. Handle
variants specially.
(dbus_g_type_get_lookup_function): Turn GType into an invocation
of a lookup function.
(write_args_for_direction): Use dbus_g_type_get_lookup_function.
(write_untyped_out_args): New method; write output arguments.
(write_formal_declarations_for_direction): Function for
writing prototypes.
(write_formal_parameters_for_direction): Function for
writing implementations.
(write_typed_args_for_direction): Function for writing
arguments prefixed with GTypes.
(write_async_method_client): Write out async version
of method.
* glib/dbus-binding-tool-glib.c: Include dbus-gvalue-utils.h.
(dbus_g_type_get_marshal_name): Move mapping from GType
to marshal name into here.
(dbus_g_type_get_c_name): Move into here.
(compute_marshaller): Convert signature to type with
dbus_gtype_from_signature, use dbus_g_type_get_marshal_name.
(compute_marshaller_name): Ditto.
(compute_marshaller): Handle async signal annotations.
(gather_marshallers): Return if we don't have a known
prefix.
(generate_glue): Collect introspection blob here, and
write all of the blob at the end. This allows an object
with multiple interfaces to work.
Mark async methods in introspection blob.
* glib/Makefile.am (libdbus_glib_1_la_SOURCES): Add
dbus-gtype-specialized.c, dbus-gtype-specialized.h,
dbus-gvalue-utils.h, dbus-gvalue-utils.c.
* dbus/dbus-glib.h: Don't include dbus-protocol.h; this
avoids people accidentally using DBUS_TYPE_* which should
not be necessary anymore.
Do include dbus-gtype-specialized.h, which are utilities
for GLib container types.
Add various #defines for types such as
DBUS_TYPE_G_BOOLEAN_ARRAY.
(DBusGValueIterator, DBusGValue): Define, not fully used
yet.
(dbus_g_value_get_g_type): Type for recursive value.
(dbus_g_value_open, dbus_g_value_iterator_get_value)
(dbus_g_value_iterator_get_values, dbus_g_value_iterator_recurse)
(dbus_g_value_free): Prototypes.
(dbus_g_object_register_marshaller, dbus_g_proxy_new_from_proxy): Prototype.
(dbus_g_proxy_set_interface): Prototype.
(dbus_g_proxy_begin_call, dbus_g_proxy_end_call)
(dbus_g_proxy_call_no_reply): Take GLib types instead of DBus
types.
(dbus_g_proxy_get_path, dbus_g_proxy_get_interface):
Accessors.
(DBusGAsyncData, DBusGMethodInvocation): Structures for
doing async invocations.
(dbus_g_method_return, dbus_g_method_return_error):
Prototypes.
* doc/dbus-tutorial.xml: Update GLib section.
* tools/dbus-viewer.c (load_child_nodes): Update
for new invocation type of dbus_g_proxy_end_call.
(load_from_service_thread_func): Ditto.
* tools/print-introspect.c (main): Ditto.
* tools/dbus-names-model.c (have_names_notify)
(names_model_reload, names_model_set_connection)
Use GTypes.
* python/Makefile.am (INCLUDES): Define DBUS_COMPILATION,
needed since Python bindings use GLib bindings.
* test/glib/Makefile.am (INCLUDES): Define DBUS_COMPILATION.
Add --prefix argument.
* tools/Makefile.am: Define DBUS_COMPILATION. Remove
unneeded --ignore-unsupported arg.
* test/glib/test-service-glib.c:
* test/glib/test-service-glib.xml:
* test/glib/test-dbus-glib.c: Add many more tests.
Index: test-service-glib.xml
===================================================================
RCS file: /cvs/dbus/dbus/test/glib/test-service-glib.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- test-service-glib.xml 27 Feb 2005 17:38:12 -0000 1.3
+++ test-service-glib.xml 13 Jun 2005 03:01:19 -0000 1.4
@@ -1,32 +1,24 @@
<?xml version="1.0" encoding="UTF-8" ?>
<node name="/org/freedesktop/DBus/Tests/MyTestObject">
-
<interface name="org.freedesktop.DBus.Tests.MyObject">
- <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="my_object"/>
-
<method name="DoNothing">
- <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="my_object_do_nothing"/>
</method>
<method name="Increment">
- <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="my_object_increment"/>
<arg type="u" name="x" />
<arg type="u" direction="out" />
</method>
<method name="ThrowError">
- <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="my_object_throw_error"/>
</method>
<method name="Uppercase">
- <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="my_object_uppercase"/>
<arg type="s" direction="in" />
<arg type="s" direction="out" />
</method>
<method name="ManyArgs">
- <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="my_object_many_args"/>
<arg type="u" name="x" direction="in" />
<arg type="s" name="str" direction="in" />
<arg type="d" name="trouble" direction="in" />
@@ -34,6 +26,71 @@
<arg type="s" name="str_ret" direction="out" />
</method>
+ <method name="ManyReturn">
+ <arg type="u" direction="out" />
+ <arg type="s" direction="out" />
+ <arg type="i" direction="out" />
+ <arg type="u" direction="out" />
+ <arg type="u" direction="out" />
+ <arg type="s" direction="out" />
+ </method>
+
+ <method name="Stringify">
+ <arg type="v" name="val" direction="in"/>
+ <arg type="s" direction="out"/>
+ </method>
+
+ <method name="Unstringify">
+ <arg type="s" name="val" direction="in"/>
+ <arg type="v" direction="out"/>
+ </method>
+
+ <method name="Recursive1">
+ <arg type="au" direction="in"/>
+ <arg type="u" direction="out"/>
+ </method>
+
+ <method name="Recursive2">
+ <arg type="u" direction="in"/>
+ <arg type="au" direction="out"/>
+ </method>
+
+ <method name="ManyUppercase">
+ <arg type="as" direction="in"/>
+ <arg type="as" direction="out"/>
+ </method>
+
+ <method name="StrHashLen">
+ <arg type="a{ss}" direction="in"/>
+ <arg type="u" direction="out"/>
+ </method>
+
+ <method name="GetHash">
+ <arg type="a{ss}" direction="out"/>
+ </method>
+
+ <method name="Objpath">
+ <arg type="o" direction="in"/>
+ <arg type="o" direction="out"/>
+ </method>
+
+ <method name="IncrementVal">
+ </method>
+
+ <method name="GetVal">
+ <arg type="u" direction="out" />
+ </method>
+
+ <method name="EmitFrobnicate">
+ </method>
+
+ </interface>
+
+ <interface name="org.freedesktop.DBus.Tests.FooObject">
+ <method name="GetValue">
+ <arg type="u" direction="out" />
+ </method>
+
</interface>
</node>
Index: test-service-glib.c
===================================================================
RCS file: /cvs/dbus/dbus/test/glib/test-service-glib.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- test-service-glib.c 17 Mar 2005 17:48:29 -0000 1.11
+++ test-service-glib.c 13 Jun 2005 03:01:19 -0000 1.12
@@ -20,6 +20,7 @@
{
GObject parent;
char *this_is_a_string;
+ guint val;
};
struct MyObjectClass
@@ -46,7 +47,7 @@
gboolean my_object_do_nothing (MyObject *obj, GError **error);
-gboolean my_object_increment (MyObject *obj, gint32 x, int *ret, GError **error);
+gboolean my_object_increment (MyObject *obj, gint32 x, gint32 *ret, GError **error);
gboolean my_object_throw_error (MyObject *obj, GError **error);
@@ -54,6 +55,30 @@
gboolean my_object_many_args (MyObject *obj, guint32 x, const char *str, double trouble, double *d_ret, char **str_ret, GError **error);
+gboolean my_object_many_return (MyObject *obj, guint32 *arg0, char **arg1, gint32 *arg2, guint32 *arg3, guint32 *arg4, char **arg5, GError **error);
+
+gboolean my_object_recursive1 (MyObject *obj, GArray *array, guint32 *len_ret, GError **error);
+gboolean my_object_recursive2 (MyObject *obj, guint32 reqlen, GArray **array, GError **error);
+
+gboolean my_object_objpath (MyObject *obj, GObject *in, GObject **arg1, GError **error);
+
+gboolean my_object_stringify (MyObject *obj, GValue *value, char **ret, GError **error);
+gboolean my_object_unstringify (MyObject *obj, const char *str, GValue *value, GError **error);
+
+gboolean my_object_many_uppercase (MyObject *obj, const char * const *in, char ***out, GError **error);
+
+gboolean my_object_str_hash_len (MyObject *obj, GHashTable *table, guint *len, GError **error);
+
+gboolean my_object_get_hash (MyObject *obj, GHashTable **table, GError **error);
+
+gboolean my_object_increment_val (MyObject *obj, GError **error);
+
+gboolean my_object_get_val (MyObject *obj, guint *ret, GError **error);
+
+gboolean my_object_get_value (MyObject *obj, guint *ret, GError **error);
+
+gboolean my_object_emit_frobnicate (MyObject *obj, GError **error);
+
#include "test-service-glib-glue.h"
GQuark my_object_error_quark (void);
@@ -65,6 +90,15 @@
PROP_THIS_IS_A_STRING
};
+enum
+{
+ FROBNICATE,
+ LAST_SIGNAL
+};
+
+static void *parent_class;
+static guint signals[LAST_SIGNAL] = { 0 };
+
static void
my_object_finalize (GObject *object)
{
@@ -123,7 +157,7 @@
static void
my_object_init (MyObject *obj)
{
-
+ obj->val = 0;
}
static void
@@ -142,6 +176,15 @@
_("Example of a string property"),
"default value",
G_PARAM_READWRITE));
+ signals[FROBNICATE] =
+ g_signal_new ("frobnicate",
+ G_OBJECT_CLASS_TYPE (mobject_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__INT,
+ G_TYPE_NONE, 1, G_TYPE_INT);
+
}
GQuark
@@ -154,6 +197,9 @@
return quark;
}
+static GObject *obj;
+static GObject *obj2;
+
gboolean
my_object_do_nothing (MyObject *obj, GError **error)
{
@@ -161,7 +207,7 @@
}
gboolean
-my_object_increment (MyObject *obj, gint32 x, int *ret, GError **error)
+my_object_increment (MyObject *obj, gint32 x, gint32 *ret, GError **error)
{
*ret = x +1;
return TRUE;
@@ -191,7 +237,172 @@
*str_ret = g_ascii_strup (str, -1);
return TRUE;
}
-
+
+gboolean
+my_object_many_return (MyObject *obj, guint32 *arg0, char **arg1, gint32 *arg2, guint32 *arg3, guint32 *arg4, char **arg5, GError **error)
+{
+ *arg0 = 42;
+ *arg1 = g_strdup ("42");
+ *arg2 = -67;
+ *arg3 = 2;
+ *arg4 = 26;
+ *arg5 = g_strdup ("hello world");
+ return TRUE;
+}
+
+gboolean
+my_object_stringify (MyObject *obj, GValue *value, char **ret, GError **error)
+{
+ GValue valstr = {0, };
+
+ g_value_init (&valstr, G_TYPE_STRING);
+ if (!g_value_transform (value, &valstr))
+ {
+ g_set_error (error,
+ MY_OBJECT_ERROR,
+ MY_OBJECT_ERROR_FOO,
+ "couldn't transform value");
+ return FALSE;
+ }
+ *ret = g_value_dup_string (&valstr);
+ g_value_unset (&valstr);
+ return TRUE;
+}
+
+gboolean
+my_object_unstringify (MyObject *obj, const char *str, GValue *value, GError **error)
+{
+ if (str[0] == '\0' || !g_ascii_isdigit (str[0])) {
+ g_value_init (value, G_TYPE_STRING);
+ g_value_set_string (value, str);
+ } else {
+ g_value_init (value, G_TYPE_INT);
+ g_value_set_int (value, (int) g_ascii_strtoull (str, NULL, 10));
+ }
+ return TRUE;
+}
+
+gboolean
+my_object_recursive1 (MyObject *obj, GArray *array, guint32 *len_ret, GError **error)
+{
+ *len_ret = array->len;
+ return TRUE;
+}
+
+gboolean
+my_object_recursive2 (MyObject *obj, guint32 reqlen, GArray **ret, GError **error)
+{
+ guint32 val;
+ GArray *array;
+
+ array = g_array_new (FALSE, TRUE, sizeof (guint32));
+
+ while (reqlen > 0) {
+ val = 42;
+ g_array_append_val (array, val);
+ val = 26;
+ g_array_append_val (array, val);
+ reqlen--;
+ }
+ val = 2;
+ g_array_append_val (array, val);
+ *ret = array;
+ return TRUE;
+}
+
+gboolean
+my_object_many_uppercase (MyObject *obj, const char * const *in, char ***out, GError **error)
+{
+ int len;
+ int i;
+
+ len = g_strv_length ((char**) in);
+
+ *out = g_new0 (char *, len + 1);
+ for (i = 0; i < len; i++)
+ {
+ (*out)[i] = g_ascii_strup (in[i], -1);
+ }
+ (*out)[i] = NULL;
+
+ return TRUE;
+}
+
+gboolean
+my_object_objpath (MyObject *obj, GObject *incoming, GObject **outgoing, GError **error)
+{
+ if ((GObject*) obj != incoming)
+ {
+ g_set_error (error,
+ MY_OBJECT_ERROR,
+ MY_OBJECT_ERROR_FOO,
+ "invalid incoming object");
+ return FALSE;
+ }
+ *outgoing = g_object_ref (obj2);
+ return TRUE;
+}
+
+static void
+hash_foreach (gpointer key, gpointer val, gpointer user_data)
+{
+ const char *keystr = key;
+ const char *valstr = val;
+ guint *count = user_data;
+
+ *count += (strlen (keystr) + strlen (valstr));
+ g_print ("%s -> %s\n", keystr, valstr);
+}
+
+gboolean
+my_object_str_hash_len (MyObject *obj, GHashTable *table, guint *len, GError **error)
+{
+ *len = 0;
+ g_hash_table_foreach (table, hash_foreach, len);
+ return TRUE;
+}
+
+gboolean
+my_object_get_hash (MyObject *obj, GHashTable **ret, GError **error)
+{
+ GHashTable *table;
+
+ table = g_hash_table_new (g_str_hash, g_str_equal);
+ g_hash_table_insert (table, "foo", "bar");
+ g_hash_table_insert (table, "baz", "whee");
+ g_hash_table_insert (table, "cow", "crack");
+ *ret = table;
+ return TRUE;
+}
+
+gboolean
+my_object_increment_val (MyObject *obj, GError **error)
+{
+ obj->val++;
+ return TRUE;
+}
+
+gboolean
+my_object_get_val (MyObject *obj, guint *ret, GError **error)
+{
+ *ret = obj->val;
+ return TRUE;
+}
+
+gboolean
+my_object_get_value (MyObject *obj, guint *ret, GError **error)
+{
+ *ret = obj->val;
+ return TRUE;
+}
+
+gboolean
+my_object_emit_frobnicate (MyObject *obj, GError **error)
+{
+ g_signal_emit (obj, signals[FROBNICATE], 0, 42);
+ return TRUE;
+}
+
static GMainLoop *loop;
#define TEST_SERVICE_NAME "org.freedesktop.DBus.TestSuiteGLibService"
@@ -201,13 +412,15 @@
{
DBusGConnection *connection;
GError *error;
- GObject *obj;
DBusGProxy *driver_proxy;
guint32 request_name_ret;
g_type_init ();
g_printerr ("Launching test-service-glib\n");
+
+ g_log_set_always_fatal (G_LOG_LEVEL_CRITICAL);
+ g_log_set_always_fatal (G_LOG_LEVEL_WARNING);
loop = g_main_loop_new (NULL, FALSE);
@@ -223,12 +436,16 @@
}
obj = g_object_new (MY_TYPE_OBJECT, NULL);
+ obj2 = g_object_new (MY_TYPE_OBJECT, NULL);
- dbus_g_object_class_install_info (G_OBJECT_GET_CLASS (obj),
- &dbus_glib_my_object_object_info);
+ dbus_g_object_type_install_info (MY_TYPE_OBJECT,
+ &dbus_glib_my_object_object_info);
dbus_g_connection_register_g_object (connection,
"/org/freedesktop/DBus/Tests/MyTestObject",
obj);
+ dbus_g_connection_register_g_object (connection,
+ "/org/freedesktop/DBus/Tests/MyTestObject2",
+ obj2);
driver_proxy = dbus_g_proxy_new_for_name (connection,
DBUS_SERVICE_DBUS,
Index: test-dbus-glib.c
===================================================================
RCS file: /cvs/dbus/dbus/test/glib/test-dbus-glib.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- test-dbus-glib.c 9 Mar 2005 17:09:11 -0000 1.16
+++ test-dbus-glib.c 13 Jun 2005 03:01:19 -0000 1.17
@@ -6,9 +6,11 @@
#include "test-service-glib-bindings.h"
#include <glib/dbus-gidl.h>
#include <glib/dbus-gparser.h>
+#include <glib-object.h>
static GMainLoop *loop = NULL;
static int n_times_foo_received = 0;
+static int n_times_frobnicate_received = 0;
static gboolean
timed_exit (gpointer loop)
@@ -27,6 +29,18 @@
g_main_loop_quit (loop);
}
+static void
+frobnicate_signal_handler (DBusGProxy *proxy,
+ int val,
+ void *user_data)
+{
+ n_times_frobnicate_received += 1;
+
+ g_assert (val == 42);
+
+ g_main_loop_quit (loop);
+}
+
static void lose (const char *fmt, ...) G_GNUC_NORETURN G_GNUC_PRINTF (1, 2);
static void lose_gerror (const char *prefix, GError *error) G_GNUC_NORETURN;
@@ -60,8 +74,8 @@
DBusGProxy *proxy;
DBusGPendingCall *call;
char **name_list;
- int name_list_len;
- int i;
+ guint name_list_len;
+ guint i;
guint32 result;
const char *v_STRING;
char *v_STRING_2;
@@ -71,6 +85,8 @@
double v_DOUBLE_2;
g_type_init ();
+
+ g_log_set_always_fatal (G_LOG_LEVEL_WARNING);
loop = g_main_loop_new (NULL, FALSE);
@@ -94,17 +110,17 @@
/* Call ListNames method */
- call = dbus_g_proxy_begin_call (driver, "ListNames", DBUS_TYPE_INVALID);
+ call = dbus_g_proxy_begin_call (driver, "ListNames", G_TYPE_INVALID);
error = NULL;
if (!dbus_g_proxy_end_call (driver, call, &error,
- DBUS_TYPE_ARRAY, DBUS_TYPE_STRING,
- &name_list, &name_list_len,
- DBUS_TYPE_INVALID))
+ G_TYPE_STRV, &name_list,
+ G_TYPE_INVALID))
lose_gerror ("Failed to complete ListNames call", error);
g_print ("Names on the message bus:\n");
i = 0;
+ name_list_len = g_strv_length (name_list);
while (i < name_list_len)
{
g_assert (name_list[i] != NULL);
@@ -116,55 +132,49 @@
g_strfreev (name_list);
/* Test handling of unknown method */
- v_STRING = "blah blah blah blah blah";
- v_UINT32 = 10;
call = dbus_g_proxy_begin_call (driver, "ThisMethodDoesNotExist",
- DBUS_TYPE_STRING,
- &v_STRING,
- DBUS_TYPE_INT32,
- &v_UINT32,
- DBUS_TYPE_INVALID);
+ G_TYPE_STRING,
+ "blah blah blah blah blah",
+ G_TYPE_INT,
+ 10,
+ G_TYPE_INVALID);
error = NULL;
if (dbus_g_proxy_end_call (driver, call, &error,
- DBUS_TYPE_INVALID))
+ G_TYPE_INVALID))
lose ("Calling nonexistent method succeeded!");
g_print ("Got EXPECTED error from calling unknown method: %s\n", error->message);
g_error_free (error);
/* Activate a service */
- v_STRING = "org.freedesktop.DBus.TestSuiteEchoService";
- v_UINT32 = 0;
call = dbus_g_proxy_begin_call (driver, "StartServiceByName",
- DBUS_TYPE_STRING,
- &v_STRING,
- DBUS_TYPE_UINT32,
- &v_UINT32,
- DBUS_TYPE_INVALID);
+ G_TYPE_STRING,
+ "org.freedesktop.DBus.TestSuiteEchoService",
+ G_TYPE_UINT,
+ 0,
+ G_TYPE_INVALID);
error = NULL;
if (!dbus_g_proxy_end_call (driver, call, &error,
- DBUS_TYPE_UINT32, &result,
- DBUS_TYPE_INVALID))
+ G_TYPE_UINT, &result,
+ G_TYPE_INVALID))
lose_gerror ("Failed to complete Activate call", error);
g_print ("Starting echo service result = 0x%x\n", result);
/* Activate a service again */
- v_STRING = "org.freedesktop.DBus.TestSuiteEchoService";
- v_UINT32 = 0;
call = dbus_g_proxy_begin_call (driver, "StartServiceByName",
- DBUS_TYPE_STRING,
- &v_STRING,
- DBUS_TYPE_UINT32,
- &v_UINT32,
+ G_TYPE_STRING,
+ "org.freedesktop.DBus.TestSuiteEchoService",
+ G_TYPE_UINT,
+ 0,
DBUS_TYPE_INVALID);
error = NULL;
if (!dbus_g_proxy_end_call (driver, call, &error,
- DBUS_TYPE_UINT32, &result,
- DBUS_TYPE_INVALID))
+ G_TYPE_UINT, &result,
+ G_TYPE_INVALID))
lose_gerror ("Failed to complete Activate call", error);
g_print ("Duplicate start of echo service = 0x%x\n", result);
@@ -180,30 +190,30 @@
if (proxy == NULL)
lose_gerror ("Failed to create proxy for name owner", error);
- v_STRING = "my string hello";
call = dbus_g_proxy_begin_call (proxy, "Echo",
- DBUS_TYPE_STRING,
- &v_STRING,
- DBUS_TYPE_INVALID);
+ G_TYPE_STRING,
+ "my string hello",
+ G_TYPE_INVALID);
error = NULL;
if (!dbus_g_proxy_end_call (proxy, call, &error,
- DBUS_TYPE_STRING, &v_STRING,
- DBUS_TYPE_INVALID))
+ G_TYPE_STRING, &v_STRING_2,
+ G_TYPE_INVALID))
lose_gerror ("Failed to complete Echo call", error);
- g_print ("String echoed = \"%s\"\n", v_STRING);
+ g_print ("String echoed = \"%s\"\n", v_STRING_2);
+ g_free (v_STRING_2);
/* Test oneway call and signal handling */
- dbus_g_proxy_add_signal (proxy, "Foo", DBUS_TYPE_DOUBLE_AS_STRING);
+ dbus_g_proxy_add_signal (proxy, "Foo", G_TYPE_DOUBLE, G_TYPE_INVALID);
dbus_g_proxy_connect_signal (proxy, "Foo",
G_CALLBACK (foo_signal_handler),
NULL, NULL);
dbus_g_proxy_call_no_reply (proxy, "EmitFoo",
- DBUS_TYPE_INVALID);
+ G_TYPE_INVALID);
dbus_g_connection_flush (connection);
@@ -216,20 +226,22 @@
/* Activate test servie */
g_print ("Activating TestSuiteGLibService\n");
- v_STRING = "org.freedesktop.DBus.TestSuiteGLibService";
- v_UINT32 = 0;
- call = dbus_g_proxy_begin_call (driver, "StartServiceByName",
- DBUS_TYPE_STRING,
- &v_STRING,
- DBUS_TYPE_UINT32,
- &v_UINT32,
- DBUS_TYPE_INVALID);
-
error = NULL;
- if (!dbus_g_proxy_end_call (driver, call, &error,
- DBUS_TYPE_UINT32, &result,
- DBUS_TYPE_INVALID))
+ if (!dbus_g_proxy_invoke (driver, "StartServiceByName", &error,
+ G_TYPE_STRING,
+ "org.freedesktop.DBus.TestSuiteGLibService",
+ G_TYPE_UINT,
+ 0,
+ G_TYPE_INVALID,
+ G_TYPE_UINT, &result,
+ G_TYPE_INVALID)) {
lose_gerror ("Failed to complete Activate call", error);
+ }
+
+ g_print ("TestSuiteGLibService activated\n");
+
+ if (getenv ("DBUS_GLIB_TEST_SLEEP_AFTER_ACTIVATION"))
+ g_usleep (8 * G_USEC_PER_SEC);
g_object_unref (G_OBJECT (proxy));
@@ -242,63 +254,64 @@
if (proxy == NULL)
lose_gerror ("Failed to create proxy for name owner", error);
+ g_print ("Beginning method calls\n");
+
call = dbus_g_proxy_begin_call (proxy, "DoNothing",
- DBUS_TYPE_INVALID);
+ G_TYPE_INVALID);
error = NULL;
- if (!dbus_g_proxy_end_call (proxy, call, &error, DBUS_TYPE_INVALID))
+ if (!dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID))
lose_gerror ("Failed to complete DoNothing call", error);
- v_UINT32 = 42;
- call = dbus_g_proxy_begin_call (proxy, "Increment",
- DBUS_TYPE_UINT32, &v_UINT32,
- DBUS_TYPE_INVALID);
error = NULL;
- if (!dbus_g_proxy_end_call (proxy, call, &error,
- DBUS_TYPE_UINT32, &v_UINT32_2,
- DBUS_TYPE_INVALID))
+ if (!dbus_g_proxy_invoke (proxy, "Increment", &error,
+ G_TYPE_UINT, 42,
+ G_TYPE_INVALID,
+ G_TYPE_UINT, &v_UINT32_2,
+ G_TYPE_INVALID))
lose_gerror ("Failed to complete Increment call", error);
- if (v_UINT32_2 != v_UINT32 + 1)
+ if (v_UINT32_2 != 43)
lose ("Increment call returned %d, should be 43", v_UINT32_2);
- call = dbus_g_proxy_begin_call (proxy, "ThrowError", DBUS_TYPE_INVALID);
+ call = dbus_g_proxy_begin_call (proxy, "ThrowError", G_TYPE_INVALID);
error = NULL;
- if (dbus_g_proxy_end_call (proxy, call, &error, DBUS_TYPE_INVALID) != FALSE)
+ if (dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID) != FALSE)
lose ("ThrowError call unexpectedly succeeded!");
g_print ("ThrowError failed (as expected) returned error: %s\n", error->message);
g_clear_error (&error);
- v_STRING = "foobar";
call = dbus_g_proxy_begin_call (proxy, "Uppercase",
- DBUS_TYPE_STRING, &v_STRING,
- DBUS_TYPE_INVALID);
+ G_TYPE_STRING, "foobar",
+ G_TYPE_INVALID);
error = NULL;
if (!dbus_g_proxy_end_call (proxy, call, &error,
- DBUS_TYPE_STRING, &v_STRING_2,
- DBUS_TYPE_INVALID))
+ G_TYPE_STRING, &v_STRING_2,
+ G_TYPE_INVALID))
lose_gerror ("Failed to complete Uppercase call", error);
if (strcmp ("FOOBAR", v_STRING_2) != 0)
lose ("Uppercase call returned unexpected string %s", v_STRING_2);
+ g_free (v_STRING_2);
v_STRING = "bazwhee";
v_UINT32 = 26;
v_DOUBLE = G_PI;
call = dbus_g_proxy_begin_call (proxy, "ManyArgs",
- DBUS_TYPE_UINT32, &v_UINT32,
- DBUS_TYPE_STRING, &v_STRING,
- DBUS_TYPE_DOUBLE, &v_DOUBLE,
- DBUS_TYPE_INVALID);
+ G_TYPE_UINT, 26,
+ G_TYPE_STRING, "bazwhee",
+ G_TYPE_DOUBLE, G_PI,
+ G_TYPE_INVALID);
error = NULL;
if (!dbus_g_proxy_end_call (proxy, call, &error,
- DBUS_TYPE_DOUBLE, &v_DOUBLE_2,
- DBUS_TYPE_STRING, &v_STRING_2,
- DBUS_TYPE_INVALID))
+ G_TYPE_DOUBLE, &v_DOUBLE_2,
+ G_TYPE_STRING, &v_STRING_2,
+ G_TYPE_INVALID))
lose_gerror ("Failed to complete ManyArgs call", error);
if (v_DOUBLE_2 < 55 || v_DOUBLE_2 > 56)
lose ("ManyArgs call returned unexpected double value %f", v_DOUBLE_2);
if (strcmp ("BAZWHEE", v_STRING_2) != 0)
lose ("ManyArgs call returned unexpected string %s", v_STRING_2);
+ g_free (v_STRING_2);
if (!org_freedesktop_DBus_Tests_MyObject_do_nothing (proxy, &error))
lose_gerror ("Failed to complete (wrapped) DoNothing call", error);
@@ -333,6 +346,313 @@
lose ("(wrapped) ManyArgs call returned unexpected string %s", v_STRING_2);
g_free (v_STRING_2);
+ {
+ guint32 arg0;
+ char *arg1;
+ gint32 arg2;
+ guint32 arg3;
+ guint32 arg4;
+ char *arg5;
+
+ if (!org_freedesktop_DBus_Tests_MyObject_many_return (proxy, &arg0, &arg1, &arg2, &arg3, &arg4, &arg5, &error))
+ lose_gerror ("Failed to complete (wrapped) ManyReturn call", error);
+
+ if (arg0 != 42)
+ lose ("(wrapped) ManyReturn call returned unexpected guint32 value %u", arg0);
+
+ if (strcmp ("42", arg1) != 0)
+ lose ("(wrapped) ManyReturn call returned unexpected string %s", arg1);
+ g_free (arg1);
+
+ if (arg2 != -67)
+ lose ("(wrapped) ManyReturn call returned unexpected gint32 value %u", arg2);
+
+ if (arg3 != 2)
+ lose ("(wrapped) ManyReturn call returned unexpected guint32 value %u", arg3);
+
+ if (arg4 != 26)
+ lose ("(wrapped) ManyReturn call returned unexpected guint32 value %u", arg4);
+
+ if (strcmp ("hello world", arg5))
+ lose ("(wrapped) ManyReturn call returned unexpected string %s", arg5);
+ g_free (arg5);
+ }
+
+ {
+ GValue value = {0, };
+
+ g_value_init (&value, G_TYPE_STRING);
+ g_value_set_string (&value, "foo");
+
+ if (!org_freedesktop_DBus_Tests_MyObject_stringify (proxy,
+ &value,
+ &v_STRING_2,
+ &error))
+ lose_gerror ("Failed to complete (wrapped) stringify call", error);
+ if (strcmp ("foo", v_STRING_2) != 0)
+ lose ("(wrapped) stringify call returned unexpected string %s", v_STRING_2);
+ g_free (v_STRING_2);
+
+ g_value_unset (&value);
+ g_value_init (&value, G_TYPE_INT);
+ g_value_set_int (&value, 42);
+
+ if (!org_freedesktop_DBus_Tests_MyObject_stringify (proxy,
+ &value,
+ &v_STRING_2,
+ &error))
+ lose_gerror ("Failed to complete (wrapped) stringify call 2", error);
+ if (strcmp ("42", v_STRING_2) != 0)
+ lose ("(wrapped) stringify call 2 returned unexpected string %s", v_STRING_2);
+ g_value_unset (&value);
+ g_free (v_STRING_2);
+
+ g_value_init (&value, G_TYPE_INT);
+ g_value_set_int (&value, 88);
+ if (!org_freedesktop_DBus_Tests_MyObject_stringify (proxy,
+ &value,
+ NULL,
+ &error))
+ lose_gerror ("Failed to complete (wrapped) stringify call 3", error);
+ g_value_unset (&value);
+
+ if (!org_freedesktop_DBus_Tests_MyObject_unstringify (proxy,
+ "foo",
+ &value,
+ &error))
+ lose_gerror ("Failed to complete (wrapped) unstringify call", error);
+ if (!G_VALUE_HOLDS_STRING (&value))
+ lose ("(wrapped) unstringify call returned unexpected value type %d", (int) G_VALUE_TYPE (&value));
+ if (strcmp (g_value_get_string (&value), "foo"))
+ lose ("(wrapped) unstringify call returned unexpected string %s",
+ g_value_get_string (&value));
+
+ g_value_unset (&value);
+
+ if (!org_freedesktop_DBus_Tests_MyObject_unstringify (proxy,
+ "10",
+ &value,
+ &error))
+ lose_gerror ("Failed to complete (wrapped) unstringify call", error);
+ if (!G_VALUE_HOLDS_INT (&value))
+ lose ("(wrapped) unstringify call returned unexpected value type %d", (int) G_VALUE_TYPE (&value));
+ if (g_value_get_int (&value) != 10)
+ lose ("(wrapped) unstringify call returned unexpected integer %d",
+ g_value_get_int (&value));
+
+ g_value_unset (&value);
+ }
+
+ {
+ GArray *array;
+ guint32 val;
+ guint32 arraylen;
+
+ array = g_array_new (FALSE, TRUE, sizeof (guint32));
+ val = 42;
+ g_array_append_val (array, val);
+ val = 69;
+ g_array_append_val (array, val);
+ val = 88;
+ g_array_append_val (array, val);
+ val = 26;
+ g_array_append_val (array, val);
+ val = 2;
+ g_array_append_val (array, val);
+
+ arraylen = 0;
+ if (!org_freedesktop_DBus_Tests_MyObject_recursive1 (proxy, array,
+ &arraylen, &error))
+ lose_gerror ("Failed to complete (wrapped) recursive1 call", error);
+ if (arraylen != 5)
+ lose ("(wrapped) recursive1 call returned invalid length %u", arraylen);
+ }
+
+ {
+ GArray *array = NULL;
+ guint32 *arrayvals;
+
+ if (!org_freedesktop_DBus_Tests_MyObject_recursive2 (proxy, 2, &array, &error))
+ lose_gerror ("Failed to complete (wrapped) Recursive2 call", error);
+
+ if (array == NULL)
+ lose ("(wrapped) Recursive2 call returned NULL");
+ if (array->len != 5)
+ lose ("(wrapped) Recursive2 call returned unexpected array length %u", array->len);
+
+ arrayvals = (guint32*) array->data;
+ if (arrayvals[0] != 42)
+ lose ("(wrapped) Recursive2 call returned unexpected value %d in position 0", arrayvals[0]);
+ if (arrayvals[1] != 26)
+ lose ("(wrapped) Recursive2 call returned unexpected value %d in position 1", arrayvals[1]);
+ if (arrayvals[4] != 2)
+ lose ("(wrapped) Recursive2 call returned unexpected value %d in position 4", arrayvals[4]);
+
+ g_array_free (array, TRUE);
+ }
+
+ {
+ char **strs;
+ char **strs_ret;
+
+ strs = g_new0 (char *, 4);
+ strs[0] = "hello";
+ strs[1] = "HellO";
+ strs[2] = "HELLO";
+ strs[3] = NULL;
+
+ strs_ret = NULL;
+ if (!org_freedesktop_DBus_Tests_MyObject_many_uppercase (proxy, strs, &strs_ret, &error))
+ lose_gerror ("Failed to complete (wrapped) ManyUppercase call", error);
+ g_assert (strs_ret != NULL);
+ if (strcmp ("HELLO", strs_ret[0]) != 0)
+ lose ("(wrapped) ManyUppercase call returned unexpected string %s", strs_ret[0]);
+ if (strcmp ("HELLO", strs_ret[1]) != 0)
+ lose ("(wrapped) ManyUppercase call returned unexpected string %s", strs_ret[1]);
+ if (strcmp ("HELLO", strs_ret[2]) != 0)
+ lose ("(wrapped) ManyUppercase call returned unexpected string %s", strs_ret[2]);
+
+ g_strfreev (strs_ret);
+ }
+
+ {
+ GHashTable *table;
+ guint len;
+
+ table = g_hash_table_new (g_str_hash, g_str_equal);
+ g_hash_table_insert (table, "moooo", "b");
+ g_hash_table_insert (table, "xxx", "cow!");
+
+ len = 0;
+ if (!org_freedesktop_DBus_Tests_MyObject_str_hash_len (proxy, table, &len, &error))
+ lose_gerror ("(wrapped) StrHashLen call failed", error);
+ if (len != 13)
+ lose ("(wrapped) StrHashLen returned unexpected length %u", len);
+ g_hash_table_destroy (table);
+ }
+
+ {
+ GHashTable *table;
+ const char *val;
+
+ if (!org_freedesktop_DBus_Tests_MyObject_get_hash (proxy, &table, &error))
+ lose_gerror ("(wrapped) GetHash call failed", error);
+ val = g_hash_table_lookup (table, "foo");
+ if (val == NULL || strcmp ("bar", val))
+ lose ("(wrapped) StrHashLen returned invalid value %s for key \"foo\"",
+ val ? val : "(null)");
+ val = g_hash_table_lookup (table, "baz");
+ if (val == NULL || strcmp ("whee", val))
+ lose ("(wrapped) StrHashLen returned invalid value %s for key \"whee\"",
+ val ? val : "(null)");
+ val = g_hash_table_lookup (table, "cow");
+ if (val == NULL || strcmp ("crack", val))
+ lose ("(wrapped) StrHashLen returned invalid value %s for key \"cow\"",
+ val ? val : "(null)");
+ if (g_hash_table_size (table) != 3)
+ lose ("(wrapped) StrHashLen returned unexpected hash size %u",
+ g_hash_table_size (table));
+
+ g_hash_table_destroy (table);
+ }
+
+ {
+ guint val;
+ DBusGProxy *ret_proxy;
+
+ if (!org_freedesktop_DBus_Tests_MyObject_objpath (proxy, proxy, &ret_proxy, &error))
+ lose_gerror ("Failed to complete (wrapped) Objpath call", error);
+ if (strcmp ("/org/freedesktop/DBus/Tests/MyTestObject2",
+ dbus_g_proxy_get_path (ret_proxy)) != 0)
+ lose ("(wrapped) objpath call returned unexpected proxy %s",
+ dbus_g_proxy_get_path (ret_proxy));
+
+ val = 1;
+ if (!org_freedesktop_DBus_Tests_MyObject_get_val (ret_proxy, &val, &error))
+ lose_gerror ("Failed to complete (wrapped) GetVal call", error);
+ if (val != 0)
+ lose ("(wrapped) GetVal returned invalid value %d", val);
+
+ if (!org_freedesktop_DBus_Tests_MyObject_increment_val (ret_proxy, &error))
+ lose_gerror ("Failed to complete (wrapped) IncrementVal call", error);
+
+ if (!org_freedesktop_DBus_Tests_MyObject_increment_val (ret_proxy, &error))
+ lose_gerror ("Failed to complete (wrapped) IncrementVal call", error);
+
+ if (!org_freedesktop_DBus_Tests_MyObject_increment_val (ret_proxy, &error))
+ lose_gerror ("Failed to complete (wrapped) IncrementVal call", error);
+
+ if (!org_freedesktop_DBus_Tests_MyObject_get_val (ret_proxy, &val, &error))
+ lose_gerror ("Failed to complete (wrapped) GetVal call", error);
+ if (val != 3)
+ lose ("(wrapped) GetVal returned invalid value %d", val);
+
+ if (!org_freedesktop_DBus_Tests_MyObject_get_val (proxy, &val, &error))
+ lose_gerror ("Failed to complete (wrapped) GetVal call", error);
+ if (val != 0)
+ lose ("(wrapped) GetVal returned invalid value %d", val);
+
+ if (!org_freedesktop_DBus_Tests_MyObject_increment_val (proxy, &error))
+ lose_gerror ("Failed to complete (wrapped) IncrementVal call", error);
+
+ if (!org_freedesktop_DBus_Tests_MyObject_get_val (proxy, &val, &error))
+ lose_gerror ("Failed to complete (wrapped) GetVal call", error);
+ if (val != 1)
+ lose ("(wrapped) GetVal returned invalid value %d", val);
+
+ if (!org_freedesktop_DBus_Tests_MyObject_get_val (ret_proxy, &val, &error))
+ lose_gerror ("Failed to complete (wrapped) GetVal call", error);
+ if (val != 3)
+ lose ("(wrapped) GetVal returned invalid value %d", val);
+
+ g_object_unref (G_OBJECT (ret_proxy));
+
+ ret_proxy = NULL;
+ if (!org_freedesktop_DBus_Tests_MyObject_objpath (proxy, proxy, &ret_proxy, &error))
+ lose_gerror ("Failed to complete (wrapped) Objpath call 2", error);
+ if (strcmp ("/org/freedesktop/DBus/Tests/MyTestObject2",
+ dbus_g_proxy_get_path (ret_proxy)) != 0)
+ lose ("(wrapped) objpath call 2 returned unexpected proxy %s",
+ dbus_g_proxy_get_path (ret_proxy));
+ {
+ const char *iface = dbus_g_proxy_get_interface (ret_proxy);
+ g_print ("returned proxy has interface \"%s\"\n",
+ iface ? iface : "(NULL)");
+ }
+
+ dbus_g_proxy_set_interface (ret_proxy, "org.freedesktop.DBus.Tests.FooObject");
+
+ val = 0;
+ if (!org_freedesktop_DBus_Tests_FooObject_get_value (ret_proxy, &val, &error))
+ lose_gerror ("Failed to complete (wrapped) GetValue call", error);
+ if (val != 3)
+ lose ("(wrapped) GetValue returned invalid value %d", val);
+ }
+
+ /* Signal handling tests */
+
+ dbus_g_proxy_add_signal (proxy, "Frobnicate", G_TYPE_INT, G_TYPE_INVALID);
+
+ dbus_g_proxy_connect_signal (proxy, "Frobnicate",
+ G_CALLBACK (frobnicate_signal_handler),
+ NULL, NULL);
+
+ if (!dbus_g_proxy_invoke (proxy, "EmitFrobnicate", &error,
+ G_TYPE_INVALID, G_TYPE_INVALID))
+ lose_gerror ("Failed to complete EmitFrobnicate call", error);
+
+
+ dbus_g_connection_flush (connection);
+
+#if 0
+ g_timeout_add (5000, timed_exit, loop);
+
+ g_main_loop_run (loop);
+
+ if (n_times_frobnicate_received != 1)
+ lose ("Frobnicate signal received %d times, should have been 1", n_times_frobnicate_received);
+#endif
+
g_object_unref (G_OBJECT (proxy));
proxy = dbus_g_proxy_new_for_name_owner (connection,
@@ -345,11 +665,11 @@
lose_gerror ("Failed to create proxy for name owner", error);
call = dbus_g_proxy_begin_call (proxy, "Introspect",
- DBUS_TYPE_INVALID);
+ G_TYPE_INVALID);
error = NULL;
if (!dbus_g_proxy_end_call (proxy, call, &error,
- DBUS_TYPE_STRING, &v_STRING,
- DBUS_TYPE_INVALID))
+ G_TYPE_STRING, &v_STRING_2,
+ G_TYPE_INVALID))
lose_gerror ("Failed to complete Introspect call", error);
/* Could just do strcmp(), but that seems more fragile */
@@ -359,9 +679,10 @@
gboolean found_introspectable;
gboolean found_properties;
gboolean found_myobject;
+ gboolean found_fooobject;
gboolean found_gtk_myobject;
- node = description_load_from_string (v_STRING, strlen (v_STRING), &error);
+ node = description_load_from_string (v_STRING_2, strlen (v_STRING_2), &error);
if (!node)
lose_gerror ("Failed to parse introspection data: %s", error);
@@ -369,6 +690,7 @@
found_properties = FALSE;
found_gtk_myobject = FALSE;
found_myobject = FALSE;
+ found_fooobject = FALSE;
for (elt = node_info_get_interfaces (node); elt ; elt = elt->next)
{
InterfaceInfo *iface = elt->data;
@@ -377,7 +699,7 @@
found_introspectable = TRUE;
else if (!found_properties && strcmp (interface_info_get_name (iface), "org.freedesktop.DBus.Properties") == 0)
found_properties = TRUE;
- else if (!found_gtk_myobject && strcmp (interface_info_get_name (iface), "org.gtk.objects.MyObject") == 0)
+ else if (strcmp (interface_info_get_name (iface), "org.gtk.objects.MyObject") == 0)
found_gtk_myobject = TRUE;
else if (!found_myobject && strcmp (interface_info_get_name (iface), "org.freedesktop.DBus.Tests.MyObject") == 0)
{
@@ -401,6 +723,8 @@
if (!found_manyargs)
lose ("Missing method org.freedesktop.DBus.Tests.MyObject.ManyArgs");
}
+ else if (!found_fooobject && strcmp (interface_info_get_name (iface), "org.freedesktop.DBus.Tests.FooObject") == 0)
+ found_fooobject = TRUE;
else
lose ("Unexpected or duplicate interface %s", interface_info_get_name (iface));
}
@@ -408,6 +732,7 @@
if (!(found_introspectable && found_gtk_myobject && found_myobject && found_properties))
lose ("Missing interface");
}
+ g_free (v_STRING_2);
g_object_unref (G_OBJECT (driver));
Index: Makefile.am
===================================================================
RCS file: /cvs/dbus/dbus/test/glib/Makefile.am,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- Makefile.am 9 Mar 2005 17:09:11 -0000 1.11
+++ Makefile.am 13 Jun 2005 03:01:20 -0000 1.12
@@ -1,4 +1,4 @@
-INCLUDES=-I$(top_srcdir) $(DBUS_CLIENT_CFLAGS) $(DBUS_GLIB_CFLAGS)
+INCLUDES=-I$(top_srcdir) $(DBUS_CLIENT_CFLAGS) $(DBUS_GLIB_CFLAGS) -DDBUS_COMPILATION
## note that TESTS has special meaning (stuff to use in make check)
## so if adding tests not to be run in make check, don't add them to
@@ -45,10 +45,10 @@
BUILT_SOURCES = test-service-glib-glue.h test-service-glib-bindings.h
test-service-glib-glue.h: test-service-glib.xml $(top_builddir)/glib/dbus-binding-tool
- $(top_builddir)/glib/dbus-binding-tool --mode=glib-server --output=test-service-glib-glue.h test-service-glib.xml
+ $(top_builddir)/glib/dbus-binding-tool --prefix=my_object --mode=glib-server --output=test-service-glib-glue.h test-service-glib.xml
test-service-glib-bindings.h: test-service-glib.xml $(top_builddir)/glib/dbus-binding-tool
- $(top_builddir)/glib/dbus-binding-tool --mode=glib-client --output=test-service-glib-bindings.h test-service-glib.xml
+ $(top_builddir)/glib/dbus-binding-tool --prefix=my_object --mode=glib-client --output=test-service-glib-bindings.h test-service-glib.xml
CLEANFILES = test-service-glib-glue.h test-service-glib-bindings.h
- Previous message: dbus/tools print-introspect.c, 1.1, 1.2 dbus-viewer.c, 1.12,
1.13 dbus-names-model.c, 1.5, 1.6 Makefile.am, 1.14, 1.15
- Next message: dbus/python Makefile.am,1.12,1.13
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dbus-commit
mailing list