Tag Archives: diodon

Writing a plugin for Diodon

The new plugin system for Diodon brings about an easy way to extend Diodon with any feature you might think of.

That could be a Ubuntu One integration, or clipboard actions, copying clipboard content to pastebin, and many many more…

With this post I try to explain you quickly how you go about writing your own plugin and will also point you to other documentation which might be helpful.

Before you start writing your own plugin, one thing is important to know. Diodon uses the library libpeas for its plugin system. Such is used for instance for Gedit or Totem.
There is a good blog post which describes how libpeas works.

You find some sample plugins code written in C, Vala or Python in the diodon bazaar branch plugin-sample.

You can check out and build it with following commands:

bzr branch lp:~diodon-team/diodon/plugin-sample
cd plugin-sample
./waf configure --libdir ~/.local/share/
./waf build
./waf install

For this you have to have Bazaar, valac and the package diodon-dev installed.

sudo apt-get install bzr diodon-dev valac

It is recommended to write your plugin in Vala. However C and Python is allowed as well.

As you can see the sample is using waf as a build system (which I personally prefer). However if you want to build your plugin with autotools, take at look at peas-demo of libpeas itself. There you find also some more code how a plugin can be written.

The object you can access in your plugin is the Diodon Controller.

Here is a list of events and methods which are provided:

public signal void on_select_item(IClipboardItem item)
public signal void on_add_item(IClipboardItem item)
public signal void on_remove_item(IClipboardItem item)
public signal void on_clear()
public void select_item(IClipboardItem item)
public void execute_paste(IClipboardItem item)
public void remove_item(IClipboardItem item)
public void add_item(IClipboardItem item)
public Gee.List get_items()
public ConfigurationModel get_configuration()
public void show_history()
public void show_preferences()
public void clear()
public Gtk.Menu get_menu()

Currently, there is no api documentation available. Therefore, for now, please refer to the the source code comments on the Controller.

When you miss a method or an event which you would need in your plugin, please let me know. Best just report a bug and mark it as wishlist. We can than see what we can do.

To test your plugin, there are two location where you can put your files. For simple testing you can add it to ~/.local/share/diodon/plugins. When providing the plugin in a package you should install it to /usr/lib/diodon/plugins.

In both cases you have to activate you plugin in the preferences dialog:

When you finally have finished your plugin, you can publish it as you prefer. However, we as a Diodon Team are intrested to include good plugins in the Diodon source.
Plugins written in Vala will be preferred, however for none-core plugins python and C is allowed as well.
For such a request please report a bug and mark it as Wishlist.

I’m looking forward to see with what idea you come up to extend Diodon.

When will Diodon be stable for Oneiric?

I have found a few request in my Inbox today pointing out this question. I’m very happy to hear that so many are keen to use a stable Diodon version on Oneiric. I can tell you: So am I ;).

However I hope this blog post will clarify why Diodon is not already available for Oneiric in the stable ppa.

Firstly, you might say, the easiest and safest way would be to build and upload the latest stable release 0.5.0 for Oneiric. Yes it would be. Unfortunately, due to API changes in Unity this version does not even compile.

Such compile errors have been fixed while updating to a new plugin system. However this has brought about a lot of refactoring and therefore needs good testing. (read more about it on this blog post).

So before a stable release will be available, I need some more feedback of testers whether the new version has any regression or bugs.

For this checkout the daily ppa. Leave a comment on this post if everything runs smoothly or otherwise report a bug.

You can also take a look at the milestone 0.6.0 for an overview of open issues which need to be fixed before the stable release.

I’m working hard so a stable Diodon version will be available for Oneiric as soon as possible.

Ramping up plugin system for Diodon

I’ve been working on a plugin system for Diodon for quite a while. Now, finally, it is ready for testing in the daily ppa.

Before you go ahead testing the new version please remember that this code is in development state and therefore should not be used on a production system.

This said, let’s talk about what has really changed:
Basically Diodon still works as usual. However, under the hood a lot has changed.
First is to mention the update to gtk3 and dconf/GSettings. This changes bring about two consequences:

  • All your customized settings will be lost on a upgrade. So please check the preferences dialog.
  • Diodon will only be installable on Oneiric or higher (and of course on any other distribution with gtk3 support but then from source). Older versions of Diodon will still be available for older Ubuntu versions.

Furthermore, a lot of refactoring was needed to have a clean API for the plugin system. A blog post how you can develop your own plugin for Diodon will follow soon.
If you cannot wait 🙂 you might take a look at Libpeas which is the library Diodon uses for its plugin system.

Currently, Diodon has two plugins. One is the application indicator which is installed and activated per default with the diodon package.
Additionally is there a diodon-plugins package which currently only contains the Unity Lens Plugin.
When installed the Unity Lens is not activated per default and needs to be enabled in the Preferences Dialog of Diodon.

I will soon write a few other posts about the new plugin system. However this should do for now ;).

Looking forward to hear what you think about this move.

Diodon 0.5.0 and what to do when diodon does not start

Finally, the instant paste feature is available in a stable release and enabled by default. But no worries if you do not like it you can still disable it in the preferences.

When you suffer from the issue that Diodon does not start anymore, this new release might help you as well. There was an issue that Diodon did not handle some UTF-8 strings correctly what led to Diodon not starting. This issue is fixed in this release.

However it brought up the question what you can do when you suffer from a different issue which causes Diodon not to start either. (although I hope this will never happen to you).

Firstly checkout out the post After updating to Natty: Why has Diodon stopped working?.

If that is not the case on your machine another way is to remove (resp. move) the history file. You can do that with following command:
mv ~/.local/share/diodon/storage.xml ~/.local/share/diodon/storage.xml.old

Start diodon again. Hope you are lucky and it will work. However please file a bug on https://bugs.launchpad.net/diodon and attach the storage.xml.old file.

If diodon still does not start please still file a bug. Run Diodon on the console and add the output to the bug report.

Hope you will get happy with the new Diodon version. If not please let me know ;).

Diodon with instant paste for testing

The instant paste feature has finally landed into the Diodon trunk. With this feature there is now no need to press Ctrl+V after choosing a clipboard item (which you wanted to paste anyway ;))
Diodon does this now for you…

However, before this change gets released it needs intensive testing. And, of course, I want to hear your comments on what you think.

Before you go ahead please remember that this code is in development state and therefore should not be used on a production system:

So let’s start with the installation by running following commands:
sudo add-apt-repository ppa:diodon-team/daily
sudo apt-get update
sudo apt-get install diodon

Close Diodon and open it again. The instant paste feature should now be activated. Set the cursor at the position you want to paste, choose an item from the clipboard history and see how it works (hopefully anyway ;))

Note that currently the instant paste feature only works for applications which do not ignore events of X (see here for details) and use
Ctrl+V to paste content.

Please file a bug when you find an application where the instant paste does not work.