Commit graph

825 commits

Author SHA1 Message Date
Ralf Habacker
de9038c984 * bus/activation.c: win32 compile fix.
* test/test-segfault.c: win32 compile fix, rlimit isn't available on win32.
* dbus-win.patch: removed some more patches, they are applied or obsolate
2007-03-07 18:34:01 +00:00
Ralf Habacker
329f99a197 * dbus/dbus-spawn.c,dbus/dbus-spawn.h (_dbus_spawn_async_with_babysitter):
added environment pointer as function parameter,used on win32.

* test/spawn-test.c: fixed call to above mentioned function.
2007-03-04 19:14:04 +00:00
Ralf Habacker
7f3af4748f * configure.in,test/test-sleep-forever.c,test/test-names.c:
added configure check for unistd.h.
2007-03-04 19:00:40 +00:00
Ralf Habacker
4d56811851 * test/Makefile.am: fixed test data copy problem in
out of source build, when sources came from svn or cvs.
2007-03-04 18:53:29 +00:00
John (J5) Palmieri
2d760baace * dbus/dbus-threads.h: fix DBUS_THREAD_FUNCTIONS_ALL_MASK to have
the correct value so we don't assert when initalizing recursive threads

* test/name-test/test-thread-init.c: call dbus_threads_init_default
  instead of _dbus_threads_init_debug since it is more of a real world
  test
2006-11-14 18:56:43 +00:00
John (J5) Palmieri
5640f7a57b * configure.in: expose DBUS_DATADIR
* bus/config-parser.c: add the standard_session_servicedirs element
  to the parser
  (bus_config_parser_content): process the standard_session_servicedirs
  element by getting the standard directories from sysdeps and merging
  them into the service directory list
  (test_default_session_servicedirs): make sure we get what we expect

* bus/session.conf.in: replace the servicedir tag with the
  standard_session_servicedirs tag

* dbus/dbus-list.h: remove the typedef of DBusList and place it in
  dbus-sysdeps.h to avoid circular header dependencies

* dbus/dbus-sysdeps.h: add the typedef of DBusList

* dbus/dbus-sysdeps-unix.c (split_paths_and_append): utility function
  which takes a string of directories delimited by colons, parses them
  out, appends a suffix and puts them in a list ignoring empty elements
  (_dbus_get_standard_session_servicedirs): returns the standard
  directories for a session bus to look for service activation files
  on Unix which includes the XDG_DATA_HOME, XDG_DATA_DIRS and
  DBUS_DATADIR directories

* test/data/valid-config-files/many-rules.conf: add the
  standard_session_servicedirs tag to the valid config file tests
2006-11-01 23:30:46 +00:00
John (J5) Palmieri
82c9cd05cd * configure.in, dbus-1.pc.in: Check to see if thread methods
are in glibc or libpthread and add -lpthread to the link stage
  if it is the latter
2006-10-26 18:06:07 +00:00
John (J5) Palmieri
2db06dbf18 * test/name-test/Makefile.am: don't link against both libdbus and
libdbus-convenience
2006-10-11 17:30:58 +00:00
Havoc Pennington
7020b57376 2006-10-01 Havoc Pennington <hp@redhat.com>
* test/test-service.c (path_message_func): remove broken extra
	unref that was hidden by the bugs in dbus-connection.c/dbus-bus.c

	* test/test-shell-service.c (path_message_func): same fix

	* dbus/dbus-connection.c
	(_dbus_connection_get_dispatch_status_unlocked): break up the
	function a little for clarity and fix the notification of
	dbus-bus.c to not require dispatch to be complete

	* dbus/dbus-connection.c (dbus_connection_unref): improve the
	warning when you try to finalize an open connection.
