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) {


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.


2 Responses to “Libnotify Java bindings – Adding actions”

  1. Thotheolh Says:

    What do I need to import ? Are there any jar files needed ? Can you make the sample codes more self contained ?

  2. Serkan Kaba Says:

    You need java-gnome which this binding is part of. The java-gnome distribution has an example on bindings which can also be viewed online.

Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )

Connecting to %s

%d bloggers like this: