Giving Transmission the Indicator Application

Have got an application? Add an Application Indicator to it! Jorge explains why.

We keep track of applications that need support for Indicator Application on Launchpad with the bug tag ‘indicator-application‘: the list of bugs against applications that need Indicator Application support. There are code snippets on the wiki page of Application Indicator but in this blog post for those who would like to use it in their application.

I recently added support for Indicator Application to Lernid, Bzr-Gtk and Transmission and am now working on getting it into Banshee. How do you help Ubuntu with adding support to existing applications? I’ll try to make that clear in this blog post.

#1. Find something to work on. That list of bugs against applications that need Indicator Application support is a great place to start looking. Don’t forget to mark a bug as ‘In Progress’ when you’re actively working on it!

#2. We’re adding support to an application that is most likely used on more places than just Ubuntu. Therefore you should keep in mind that not only enabling Indicator Application support should be easy, but also disabling it. This means you’ll have to do some Autotools magic in order to make sure libappindicator is present and it is wanted. At the AppIndicator wiki page there is an example autotools macro. This should be added to the ./configure.ac, which can mostly be found in the project’s source code root directory.You may have to adapt this in order to make it fit in the existing makefiles.
NOTICE: The previously mentioned autotools example was written with the programming language C in mind. When you’re writing in C# you can reuse the code, but please keep in mind that you should check for ‘appindicator-sharp-0.1’ rather than ‘appindicator-0.1’. The whole check isn’t necessary for Python.

#3. Now we can start writing the code. Finally! I’m afraid I have to disappoint you, because the code itself is the least work of the whole procedure. Again, there is a Porting Guide at the wiki page with examples for all supported languages. Those are pretty straightforward, so I won’t repeat them here, but if you still have questions, don’t hesitate to leave a comment. Important is that you should use the previously defined autotools variable HAVE_APPINDICATOR (when programming in C) to allow the application to be compiled with a GtkStatusIcon as well, on other systems. You can do that like this:

#ifdef HAVE_APPINDICATOR #include <libappindicator/app-indicator.h> #endif (other code) #ifdef HAVE_APPINDICATOR (Indicator Application code here) #else (leave the old GtkStatusIcon code here) #endif

#4. Now that the code and build macros have been written — and the configure script and the makefiles regenerated — and you’ve tested it (naturally), it’s time to submit your wonderful patch. Of course you do this on the bug report we’ve got in Launchpad, but we also would like you to forward the patch upstream. If there was not yet a bug report in the bug tracker of the application you ported, report one and link it to the Launchpad bug report. In the upstream bug report, leave a comment with your patch.

After that you’re done. Congratulations, you’ve helped with making the systray cleaner and prettier and more consistent. This makes us happy!

7 thoughts on “Giving Transmission the Indicator Application”

  1. Thanks so much for your work on this! Using transmission in Lucid is such an utterly pleasant experience now with the new indicator applet. Keep up the great work on other applications! Hopefully we’ll see network-manager use this system in Lucid+1.

  2. I am excited to see work on ading application indicator support to Banshee. It is my favorite media player and with it’s strong design I hope you are not finding to much trouble adding this functionality. I imagine it is going to be finally implemented as an extension like the current notification icon is.

    1. There is a patch attached to https://bugzilla.gnome.org/show_bug.cgi?id=607800 that adapts the Banshee.NotificationArea extension to use AppIndicator if it was compiled with –enable-appindicator and when that library is installed.

      I’ve added an option to Banshee’s preferences for disabling the Application Indicator and use the other instead.

      However, there is still an issue with that preference; when you toggle the checkbox Banshee automatically switches the tray icon, but the old menu is retained — if I would dispose it Banshee would throw all kind of nasty exceptions and crash — and some menu items that were already added are added again.

      I’m not sure whether the patch will be accepted for 1.6.0, though. I do hope it will because it is the version that’s eventually going to be shipped by Ubuntu Lucid.

      1. Hello, nice tweak. But when i tried your code, it will open several cioumhrm tabs for every space i managed to copy in terminal.1 word is ok, but as soon I copy spaces, it will open several tabs.Not using ubuntu own terminal, and a bit older terminal too. But it shouldent mather?

        1. I am not exactly sure what problem you have. Are you trying out own code based on my patch/code? Or are you playing with the patch I linked to?
          The Application Indicator for Banshee is already outdated. Ubuntu has moved the media players away from the indicators to the Sound Menu.
          The code for the Application Indicator may be outdated since it hasn’t been updated for a while and Ubuntu’s API could have been changed.

    1. I’m not going to take the meat of this post to task, it’s a very well written post exepct that you are completely incorrect that the right to benefit from your labor is the basis of capitalism itself. Capitalism causes a separation of labor. Capitalism often alienates the worker from his labor, and that’s what we’re seeing here. This is very much in keeping with the precepts of capitalism.Consider the analogy of Canonical as the factory owners, and the Banshee developers as the workers.

Leave a Reply