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.

About these ads

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:

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

Follow

Get every new post delivered to your Inbox.

Join 533 other followers

%d bloggers like this: