Detecting plasmoid in use
Aaron J. Seigo
aseigo at kde.org
Wed Jul 6 10:34:53 CEST 2011
On Monday, July 4, 2011 20:07:49 Martin Klapetek wrote:
> I'm trying to solve the following problem in KDE-Telepathy - since the
> connection to IM networks is held by the system itself and not by any
> Telepathy component, we need to detect if any presence handlers are active
> (in other words - components, that tells you you're online). We currently
> have only two such handlers - contact list app and a plasmoid (with
> dataengine) and we need a way to detect from contact list, if the plasmoid
> is active (in use).
is there somewhere that an item can subscribe to (e.g. via dbus) to say "i'm
here and listening"? that would make it the easiest to implement.
> The plasmoid is pure QML, therefore we can't do any dbus
> magic directly with it (or can we?).
currently no. this is really something that belongs in the DataEngine or a
Service it provides.
> So I'd like to know - is there any way that we can detect if the plasmoid is
> in use from any KApp and not depend on Plasma libs? And related question -
> is the dataengine in use only when the plasmoid is active? If so, is it
> "safe" (in terms that we can rely on it 100%) to export some activity
> indicator from the dataengine on dbus?
the DataEngine is loaded on demand only (otherwise, think about it: every
DataEngine would be loaded on desktop start..), and when the last user of it
goes away the DataEngine is deleted. remember that there can be more than one
instance of your plasmoid, so the DataEngine is a much more direct and safe
way to go.
a DataEngine can also determine if something is connected or not and therefore
know itself if it is unused and just sitting there. it should, with the
reference counting, just be deleted, however. so using that is probably the
easiest way forward and works reliably with plasmoids.
one wrinkle, however: keep in mind that right now DataEngines are in-process,
so if i load the plasmoid in plasma-desktop and again in plasma-windowed or
plasma-overlay (the screensaver widgets) then there will be more than one
instance of the DataEngine running globally on that system.
--
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 Qt Development Frameworks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20110706/db8b6cdf/attachment.sig
More information about the Plasma-devel
mailing list