2006-10-01 17:21:03 +00:00
Havoc Pennington
a2129f7ccc 2006-10-01 Havoc Pennington <hp@redhat.com>
* dbus/dbus-connection.c (_dbus_connection_close_if_only_one_ref):
	Add a hack to make DBusNewConnectionFunction work right.

	* dbus/dbus-server-socket.c (handle_new_client_fd_and_unlock): use
	the hack here. Also, fix the todo about refcount leak.

	* dbus/dbus-server-debug-pipe.c (_dbus_transport_debug_pipe_new):
	and use the hack here

        * dbus/dbus-connection.c: Kill the "shared" flag vs. the
	"shareable" flag; this was completely broken, since it meant
	dbus_connection_open() returned a connection of unknown
	shared-ness. Now, we always hold a ref on anything opened
	as shareable.

	Move the call to notify dbus-bus.c into
	connection_forget_shared_unlocked, so libdbus consistently forgets
	all its knowledge of a connection at once. This exposed numerous
	places where things were totally broken if we dropped a ref inside
	get_dispatch_status_unlocked where
	connection_forget_shared_unlocked was previously, so move
	connection_forget_shared_unlocked into
	_dbus_connection_update_dispatch_status_and_unlock. Also move the
	exit_on_disconnect here.

	(shared_connections_shutdown): this assumed weak refs to the
	shared connections; since we have strong refs now, the assertion
	was failing and stuff was left in the hash. Fix it to close
	still-open shared connections.

	* bus/dispatch.c: fixup to use dbus_connection_open_private on the
	debug pipe connections

	* dbus/dbus-connection.c (dbus_connection_dispatch): only notify
	dbus-bus.c if the closed connection is in fact shared
	(_dbus_connection_close_possibly_shared): rename from
	_dbus_connection_close_internal
	(dbus_connection_close, dbus_connection_open,
	dbus_connection_open_private): Improve docs to explain the deal
	with when you should close or unref or both

	* dbus/dbus-bus.c
	(_dbus_bus_notify_shared_connection_disconnected_unlocked): rename
	from _dbus_bus_check_connection_and_unref_unlocked and modify to
	loop over all connections

	* test/test-utils.c (test_connection_shutdown): don't try to close
	shared connections.

	* test/name-test/test-threads-init.c (main): fix warnings in here

	* dbus/dbus-sysdeps.c (_dbus_abort): support DBUS_BLOCK_ON_ABORT
	env variable to cause blocking waiting for gdb; drop
	DBUS_PRINT_BACKTRACE and just call _dbus_print_backtrace()
	unconditionally.

	* configure.in: add -export-dynamic to libtool flags if assertions enabled
	so _dbus_print_backtrace works.

	* dbus/dbus-sysdeps-unix.c (_dbus_print_backtrace): use fprintf
	instead of _dbus_verbose to print the backtrace, and diagnose lack
	of -rdynamic/-export-dynamic
2006-10-01 15:36:19 +00:00
John (J5) Palmieri
1eae184450 * doc/TODO:
- Remove pending call locking todo item
- dbus_connection_open now holds hard ref.  Remove todo item
- do proper locking on _dbus_bus_check_connection_and_unref
  and handle DBUS_BUS_STARTER. Remove todo item
- Warn on closing of a shared connection.  Remove todo item

* bus/bus.c, bus/connection.c, bus/dispatch.c, dbus/dbus-bus.c,
  dbus/dbus-connection.c: Use the dbus_connection_close_internal
  so we don't get the warning when closing shared connections

* test/test-service.c, test/test-shell-service.c: Applications
  don't close shared connections themselves so we unref instead of
  close

* test/test-utils.c (test_connection_shutdown): Close the connection

* dbus/dbus-bus.c (_dbus_bus_check_connection_and_unref): Changed to
  _dbus_bus_check_connection_and_unref_unlocked since we only call this
  method on a locked connection.
  Make sure we call _dbus_connection_unref_unlocked instead of
  dbus_connection_unref also.
  Handle DBUS_BUS_STARTER correctly

* dbus/dbus-connection.c (connection_record_shared_unlocked):
  Mark as shared and hard ref the connection
  (connection_forget_shared_unlocked): Remove the hard ref from the
  connection
  (_dbus_connection_close_internal_and_unlock):  New internal function
  which takes a locked connection and unlocks it after closing it
  (_dbus_connection_close_internal): New internal function which acts
  like the origonal dbus_connection_close method by grabbing a connection
  lock and calling _dbus_connection_close_internal_and_unlock
  (dbus_connection_close): Public close method, warns when the app
  trys to close a shared connection
2006-09-06 22:00:07 +00:00
Havoc Pennington
afc2a6e56a 2006-08-29 Havoc Pennington <hp@redhat.com>
* test/test-service.c (path_message_func): fix lack of return value

	* dbus/dbus-sysdeps.c (_dbus_printf_string_upper_bound): fix
	formatting, remove #ifdef, and fix docs. #ifdef doesn't make
	any more sense than on anything else in this file.
	(_dbus_get_tmpdir): add const to return value, and keep the
	results of the various getenv around in a static variable.
2006-08-30 01:27:44 +00:00
John (J5) Palmieri
c904d4d501 * test/Makefile.am: change find to use syntax that works with non
gnu versions of find
2006-08-25 19:59:49 +00:00
John (J5) Palmieri
163f42a8b1 * configure.in, dbus/Makefile.am, test/name-test/run-test.sh,
test/name-test/Makefile.am: Fixed some issues with getting get dbus
  to build with builddir != srcdir (Taken from a patch by Bernard Leak
  <bernard at brenda-arkle dot demon dot co dot uk>)
