Indicator applet API changes in Ubuntu 9.10

The API for the indicator applet has changed in Karmic and a little internal IBM Python application that I’ve written stopped working. Only a couple of minor changes were needed but trying to track down exactly what these were was not as easy a task as I’d have liked.

Creating the indicator
The class used to represent an indicator appears to have changed from IndicatorMessage to Indicator so I threw in the following code to try the new one and fallback to the old one:

try:
  # Ubuntu 9.10 and above
  indicator = indicate.Indicator()
except:
  # Ubuntu 9.04
  indicator = indicate.IndicatorMessage()

Drawing attention
Previously, indicators automatically made the indicator applet draw your attention with a green dot. In Karmic the green dot appears to have been replaced with a change of the envelope colour to black but it is no longer automatic. To make this work you need to set the draw-attention property:

indicator.set_property('draw-attention', 'true');

Note that they’ve also added a count property to display how many notifications are from the same source.

Advertisements

13 thoughts on “Indicator applet API changes in Ubuntu 9.10

  1. Thanks for this! I'm building a plugin for emesene, and was wondering why it kept breaking since I installed Karmic!Any ideas how to remove a server item from the applet? Being a plugin, I need to be able to stop and remove the server from the applet when the user disables the plugin. So far, all I can make of other applications behaviour is that it removes it when the application is closed.Cheers!

  2. No problem – glad it helped! As for removing the server item, does server.hide() work? I haven't tried it lately but I have a feeling I used that previously. You could also try removing all references to the server instance so the object is destroyed. Let me know how you get on.

  3. server.hide() doesn't work. I've used server.disconnect(handleID), that does stop the server from working but the entry stays in the applet. If I start the plugin again, I get two indicators each time, stop/start it again, 3, etc etc.I'm new to python so maybe I'm doing something wrong, but I did also try making the server object NULL, which didn't work either :I can't release the plugin until that's fixed!

  4. Worth noting that with Karmic, any entry in /usr/share/indicators/messages/applications/ will appear permanently in the indicator applet. It seems that if the description is visible (from the .desktop file) then the app is not running and when the app is started (i.e. the server is created), the description disappears. I believe the ultimate plan is for users to be able to customize a bit more this themselves. Maybe this is what you're seeing?

  5. It's not what I was seeing, but you've actually answered a question for me that I was going to ask! I was wondering how Empathy, Pidgin, Evolution and Gwibber all seem to have their place in it when the application isn't running! I'll consider that functionality, or at least recommend it to the emesene developers.I'll keep playing around and see what I can come up with – I'll let you know my results!

  6. “Here air jordan 21 products xx, has fashion model, superior quality and service, cheap price and updates quickly.I support strongly always! I want to buy XX, I hesitate to select which style more better.Hope your unique recommends.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s