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!