Why KDE bindings simply rock (or: Creating our first Ruby plugin for Kate)

Akademy really speeds up development and communication between developers:
Yesterday I was poked by Milian Wolff and he told me how many people want to write Kate plugins in languages other than C++ and ECMAScript and how he always told them that’s not possible and probably a huge amount of work to get working. Well, that wasn’t entirely true:
If the target application has a SMOKE lib that wraps its API and an according bindings extensions, it works pretty much out of the box, thanks to the gorgeous KPluginFactory API and of course thanks to our gorgeous bindings.
Kate was a bit trickier to get working though, because it used old and deprecated API to load plugins. Well, I filed a merge request on gitorious about that, fixed a bug in KRubyPluginFactory and now I’m very proud to present

The absolutely gorgeous, simple, straight-forward, packed with all the Ruby goodness, very first Ruby Hello-World Kate plugin:

You’ll also need an ui.rc file that defines the actions to be merged into the Kate main window and a .desktop file which describes your plugin. Actually I’m too lazy to post them all here, so I made a nice package containing everything you need, together with a Makefile which can ‘make install’ the plugin into your home directory.

Since all SMOKE based bindings wrap the C++ API nearly 1:1 and only add syntactic language specific sugar on top, you can create nearly any plugin you like in any language, without modifying the host application, as long as the API is wrapped in a SMOKE lib and a bindings extension. In C# you can even create KIO slaves (a monodoc KIO slave example is shipped with the kdebindings tarball). That feature hasn’t been added to Ruby yet, but is on my ToDo list.

So praise the bindings, praise the KDE plugin infrastructure and start working on Ruby Kate plugins! 🙂

You can find the Ruby Kate binding and the SMOKE kate lib in current kdebindings trunk.

6 thoughts on “Why KDE bindings simply rock (or: Creating our first Ruby plugin for Kate)

  1. saLOUt

    How do I get the SMOKE API for kate?
    How do I get the library for ruby?

    Can you report the requirements in detail?

    Best regards,

    1. Arno Post author

      They are both in the kdebindings module in svn trunk. That’s not really the ideal place for them, since kdebindings should only depend on kdelibs and kdesupport.
      We’re still thinking about better placement options for the other bindings.

    1. Arno Post author

      In theory that is possible, yes. Practically the Python bindings are missing the Kate API, IIRC. You might want to ping Simon Edwards about that, as he is the main KDE Python bindings guy.

Comments are closed.