summaryrefslogtreecommitdiffstats
path: root/glib/examples
Commit message (Collapse)AuthorAgeFilesLines
* * glib/Makefile.am: Add make-dbus-glib-error-switch.sh to EXTRA_DISTJohn (J5) Palmieri2005-07-152-1/+3
| | | | | | | | | | | | | so distcheck doesn't fail * glib/examples/Makefile.am: Add example-service.xml and example-signal-emitter.xml to EXTRA_DIST so distcheck doesn't fail * glib/examples/statemachine/Makefile.am: Add statemachine.xml and statemachine-server.xml to EXTRA_DIST so distcheck doesn't fail * python/Makefile.am: Preprend $(srcdir)/ to source files so the compiler looks in the right places during distcheck
* * glib/example/Makefile.am: Fix a typo which cause make distcheckJohn (J5) Palmieri2005-07-151-1/+1
| | | | to fail
* 2005-07-12 Colin Walters <walters@verbum.org>Colin Walters2005-07-122-4/+4
| | | | | | | | | | * glib/examples/statemachine/Makefile.am (statemachine-server-glue.h) (statemachine-glue.h): * glib/examples/Makefile.am (example-service-glue.h) (example-signal-emitter-glue.h): * glib/Makefile.am (dbus-glib-error-switch.h): Add libtool --mode=execute so we use the built library instead of any installed one.
* 2005-07-11 Colin Walters <walters@verbum.org>Colin Walters2005-07-112-12/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * glib/dbus-gvalue.c (struct _DBusGValue): Delete. (dbus_g_value_types_init): Remove assertion. (dbus_g_value_get_g_type, dbus_g_value_open) (dbus_g_value_iterator_get_values, dbus_g_value_get_signature) (dbus_g_value_copy, dbus_g_value_free): Delete unimplemented functions related to DBusGValue. Now we marshal/demarshal structures as GValueArray. (dbus_gtype_from_signature_iter): Return G_TYPE_VALUE_ARRAY for structures. (signature_iter_to_g_type_array): Don't call signature_iter_to_g_type_struct. (signature_iter_to_g_type_struct): Delete. (dbus_gvalue_to_signature): Delete. (dbus_gvalue_to_signature): New function with same name as other one; we can convert structures to signatures. (demarshal_valuearray): New function. (get_type_demarshaller): Use it. (demarshal_recurse): Delete. (marshal_proxy): New function. (marshal_map): Warn if we can't determine signature from type. (marshal_collection_ptrarray): Ditto. (marshal_collection_array): Ditto. (get_type_marshaller): Use marshal_valuearray. (marshal_recurse): Delete. (_dbus_gvalue_test): Add some tests. * dbus/dbus-glib.h (struct _DBusGValueIterator): (dbus_g_value_get_g_type, DBUS_TYPE_G_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): Remove prototypes. * glib/dbus-binding-tool-glib.c (dbus_g_type_get_lookup_function): Handle G_TYPE_VALUE_ARRAY. * glib/examples/example-service.c: * glib/examples/example-client.c: Implement GetTuple. * test/glib/test-dbus-glib.c: * test/glib/test-service-glib.c: * test/glib/test-service-glib.xml: Add structure tests.
* 2005-07-10 Colin Walters <walters@verbum.org>Colin Walters2005-07-101-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * doc/TODO: Knock off some GLib items with this patch. * glib/dbus-gvalue-utils.c (_dbus_gtype_can_signal_error) (_dbus_gvalue_signals_error): New functions. * glib/dbus-gvalue-utils.h: Prototype them. * glib/dbus-gobject.c (arg_iterate): Update to handle return vals and change to not output const/retval flags for input args. All callers updated. (invoke_object_method): Refactor to handle return values. Add some more comments in various places. Remove debug g_print. * glib/dbus-binding-tool-glib.h (DBUS_GLIB_ANNOTATION_RETURNVAL): New. * glib/dbus-binding-tool-glib.c (dbus_g_type_get_marshal_name): Handle G_TYPE_NONE. (compute_gsignature): New function; refactored from code from compute_marshaller and compute_marshaller_name. Enhance to handle return values and async ops more cleanly. Update for async ops returning NONE instead of BOOLEAN. (compute_marshaller, compute_marshaller_name): Call compute_gsignature and output appropriate string. (generate_glue): Handle return value annotation. Also don't dump constness flag for input arguments. * glib/Makefile.am (DBUS_GLIB_INTERNALS): New variable; contains files shared between installed library and utilities. (libdbus_glib_1_la_SOURCES): Move some stuf into DBUS_GLIB_INTERNALS. (libdbus_gtool_la_SOURCES): Suck in DBUS_GLIB_INTERNALS so the binding tool can access gtype utility functions. * test/glib/test-service-glib.c: * test/glib/test-service-glib.xml: * test/glib/test-dbus-glib.c: Add some tests for return values.
* 2005-07-08 Colin Walters <walters@verbum.org>Colin Walters2005-07-093-56/+207
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * test/glib/test-service-glib.xml: * test/glib/test-service-glib.c: * test/glib/test-dbus-glib.c: Test a{sv}. * glib/examples/statemachine/statemachine.c: * glib/examples/statemachine/statemachine-server.c: * glib/examples/statemachine/statemachine-client.c: Fix some bugs, add progress bar, etc. * glib/dbus-gvalue.c (register_array, register_dict): Delete; not needed anymore due to generic array/map marshalling. (dbus_g_value_types_init): Don't register basic arrays or the string/string hash. (dbus_gtype_from_signature_iter): Don't try to recurse into variants. (dbus_gtype_to_signature): Check collection/map before type metadata. (demarshal_garray_basic): Renamed to demarshal_collection_array. (demarshal_ghashtable): Renamed to demarshal_map; fix to use new generic map creation/append functions instead of hash table specifically. (get_type_demarshaller): Handle maps. (demarshal_collection): Dispatch on collection type to either demarshal_collection_ptrarray or demarshal_collection_array. (get_type_marshaller): Handle maps. (marshal_collection): Dispatch collection type to either marshal_collection_ptrarray or marshal_collection_array. (_dbus_gvalue_test): New test. * glib/dbus-gvalue-utils.c (unset_and_free_g_value): New function. (hash_free_from_gtype): Use it to free GValues. (hashtable_append): New function. (ptrarray_append): Fix prototype. (slist_append): Ditto. (_dbus_gvalue_utils_test): Extend tests. * glib/dbus-gtype-specialized.c (dbus_g_type_specialized_init_append): Renamed from dbus_g_type_specialized_collection_init_append. Remove const from value, since we steal it. (dbus_g_type_specialized_map_append): New function. * glib/dbus-gtype-specialized.h: Update prototypes. Add DBusGTypeSpecializedMapAppendFunc. * glib/dbus-gtest.c (dbus_glib_internal_do_not_use_run_tests): Run _dbus_gvalue_test. * glib/dbus-gtest.h: Prototype it.
* 2005-07-08 Colin Walters <walters@verbum.org>Colin Walters2005-07-0813-4/+1311
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* 2005-06-29 Colin Walters <walters@verbum.org>Colin Walters2005-06-291-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * glib/dbus-gproxy.c (struct _DBusGProxy): Add new member name_call for keeping track of any outgoing GetNameOwner call. Also add for_owner and associated. (struct _DBusGProxyManager): Add owner_names, which is hash table that maps a base name to a list of names it owns (that we're interested in). Add pending_nameowner_calls which is a list of all outstanding GetNameOwner; avoids us having to iterate over every proxy. Add unassociated_proxies which keeps track of name proxies with no associated name owner. (dbus_g_proxy_manager_unref): Destroy owner_names. (struct DBusGProxyNameOwnerInfo): New struct for keeping track of name refcounts. (find_name_in_info, name_owner_foreach) (dbus_g_proxy_manager_lookup_name_owner, insert_nameinfo) (dbus_g_proxy_manager_monitor_name_owner) (dbus_g_proxy_manager_unmonitor_name_owner) (unassociate_proxies, dbus_g_proxy_manager_replace_name_owner): New functions; they manipulate the owner_names mapping. (got_name_owner_cb): New function. (get_name_owner): New function, extracted from dbus_g_proxy_new_for_name_owner. (dbus_g_proxy_manager_register): For now we need to keep track of all NameOwnerChanged. Also if the proxy is for a name, if we don't already know the name owner, queue a new GetNameOwner request and add it to our list of unassociated proxies. Otherwise inc the refcount. (dbus_g_proxy_manager_unregister): If this proxy is for a name, cancel any pending GetNameOwner call, etc. (dbus_g_proxy_manager_filter): Handle NameOwnerChanged. Also use the owner_names mapping to look up the current names for the signal source, and dispatch to any proxies for that name. (dbus_g_proxy_new): Initialize new members. (dbus_g_proxy_new_for_name): Delete unused proxy variable. (dbus_g_proxy_new_for_name_owner): Use get_name_owner. (dbus_g_pending_call_end_valist): New function, extracted from dbus_g_proxy_end_call_internal. Useful when we don't have a proxy but want to use the GLib infrastructure. Also note how many arguments in reply were over. (dbus_g_pending_call_end): New function, just call dbus_g_pending_call_end_valist. (dbus_g_proxy_end_call_internal): Just call dbus_g_pending_call_end_valist. * glib/dbus-gobject.c (_dbus_gobject_lookup_marshaller): Fix lookup of builtin marshaller for STRING_STRING_STRING. * test/glib/test-dbus-glib.c: * test/glib/test-service-glib.c: * test/glib/test-service-glib.xml: Extend tests to cover name proxies, destruction of owner proxies, etc. * glib/examples/example-signal-recipient.c (dbus_g_proxy_new_for_name_owner): Create a name proxy. * tools/dbus-send.c (main): Print D-BUS error name in addition to message.
* 2005-06-20 Colin Walters <walters@verbum.org>Colin Walters2005-06-218-0/+563
* configure.in: Add glib/examples. * glib/Makefile.am: Add examples/ * glib/examples/.cvsignore * glib/examples/Makefile.am * glib/examples/example-client.c * glib/examples/example-service.c * glib/examples/example-service.xml * glib/examples/example-signal-emitter.c * glib/examples/example-signal-emitter.xml * glib/examples/example-signal-recipient.c: New files; GLib binding examples, ported from python/examples.