← Back to team overview

unity-dev team mailing list archive

Re: [Ayatana-dev] statusicon -> AppIndicator (popup-menu signal)

 

On Mon, 2011-10-24 at 17:16 -0400, Alex Cornejo wrote:
> I am porting an application from StatusIcon to use AppIndicator. This
> particular app uses RandR extension to let the user manage multiple
> screens, resolutions and layouts. Right now I generate the menu on the
> fly when I get the popup-menu signal, which works flawlessly. This
> doesn't seem to be possible with AppIndicator, could someone with
> experience in AppIndicator with it could suggest me a good
> alternative?

In general, we're not super interested in people implementing this type
of behavior.  It isn't good for the user experience in that there is
always going to be a delay in the menu appearing.  While this isn't a
big deal on your laptop, it in, for instance, small webbooks with 800Mhz
ARM chips.

That all being said.  People do it.  You can get the dbusmenu
representation of the menu and watch the presentation signal on the menu
to know when it is displayed.

> Another "clean" alternative, would be to somehow try to listen for
> changes in the devices which are plugged in, perhaps using some dbus
> message which is generated when a second monitor is plugged in
> (although this is probably handled by udev, and I do not know if dbus
> currently generates events for this). I am not even sure that this is
> possible.

Yes, you can do this using udev.  There is a GLib based library call
gudev that will give you signals when devices are plugged in.  This is a
much better way to update the menu and makes a better user experience.
You can look at the indicator-session codebase as an example there, it's
being used for the new device features.

		--Ted

Attachment: signature.asc
Description: This is a digitally signed message part


Follow ups

References