2006-08-25 19:50:16 +00:00
John (J5) Palmieri
14cc7d28a8 * dbus/dbus-threads.c: Add static DBusList *uninitialized_mutex_list and
static DBusList *uninitialized_condvar_list to support new late
        initialization threading model.  In this model threads can be initialized
        even after the D-Bus API has been used but still needs to be initialized
        before the second thread has been started.  Mutexes and condvar addresses
        are stored in the two static lists and are replaced with actuall locks
        when threads are initalized.
        (_dbus_mutex_new_at_location): New method for creating a mutex and placing
        the location into the static list
        (_dbus_mutex_free_at_location): New method for removing a mutex location
        from the static list and freeing the mutex
        (_dbus_condvar_new_at_location): New method for creating a conditional
        variable and placing the location into the static list
        (_dbus_condvar_free_at_location): New method for removing a conditional
        variable location from the static list and freeing the conditional variable
        (init_uninitialized_locks): Atomic method which goes through the static
        lists of mutex and condvar location and updates them with actuall locks
        (init_global_locks): changed to init_locks

        * dbus/dbus-connection.c:
        (_dbus_connection_test_get_locks): New method for tests to check connections
        (_dbus_connection_new_for_transport): Use the new at_location mutex and
        condvar API
        (dbus_connection_allocate_data_slot): Pass in the global lock address
        to _dbus_data_slot_allocator_alloc

        * dbus/dbus-dataslot.c:
        (_dbus_data_slot_allocator_alloc): Use the address of the mutex
        instead of the mutex itself

        * dbus/dbus-message.c:
        (dbus_message_allocate_data_slot): Pass in the global lock address
        to _dbus_data_slot_allocator_alloc

        * dbus/dbus-pending-call.c:
        (dbus_pending_call_allocate_data_slot): Pass in the global lock address
        to _dbus_data_slot_allocator_alloc

        * dbus/dbus-server.c:
        (_dbus_server_init_base): Use the new at_location mutex API
        (dbus_server_allocate_data_slot): Pass in the global lock address
        to _dbus_data_slot_allocator_alloc

        * test/name-test/test-threads-init.c: New test case for late thread
        initialization
2006-08-16 22:30:15 +00:00
John (J5) Palmieri
c1091cbbd2 Patches by Kjartan Maraas <kmaraas at gnome dot org>
* bus/services.c (bus_service_list_queued_owners):
        Add a pointer cast to fix compiler warning

        * dbus/dbus-dataslot.c (_dbus_data_slot_list_get):
        return a NULL instead of FALSE since the return type
        is not expecting a boolean

        * dbus/dbus-marshal-basic.c (_dbus_marshal_test):
        Remove unused variable

        * dbus/dbus-marshal-recursive-util.c (node_new):
        return a NULL instead of FALSE since the return type
        is not expecting a boolean

        * dbus/dbus-server-debug-pipe.c (_dbus_transport_debug_pipe_new):
        Send a NULL into _dbus_transport_new_for_fd instead of a FALSE
        because we are expecting a pointer not a boolean

        * dbus/dbus-sysdeps-util.c (_dbus_get_tmpdir):
        add void as the parameter so some compilers
        don't complain

        * dbus/dbus-transport-unix.c (_dbus_transport_new_for_domain_socket,
          _dbus_transport_new_for_tcp_socket):
        Send a NULL into _dbus_transport_new_for_fd instead of a FALSE
        because we are expecting a pointer not a boolean

        * test/shell-test.c (test_command_line):
        cast the second argument to _dbus_list_append to avoid compiler
        warnings

        * test/test-names.c (main): remove unused variable

        * test/test-service.c (check_hello_from_self_reply):
        Initialize echo_message and echo_reply to NULL

        * test/test-shell-service.c (handle_echo):
        Remove unused variable and cast the third parameter passed to
        dbus_connection_get_object_path_data to avoid compiler warrnings

        * test/name-test/test-names.c (clear_message_queue):
        Remove unused function

        * test/name-test/test-pending-call-dispatch.c:
        Fix format string in printf
2006-08-14 19:11:35 +00:00
John (J5) Palmieri
2592a2abb2 * dbus/dbus-bus.c:
* test/name-test/test-names.c:
        Remove test method dbus_bus_connection_get_unique_name because
        we already have public method dbus_bus_get_unique_name that
        does the exact same thing
2006-08-14 18:12:20 +00:00
John (J5) Palmieri
47ec532cf2 * tools/run-with-tmp-session-bus.sh:
* test/name-test/run-test.sh:
  Remove bashisms (patch from Julio M. Merino Vidal
  <jmmv at NetBSD dot org>)
2006-08-10 21:44:00 +00:00
John (J5) Palmieri
2974c82428 * dbus/dbus-sysdeps.c:
* dbus/dbus-address.c:
* bus/activation.c:
* test/shell-test.c:
  don't hardcode tmp directory (patch from Dave Meikle
  <dmk at davemeikle dot co dot uk>)
