(A)synchronous DataEngines?
Aaron J. Seigo
aseigo at kde.org
Sat Mar 8 02:02:38 CET 2008
On Friday 07 March 2008, Bernhard Beschow wrote:
> updated until updateSource gets called next time. Even worse, this results
> in old data to be displayed. So I wonder what the proper way is to
> implement asynchronous data retrieval?
there are two methods you need to take care of. one is sourceRequsted, which
as the docs say:
* If the source can not be populated with data immediately (e.g. due to
* an asynchronous data acquisition method such as an HTTP request)
* the source must still be created, even if it is empty. This can
* be accomplished in these cases with the follow line:
*
* setData(name, DataEngine::Data());
next is updateSource, for which the docs say:
* @return true if the data was changed, or false if there was no
* change or if the change will occur later
so when you get a request, either into sourceRequested or updateSource, return
false and when the data comes in, call setData.
we know this works because we already have engines that do exactly what you
are doing: fetching (and even parsing) data from the web on request.
> Of course, there is also synchronous data fetching. I'm not sure whether
which you don't want to do because that would block the entire plasma
application in the process.
--
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA EE75 D6B7 2EB1 A7F1 DB43
KDE core developer sponsored by Trolltech
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 194 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/panel-devel/attachments/20080307/710ec581/attachment.pgp
More information about the Panel-devel
mailing list