Bug 30098 - Implement an intuitive replacement for synchronous D-Bus property getters
Summary: Implement an intuitive replacement for synchronous D-Bus property getters
Status: RESOLVED FIXED
Alias: None
Product: Telepathy
Classification: Unclassified
Component: tp-qt (show other bugs)
Version: git master
Hardware: Other All
: medium normal
Assignee: Olli Salli
QA Contact: Telepathy bugs list
URL: http://git.collabora.co.uk/?p=user/ba...
Whiteboard: patch
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-09 02:58 UTC by Will Thompson
Modified: 2010-11-04 09:36 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Will Thompson 2010-09-09 02:58:11 UTC
Our Tp::AbstractInterface subclasses all have deprecated setters and getters for each D-Bus property on the interface. For instance, <http://telepathy.freedesktop.org/doc/telepathy-qt4/classTp_1_1Client_1_1ConnectionInterfaceCellularInterface.html#a2a68cb567af20470f4ef77e98b1bdaf2>:

> QString Tp::Client::ConnectionInterfaceCellularInterface::MessageServiceCentre	(		 ) 	 const [inline]
> Getter for the remote object property "MessageServiceCentre".
> 
> Don't use this: it blocks the main loop.
> 
> Returns:
> The value of the property, or a default-constructed value if the property is not readable.

This doesn't tell you why blocking the main loop is bad, or what you should do instead.

Also, we should stop generating instantly-deprecated API for new interfaces!
Comment 1 Olli Salli 2010-09-09 04:01:04 UTC
I don't think it's worthwhile adding any logic / parameter to the proxy generator for this, as I think we're going to stop generating them for both old and new classes RSN in the API/ABI break.

Another thing we should probably do, though, is: implement a PendingVariantMap *properties() and PendingVariant *property(name) (or maybe even Pending<T1> *property1(), Pending<T2> *property2()), etc, which would do Properties::Get(All), on the AbstractInterface subclasses.

This would also make internal tp-qt4 code mode readable, as it wouldn't have to have verbose property getting code and possibly even the hardcoded property name strings.
Comment 2 Marco Barisione 2010-10-14 06:10:57 UTC
Here's my branch with the fixes. It generates requestPropertyFoo() and setPropertyFoo() for every DBus properties.
If there are properties it also generates a requestAllProperties() returning a PendingVariantMap (new type that is more convenient to use than a PendingVariant in this case).
I also added a new test to test DBus properties and modified the existing ones to avoid the deprecated getters.
The last patch, not supposed to be merged now, removes the deprecates property accessors.

Sadly it was not possible to add a PendingValue<T> as you cannot use Q_OBJECT with templates :(
Comment 3 Olli Salli 2010-11-04 09:36:47 UTC
Merged to git master with some additional fixes. Will be in 0.3.14.


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.