2006-08-10 20:09:43 +00:00
John (J5) Palmieri
a929c9a3b4 * Remove all bindings 2006-07-14 16:20:12 +00:00
Thiago Macieira
fd5ac15ebc * test/qt/*: Update the testcases, including testing the new
functionality of sending null QByteArray and QString over the
        bus. Add new headertest test and restore the old
        qdbusxmlparser test.
2006-06-11 12:18:23 +00:00
Thiago Macieira
3ed273a6ed * test/qt/tst_hal.cpp: Remove the waiting, since it's not
needed anymore. Requires Qt 4.1.3 to work properly. (r528148)
2006-04-10 10:51:56 +00:00
Thiago Macieira
d54ababd5f * test/qt/*: Sync with KDE Subversion revision 523647.
Update the testcases to the new API. Remove testcases for
        classes that are no longer public or have been removed.
2006-03-28 18:58:58 +00:00
Thiago Macieira
12dc0934ae 2006-03-06 Thiago Macieira <thiago.macieira@trolltech.com>
* test/qt/*: Update the self-tests.
2006-03-06 14:30:52 +00:00
John (J5) Palmieri
da4182fb29 2006-03-02 John (J5) Palmieri <johnp@redhat.com>
* dbus/dbus-connection.c:
	(_dbus_connection_block_pending_call):
	Check to see if our data has already been read off the connection
	by another blocking pending call before we block in poll.
	(check_for_reply_and_update_dispatch_unlocked):
	Code taken from _dbus_connection_block_pending_call - checks for
	an already read reply and updates the dispatch if there is one.

	* test/name-test/test-pending-call-dispatch.c:
	New test for making sure we don't get stuck polling a
	dbus connection which has no data on the socket when
	blocking out of order on two or more pending calls.
2006-03-02 22:24:28 +00:00
Robert McQueen
0d0642b31b 2006-02-16 Robert McQueen <robot101@debian.org>
* dbus/dbus-message.c (dbus_message_iter_get_fixed_array):
	Patch from Rob Taylor <rob.taylor@collabora.co.uk> to correct a bogus
	assertion that the next element to read from the iter is fixed in
	size. This is not the case when you are at the end of the iter,
	because the next element type is INVALID.

	* dbus/dbus-string.c (_dbus_string_init_const_len): Correct a
	a bogus assert which means that you may not initialise a 0-length
	string unless you provide a non-NULL pointer. This prevented
	you from marshalling messages containing zero-length arrays in
	some cases.

	* glib/dbus-gvalue.c (demarshal_collection_array): Another patch
	from Rob to correct bogus asserts when trying to demarshal an
	array and get_fixed_array got you 0 elements. Append nothing to
	the GArray in this case.

	* test/glib/test-dbus-glib.c: Add a test case for round-tripping
	an empty array via the glib bindings. Without all of the above
	patches, this new test fails.
2006-02-16 00:43:41 +00:00
Thiago Macieira
9076938fc0 Add new tests and update the existing one. 2006-02-15 17:06:41 +00:00
Robert McQueen
8e00b10d13 2006-01-27 Robert McQueen <robot101@debian.org>
* glib/dbus-gtype-specialized.[ch], glib/dbus-gvalue-utils.c: Patch
	by me and Rob Taylor to add a simple_free function to D-Bus map
	and collection types, which allows those types which can be freed
	with a GDestroyNotify (such as GHashTables and GArrays, but not
	GPtrArrays) to be stored as the values in hashtables.

	* test/glib/test-dbus-glib.c, test/glib/test-service-glib.{c,xml}:
	Patch by Rob Taylor to add nested dicts to the glib tests to check
	the above code works, and appears not to leak when called repeatedly.
2006-01-27 15:40:36 +00:00
Harald Fernengel
e447b1f2be convert to QTestLib 4.1 2006-01-22 19:42:18 +00:00
John (J5) Palmieri
b99a1f3645 * test/qt/Makefile.am: build from srcdir
* qt/qtconnection.cpp (requestName): Changed PROHIBIT_REPLACE to ALLOW_REPLACE
  Note - this code is wrong and needs to be fixed by the Qt binding
  developers.  The flags should be treated as bitfields and not enums.

* qt/qtconnection.h: Change ProhibitReplace to AllowReplace

* dbus/dbus-list.c (link_after): remove #ifdef DBUS_BUILD_TESTS
2005-12-01 00:07:20 +00:00
John (J5) Palmieri
0ca96ec548 * dbus/dbus-auth.c, dbus/dbus-connection.c, dbus/dbus-keyring.c,
dbus/dbus-server-debug-pipe.c, glib/dbus-binding-tool-glib.c
  glib/dbus-glib-tool.c, glib/dbus-gparser.c, glib/dbus-gproxy.c
  test/test-segfault.c, test/test-utils.c,
  test/glib/test-dbus-glib.c, tools/dbus-cleanup-sockets.c
  tools/dbus-launch.c, tools/dbus-tree-view.c, tools/dbus-viewer.c:
  Various cleanup of dead code and compiler warnings (patch from
  Kjartan Maraas <kmaraas at gnome.org>)
2005-11-30 19:32:27 +00:00
Robert McQueen
3bcfd003b6 2005-11-27 Robert McQueen <robot101@debian.org>
* python/dbus_bindings.pyx: Repair my previous commit which reverted
	part of the preceding one. Oops. Merge patch by Johan Hedberg
	<johan.hedberg@nokia.com> to fix marshalling of 16-bit integer values
	on big-endian platforms.

	* test/python/test-client.py: Add some 16-bit integers to the test
	values.
2005-11-27 17:44:19 +00:00
Robert McQueen
c77c7e343b 2005-11-27 Robert McQueen <robot101@debian.org>
* python/dbus_bindings.pyx: Fix a bug where doing a strict append
	with type v of an instance of dbus.Variant(foo, type='x') caused
	it to be boxed twice before sending over the bus.

	* python/dbus_bindings.pyx, python/service.py,
	test/python/test-client.py: Update the constants for the new
	request_name flags, and update comments/test cases now that queueing
	is the default action.
2005-11-27 16:40:57 +00:00
John (J5) Palmieri
1a163e765c * configure.in: Add test/name-test/Makefile to the generated
Makefile list

	* dbus/dbus-shared.h (#define DBUS_NAME_FLAG_ALLOW_REPLACEMENT):
	New flag which replaces DBUS_NAME_FLAG_PROHIBIT_REPLACEMENT
	(#define DBUS_NAME_FLAG_DO_NOT_QUEUE): New flag for specifying
	not to queue an ower if it can't be the primary owner

	* bus/bus.h: Add new internal BusOwner struct

	* bus/driver.c (bus_driver_handle_hello): Send flags (0 for default)
	to bus_registry_ensure and don't set the prohibit_replacement flag
	since they are now set per BusOwner and not per name.
	(bus_driver_handle_list_queued_owners): bus method (ListQueuedOwners)
	that returns the list of connections in a name's connection queue

	* bus/services.c (struct BusService): remove prohibit_replacement field
	(struct BusOwner): new struct for keeping track of queued connections
	and their associated flags for the queue
	(struct BusRegistry): add a BusOwner memory pool
	(bus_registry_new): initialize the BusOwner memory pool
	(bus_registry_unref): free the BusOwner memory pool
	(_bus_service_find_owner_link): new internal method for
	searching the queue for a specific connection
	(bus_owner_set_flags): new method for adding setting the flags on a
	bus owner
	(bus_owner_new): new method that creates a BusOwner object from the
	pool and sets its flags
	(bus_owner_ref, bus_owner_unref): ref counting for BusOwner objects
	(bus_registry_ensure): Add the flags parameter
	(bus_registry_acquire_service): Switch from using raw connections to
	using the BusOwner struct
	Add new state machine for dealing with the new set of flags
	(bus_registry_set_service_context_table, struct OwnershipCancelData,
	cancel_ownership, free_ownership_cancel_data,
	add_cancel_ownership_to_transaction, struct OwnershipRestoreData,
	restore_ownership, free_ownership_restore_data,
	add_restore_ownership_to_transaction): Switch to using BusOwner
	instead of raw connections
	(bus_service_add_owner): Add flags parameter
	Switch to using BusOwner instead of raw connections
	Add state machine for dealing with the new set of flags
	(bus_service_swap_owner): Swaps the first and second owners in the
	queue.  Used to make sure proper signals are sent when a service looses
	or gains primary ownership.  We never insert an owner at the top of the
	queue.  Instead we insert it in the second position and then swap.
	(bus_service_remove_owner): Remove the owner from the queue sending
	out the NameLost and NameOwnerChanged signals if the we were the
	primary owner
	(bus_service_get_primary_owners_connection): New method that extracts
	the connection from the primary owner
	(bus_service_get_primary_owner): Returns the BusOwner instead of the
	connection
	(bus_service_get_allow_replacement): Changed from the old
	bus_service_get_prohibit_replacement method.  Checks the flags of the
	primary owner and returns if it can be replaced or not
	(bus_service_set_prohibit_replacement): removed
	(bus_service_has_owner): returns TRUE if and owner with
	the specified connection exists in the queue

	* dbus/dbus-bus.c (dbus_bus_connection_get_unique_name): New helper
	method that only compiles if tests are enabled.  Allows us to get the
	unique name of a connection so we can check it against the queue when
	doing regression tests

	* bus/activation.c (bus_activation_send_pending_auto_activate),
	bus/dispatch.c (bus_dispatch),
	bus/driver.c (bus_driver_handle_get_service_owner,
	bus_driver_handle_get_connection_unix_user,
	bus_driver_handle_get_connection_unix_process_id,
	bus_driver_handle_get_connection_selinux_security_context),
	bus/signals.c (connection_is_primary_owner):
	use bus_service_get_primary_owners_connection instead of
	bus_service_get_primary_owner

	* dbus/dbus-sysdeps.c (_dbus_connect_unix_socket,
	_dbus_listen_unix_socket): Calculate the length of the socket
	path and use that instead of using a fixed length which was
	causing socket names to contain many trailing Nul bytes.

	* dbus/dbus-glib-lowlevel.h, glib/dbus-gobject.c
	(dbus_g_method_get_sender): New method for extracting the sender
	from a DBusGMethodInvocation
	(dbus_g_method_return_get_reply): changed name to
	dbus_g_method_get_reply
	(dbus_g_method_return_send_reply): changed name to
	dbus_g_method_send reply

	* doc/dbus-specification.xml: New docs that describe how the new
	queueing system works and talks about the changes to the how
	we specify socket names

	* glib/examples/example-service.c,
	glib/examples/example-signal-emitter.c,
	glib/examples/statemachine/statemachine-server.c:
	Changed the RequestName flags to the new system

	* test/name-test/ (test-names.c, run-test.sh, Makefile.am): New
	regression test suite for testing various states of the new
	queueing system
2005-11-22 20:37:00 +00:00
Robert McQueen
b5e4d26ade 2005-11-15 Robert McQueen <robot101@debian.org>
* bus/driver.c, bus/services.c, bus/services.h: Add a ReleaseName
	method to org.freedesktop.DBus to release a bus name or give up
	waiting in the queue for it.

	* dbus/dbus-bus.c, dbus/dbus-bus.h, dbus/dbus-shared.h: Add a
	dbus_bus_release_name method to send the ReleaseName method calls.
	Add constants for the return values to dbus/dbus-shared.h.

	* doc/dbus-specification.xml: Document the new ReleaseName method
	in the specification.

	* python/dbus_bindings.pyx: Add a low-level python binding for the
	release name method.

	* python/exceptions.py, python/service.py: Make freeing BusName
	objects release the name. Add a NameExistsException, and fix a
	bug with creating UnknownMethodException.

	* test/python/test-client.py: Add tests for freeing BusName
	objects causing names to be released.
2005-11-15 17:19:19 +00:00
Robert McQueen
7b9236f2ae 2005-11-14 Robert McQueen <robot101@debian.org>
* python/decorators.py, python/service.py: Add a new argument to the
	dbus.service.method decorator called sender_keyword, which if set,
	specifies the name of an argument which will be provided the bus
	name of the method caller.

	* test/python/test-client.py, test/python/test-service.py: Add a
	method and test to check the sender_keyword functionality.
2005-11-14 02:53:30 +00:00
Robert McQueen
e598c5edc5 2005-11-07 Robert McQueen <robot101@debian.org>
* python/decorators.py: Change emit_signal function to use the
	signature annotation of the signal when marhsalling the arguments from
	the service. Fix a bug where the code checking signature length
	against argument length referenced the wrong variable.

	* python/introspect_parser.py: Avoid adding the type signature of
	signal arguments to any methods which occur after them in the
	introspection data (!) by making the parser a little more careful
	about its current state.

	* python/service.py: Remove debug prints from last commit (again :D).

	* test/python/test-client.py, test/python/test-service.py: Add test
	signals with signature decorators to test the strict marshalling code
	gives errors at the right time. Could do with checking the signals
	actually get emitted too, given that the test does nothing with
	signals at the moment...
2005-11-07 15:31:30 +00:00
Robert McQueen
95f9771d6b 2005-11-07 Robert McQueen <robot101@debian.org>
* python/_dbus.py: Add WeakReferenceDictionary cache of dbus.Bus
	instances to stop madness of creating new instances representing
	the same bus connection all the time, rendering any tracking of
	match rules and bus names quite meaningless. Caught a bug where
	the private argument to SessionBus() and friends was being passed
	in as use_default_mainloop by mistake. Still some problems with
	multiple dbus_binding.Connection instances representing the same
	low-level connection (eg when you use both SessionBus() and
	StarterBus() in same process), but it's a lot better now than it
	was.

	* python/dbus_bindings.pyx: Add constants with the return values
	for bus_request_name().

	* python/service.py: Store bus name instances in a per-dbus.Bus cache
	and retrieve the same instances for the same name, so deletion can be
	done with refcounting. Also now throws some kind of error if you
	don't actually get the name you requested, unlike previously...

	* test/python/test-client.py: Add tests for instance caching of buses
	and bus name objects.
2005-11-07 12:14:53 +00:00
Robert McQueen
ac36149533 2005-11-04 Robert McQueen <robot101@debian.org>
* python/dbus_bindings.pyx, test/python/test-client.py: Fix
        marshalling of boolean values. Add some booleans to the values in
        the test client.

        * python/decorators.py, python/service.py: Add an 'async_callbacks'
        argument to the dbus.service.method decorator, which allows you to
        name arguments to take two callback functions for replying with
        return values or an exception.

        * test/python/test-client.py, test/python/test-service.py: Add test
        case using asynchronous method reply functions, both return values and
        errors, and from within both the function itself and from a mainloop
        callback.

        * python/decorators.py, python/service.py: Perform checking that the
        number of method/signal arguments matches the number of types in the
        signature at class loading time, not when you first introspect the
        class.

        * python/service.py: Remove debug print left by the last commit.
2005-11-04 12:18:00 +00:00
Robert McQueen
e20c311b13 2005-11-03 Robert McQueen <robot101@debian.org>
* python/service.py: Heavy refactoring of method invocation, with
        hopefully no effect on functionality. Nuked _dispatch_dbus_method_call
        in favour of a new _message_cb that uses seperate functions for
        looking up the method to call, marshalling the return values, and
        sending exceptions as errors, and is easier to follow as a
        consequence.  Fixes some corner cases about returning things that
        don't match your declared out_signature, allows exceptions to define
        _dbus_error_name and have it be sent over the bus as the error name,
        and paves the way for cool stuff like heeding the message no reply
        flag, asynchronous method implementations, informing the method of the
        sender, and including backtraces in the error messages.

        * test/python/test-client.py: Catch and print exceptions thrown in the
        async callback tests, rather than passing them to the low-level
        bindings to be ignored in a noisy and frustrating manner.
2005-11-03 21:47:31 +00:00
Robert McQueen
9d0ab37806 2005-11-03 Robert McQueen <robot101@debian.org>
* python/_dbus.py, python/proxies.py, python/service.py: Add __repr__
        functions to dbus.Bus, dbus.service.BusName and dbus.service.Object,
        tweak others to be consistent.

        * test/python/test-client.py: Tweak output of testInheritance.
2005-11-03 16:13:53 +00:00
Robert McQueen
a4b1aa3642 2005-10-29 Robert McQueen <robot101@debian.org>
* python/service.py: Major changes to allow multiple inheritance
        from classes that define D-Bus interfaces:

         1. Create a new Interface class which is the parent class of
            Object, and make the ObjectType metaclass into InterfaceType.

         2. Patch written with Rob Taylor to replace use of method_vtable
            with code that walks the class's __MRO__ (method resolution order)
            to behave like Python does when invoking methods and allow
            overriding as you'd expect. Code is quite tricky because
            we have to find two methods, the one to invoke which has the
            right name and isn't decorated with the /wrong/ interface,
            and the one to pick up the signatures from which is decorated
            with the right interface.

            The same caveats apply as to normal multiple inheritance -
            this has undefined behaviour if you try and inherit from two
            classes that define a method with the same name but are
            decorated with different interfaces. You should decorate
            your overriding method with the interface you want.

         3. Replace grungy introspection XML generation code in the metaclass
            with dictionaries that cope correctly with multiple inheritance
            and the overriding of methods. This also uses the signature
            decorations to provide correct introspection data, including
            the debut appearance of the types of your return values. :D

        * test/python/test-client.py, test/python/test-service.py: Add a test
        case to try invoking an method that overrides one inherited from a
        D-Bus interface class.
2005-10-29 22:41:07 +00:00
Robert McQueen
20bcbaf21f 2005-10-29 Robert McQueen <robot101@debian.org>
* python/decorators.py: Add optional arguments to the method and
        signal decorators to allow you to specify the signature of arguments
        and return values. Preserve the doc strings of signal functions in the
        decorated version, for pydoc and friends.

        * python/dbus_bindings.pyx, python/proxies.py: Replace the
        parse_signature_block function with an iterable dbus.Signature()
        type. Fix a bug in MessageIter.append_strict where you could append
        anything by claiming it was a string.

        * python/service.py: Use the out_signature decoration on methods to
        marshal return values, meaning you no longer require dbus.Array()
        or dbus.Dictionary() to indicate the type when returning empty
        arrays or dictionaries. Fix a bug where exceptions which are defined
        in __main__ are not turned into error replies.

        * test/python/test-client.py, test/python/test-service.py: Add test
        for correct marshalling of return values according to out_signature.
        Fix a bug in the async call test where the error_handler is missing a
        self argument.
2005-10-29 19:13:17 +00:00
Robert McQueen
2d74492ba2 2005-10-29 Robert McQueen <robot101@debian.org>
* glib/Makefile.am, glib/examples/Makefile.am,
        glib/examples/statemachine/Makefile.am: Merge patch from Ubuntu by
        Daniel Stone to replace explicit calls to libtool with $(LIBTOOL).

        * test/python/.cvsignore: Add run-with-tmp-session-bus.conf.

        * tools/dbus-monitor.1, tools/dbus-monitor.c: Merge dbus-monitor patch
        from Ubuntu by Daniel Silverstone to allow specifying match rules on
        the command line.
2005-10-29 17:02:58 +00:00
Robert McQueen
ef47e01f75 2005-10-24 Robert McQueen <robot101@debian.org>
* python/dbus_bindings.pyx (String, MessageIter): make D-Bus strings
    derive from unicode instead of str, and encode/decode UTF-8 when
    marshalling/unmarshalling bus messages

    * python/introspect_parser.py: encode introspection data as UTF-8
    before passing the buffer into libxml2

    * test/python/test-client.py: add unicode test strings

    * test/data/valid-service-files/.cvsignore, test/python/.cvsignore:
    ignore generated python test files
2005-10-24 18:29:50 +00:00
John (J5) Palmieri
2b9417707a * glib/dbus-gvalue-utils.c (hash_free_from_gtype): handle gdouble
and G_TYPE_VALUE_ARRAY (DBUS_TYPE_STRUCT)
(gvalue_from_hash_value, hash_value_from_gvalue): handle gdouble

* glib/dbus-gvalue.c (dbus_gvalue_to_signature): add missing
DBUS_STRUCT_BEGIN_CHAR and DBUS_STRUCT_END_CHAR charaters
when constructing struct signatures

* python/_dbus.py (Bus): handle private connections using the
private keyword in the constructor. defaults to private=False
(Bus::close): new method to close a connection to the bus

* python/dbus_bindings.pyx (Connection::close): renamed method
was previously called disconnect
(bus_get): now supports getting a private connection

* python/proxies.py (ProxyMethod::__call__): check if ignore_reply
keyword is set to True.  if it is, execute the method without waiting
for a reply
(ProxyObject::_introspect_execute_queue): new method for executing
all the pending methods that were waiting for the introspect to
finish.  this is called when introspect either succeeds or fails
(ProxyObject::_introspect_error_handler): call queued methods
2005-10-18 04:38:05 +00:00
John (J5) Palmieri
0ae9f138ad * python/dbus_bindings.pyx (MessageIter::append_strict): check for
STRUCT_BEGIN not TYPE_STRUCT in indicate we are marshalling a struct

* python/service.py (Object::_message_cb): handle exceptions correctly
  by sending them over the wire to the calling app.  This makes sure
  the client returns immediately instead of waiting the 15 seconds to
  timeout.

* test/python/test-client.py (TestDBusBindings::testBenchmarkIntrospect):
  Add a test to benchmark how long it takes to introspect a service and
  call a method which returns a large element (pretty fast)

* test/python/test-service.py (TestObject::GetComplexArray): new test
  method which pushes a lot of data
2005-10-14 21:44:00 +00:00
John (J5) Palmieri
86b9f6ad4a * glib/dbus-gvalue.c (marshal_variant): call _dbus_gvalue_marshal
instead of marshal basic so we can handle recursive types in a variant

* test/glib/test-dbus-glib.c: Add test for marshaling recurive types
  in variants

* test/glib/test-service-glib.c, test-service-glib.xml
  (my_object_echo_variant [EchoVariant],
  my_object_process_variant_of_array_of_ints123
  [ProcessVariantOfArrayOfInts123]):
  Add two test methods

* python/introspect_parser.py: New module for parsing introspect
  data.

* python/dbus_bindings.pyx:
  (various places): when throwing errors fix to use errormsg instead
  of message local variable because Pyrex can get confused with other
  message variables (initial patch by Robert McQueen
  <robert.mcqueen at collabora.co.uk>)
  (MessageIter::parse_signature_block): new method for getting the next
  block in a signiture.
  (MessageIter::append_strict): new method for appending values strictly
  using the passed in signature instead of guessing at the type
  (MessageItter:: append_dict, append_struct, append_array): use
  signatures to marshal children if the signature is available

* python/exceptions.py (IntrospectionParserException): new exception

* python/proxies.py (ProxyMethod::__call__): Marshal args with
  introspected signatures if available, else we fall back to the
  old way of doing things.
  (ProxyObject::_introspect_reply_handler ): parse introspection data

* python/service.py (ObjectType::_reflect_on_method): Properly
  terminate <method> if there are no args in the reflection data

* test/python/test-client.py: add tests for talking with the GLib
  test server.  This gives us better coverage for introspection since
  python to python will always generate arguments as variants.  It also
  allows us to test the robustness of the GLib bindings and interlanguage
  communications.
2005-10-05 20:43:46 +00:00
Harald Fernengel
9a821f4c13 ignore me 2005-09-30 15:21:44 +00:00
Harald Fernengel
fe9f471950 compile out of the box 2005-09-30 15:05:33 +00:00