On Thu, 2013-01-31 at 18:25 +0900, Tristan Van Berkom wrote: > I'm not sure what the solution should be exactly, but we > should discuss this a bit because the problem space is > a little bigger than just the source existing in the > client-side before e_source_registry_commit_source_sync() > returns.
Note that e_source_registry_commit_source_sync() is just a convenience wrapper. If your test cases are just passing scratch sources then what you're actually calling is e_source_registry_create_sources_sync(). That's the function I fixed in bug 685986. > So I guess there are 2 potential ways of addressing this problem: There's a 3rd approach. If you want an immediate client connection to a newly created address book, we could have evolution-addressbook-factory create the ESource on your behalf -- since it too has an ESourceRegistry -- and immediately instantiate a backend for it. That would eliminate the race without resorting to client-side hacks. It would require a new method on the addressbook and calendar factory interfaces, but that is easily done now that all our D-Bus interfaces are generated from XML specifications. That was the purpose of my recent rash of commits to master. Just this week I added e_book_client_connect_sync(), which combines the now-deprecated e_book_client_new() and e_client_open_sync() functions into one step. I could enhance this function to detect whether the given ESource is a scratch source, and invoke a different factory method which behaves as described above. No additional client-side APIs required. To summarize: The current addressbook factory D-Bus API looks like this: <method name="OpenAddressBook"> <arg name="source_uid" direction="in" type="s"/> <arg name="object_path" direction="out" type="s"/> </method> It only works for existing ESources already exported by the registry. I'm proposing to add a new method that takes the raw key file content from a scratch ESource in addition to a UID: <method name="CreateAddressBook"> <arg name="source_uid" direction="in" type="s"/> <arg name="source_data" direction="in" type="s"/> <arg name="object_path" direction="out" type="s"/> </method> Invoked by passing a scratch source to e_book_client_connect_sync(). The factory method would call e_source_registry_commit_source_sync() on your behalf, and assuming that goes well, return the object path to its newly-created EBookBackend. With equivalent changes to the calendar factory, of course. Matthew Barnes _______________________________________________ evolution-hackers mailing list evolution-hackers@gnome.org To change your list options or unsubscribe, visit ... https://mail.gnome.org/mailman/listinfo/evolution-hackers