[Gambas-user] New system tray icon protocol support, new episode.

Benoît Minisini gambas at ...1...
Sat Jul 4 14:32:40 CEST 2015


Le 30/06/2015 21:33, Adrien Prokopowicz a écrit :
>
> Well, I think the only reliable way to tell is to actually check the
> session bus to see if the StatusNotifierHost is present.
>
> What don't you like in having to load gb.dbus to do the check ?
> I understand you don't want to load the component "for nothing" if
> the check fails, but in some way it is also loaded whether or not
> you are using TrayIcons in your programs, so ...
>
> There are so many cases to test, I feel that if we somehow sort it out,
> the whole environment-testing/dynamic-loading process would be
> way cooler than the final TrayIcon feature itself. :)
> (Not mentioning the work already done for that, i.e. the whole DBus
> overhaul, and the "Optional Classes" interpreter feature, which
> are both really cool).

Done in the last revisions: now the trayicon is managed by a dedicated 
component, 'gb.gui.trayicon', that loads 'gb.dbus', check if a 
StatusNotifierHost has been registered. If yes, it loads 
'gb.dbus.trayicon', otherwise it lets the gui component declare the old 
implementation.

>
>> In the meantime I investigated with Unity... They actually use a DBus
>> protocol completly different from the KDE one, but apparently QT apps
>> using sni-qt (like vlc) know how to deal with that. I will try to look
>> into the sni-qt source code to understand the magic behind that.
>>
>> Of course, don't expect to find any good documentation about that Unity
>> protocol (a.k.a. libappindicator).
>>
>
>   From what I've saw in the sni-qt source code, it only relies on the
> Unity-like protocol (which is also supported by KDE) :
> the path sent to the StatusNotifierWatcher is hard-coded to be
> "/org/kde/statusnotifieritem/<id>".
>
> Also, if you need me to test some more things, just tell. :)

The Unity and KDE protocol are actually really different: Unity requires 
a status icon to have a menu, otherwise it does not display it. As soon 
as your application has more than one icon, you have to use a completely 
different way of declaring your DBus objects between Unity and KDE...

'appindicator', 'statusnotifier' and 'dbusmenu' are really three pieces 
of badly designed almost undocumented shit that required me one week of 
reverse engineering! But now it works more or less, so I'm happy. :-)

-- 
Benoît Minisini




More information about the User mailing list