Announcing Libnotify Java bindings

After 2 ½ months of work libnotify branch finally made its way to mainline. It’s my biggest contribution to Java-Gnome project. Again thanks to Andrew, Guillaume and Vrexio for their help and aid in the development and the testing. It will close a more than 3 year old ticket reported to Galago Project.

Bleeding-edge testers may grab the mainline branch and others may wait until next version (4.0.12) is released.

Libnotify Java bindings – Adding actions

Java-Gnome bindings doesn’t support callbacks at the moment. It can generate code for signals only. To add action callbacks, I reimplemented it as action signal. Here’s an example code to show how to add signals:

notification.addAction("a", "Action 1.a", new Notification.Action() {

    public void onAction(Notification source, String action) {
        System.out.println("1.a");
    }

});

The implementation currently has one drawback. Signals are not disconnected properly. This causes two issues. One, signals aren’t disconnected if actions are removed with clearActions(). Two, if actions with same actionIDs are added signals for all are triggered. Andrew will be adding support for signal disconnection to java-gnome and I’ll be using it in libnotify branch.

Bringing Libnotify to Java

I’ve been contributing to java-gnome for sometime. It was generally build system and test improvements with little bits of coverage addition that was merged to mainline for now. Although I began libnotify branch later than other two (libsexy and vte) the branch improved way faster than the others. The Bazaar branch has nearly full coverage of the underlying API.

The example included shows a critical low-battery warning with gnome-power-manager icon sitting in the notification area (Assuming you have it installed).

low-battery

I’ll be implementing the missing action covarage now and try to make it to our next release 4.0.12. And of course thanks goes to our lead Andrew Cowie for his help in development and Guillaume Mazoyer for testing it and providing feedback.

Follow

Get every new post delivered to your Inbox.

Join 533 other followers