Bug 685986 - ESourceRegistry: Wait for signals after creating sources
authorMatthew Barnes <mbarnes@redhat.com>
Sat, 27 Oct 2012 02:45:59 +0000 (22:45 -0400)
committerMatthew Barnes <mbarnes@redhat.com>
Sat, 27 Oct 2012 12:46:41 +0000 (08:46 -0400)
commit6f98b459bd9abd55dbdee995e4bdb15da3797023
tree4bcd05385940a476e8a546f8c5b0dfd6c3fef3d3
parentd62d6eef737b30510ab10993b9e78f440b542477
Bug 685986 - ESourceRegistry: Wait for signals after creating sources

e_source_registry_create_sources_sync() now waits for "object-added"
signals from its GDBusObjectManagerClient before returning.  This allows
the newly-created ESources to be obtained immediately after the function
returns.  Prior to this there was a small delay before the newly-created
ESources became available through the ESourceRegistry API.

There is a caveat to this.  If any of the scratch ESources reference a
parent UID which is not presently exported by the registry service, the
registry service will refuse to export the newly-created ESource until
its parent becomes available.

In this scenario, to avoid waiting forever for an "object-added" signal
that isn't coming, we place a limit on the wait time (two seconds).  If
this time limit expires, we return from the function regardless.
libedataserver/e-source-registry.c