[Kde-bindings] Ruby Plasmoid article

Richard Dale rdale at foton.es
Wed Aug 6 11:28:05 UTC 2008


On Wednesday 06 August 2008 10:46:28 Richard Dale wrote:
> On Wednesday 06 August 2008 03:33:39 Sebastian Sauer wrote:
> > forwarded to kde-bindings at kde.org since probably someone there knows why
> > Ruby Plasma Applets don't work any longer?! Looks as something essential
> > was changed right after our bindings-sprint and before the 4.1.0 release
> > (yay, I love feature-freezes).
> >
> > On Wednesday 06 August 2008, Sebastian Sauer wrote:
> > > On Saturday 02 August 2008, Declan McGrath wrote:
> > > > Hi Sebastian,
> > >
> > > and hi Declan,
> > >
> > > first sorry for the long time till I replied. I am atm quit busy with
> > > so much things that it's hard to react on more complex things in
> > > realtime ;)
> > >
> > > > Loved your article on the Ruby Plasmoids at
> > > > http://techbase.kde.org/Development/Tutorials/Plasma/RubyApplet.
> > > > Thanks!
> > >
> > > Thank you too! Feedback is a rather useful thing since it shows that
> > > it's really worth and needed(!!!) to write such tutorials.
> > >
> > > > I had a couple of difficulties whilst trying to get the tutorial to
> > > > work though. I've put up a blog post on my site at
> > > > http://www.theirishpenguin.com/2008/08/02/getting-ruby-plasmoids-up-a
> > > >nd -r un ning-in-kde-41-on-kubuntu
> > >
> > > wow.
> > >
> > > > The main issue I had was around the CMakeLists.txt file initially.
> > > > But now I'm stuck getting a 'findServiceByDesktopPath:  not found'
> > > > error when trying to run the plasmoid? Everything seems to have
> > > > installed correctly.
> > > >
> > > > Once I get it working I can tidy up my blog post or perhaps better
> > > > still migrate some of the content into your Techbase wiki article to
> > > > add a little more explananation to things like cmake and how to
> > > > install the plasmoid.
> > >
> > > uhm, seems I get something similar now;
> > >
> > > plasmoidviewer(20804)/libplasma Plasma::isPluginVersionCompatible:
> > > plugin is compiled against incompatible Plasma version   4294967295
> > > plasmoidviewer(20804)/libplasma Plasma::ContainmentPrivate::addApplet:
> > > Applet "plasma-ruby-web-applet" could not be loaded.
> > > findServiceByDesktopPath:  not found
> > >
> > > The interesting part here is the "incompatible Plasma version" which
> > > was not the case ~2 weeks ago :-/
> > > hmmm... since I use trunk I try to recompile bindings right now what
> > > may take a while. Else I would suggest to ask at the kde-bindings
> > > mailinglist (http://www.kde.org/mailinglists/) where more developers
> > > hang around ;)
> >
> > I keep to get that error in trunk too :-/
>
> The C++ clock .desktop file has this line in it:
>
> X-KDE-PluginInfo-Version=pre0.1
>
> Does adding that to the ruby applet's .desktop make it work? But we really
> should be switching to the ScriptEngine based api for Ruby applets. I
> haven't had time to convert some examples and generally try it out yet
> though.
I've confirmed that script engine based ruby plasmoids don't have any 
versioning problem at the moment, although C++ style Ruby plasmoids do.

I've done some more investigating and found out what the problem is. There is 
a macro you can add to a compiled C++ plugin that gives its version number. 
But the krubypluginfactory.cpp source doesn't have it because it is supposed 
to work for any KDE plugin. Which is a bit of a problem. So as a workround 
you can add these lines to kpluginfactory.cpp to get just plasma plugins 
working:

Index: krubypluginfactory.cpp
===================================================================
--- krubypluginfactory.cpp      (revision 842545)
+++ krubypluginfactory.cpp      (working copy)
@@ -93,6 +93,8 @@
         static QByteArray camelize(QByteArray name);
 };
 K_EXPORT_PLUGIN(KRubyPluginFactory)
+#include <plasma/version.h>
+K_EXPORT_PLUGIN_VERSION(PLASMA_VERSION)

 KRubyPluginFactory::KRubyPluginFactory()
     : KPluginFactory() // no useful KComponentData object for now

The macro looks like this:

#define K_EXPORT_PLUGIN_VERSION(version) \
Q_EXTERN_C KDE_EXPORT const quint32 kde_plugin_version = version;

So what we will need to do is to be able to set 'kde_plugin_version' for an 
individual plugin at runtime, by reading the value from somewhere in the 
directory where the plugin Ruby code is installed. Maybe a one line text file 
called 'KDE_PLUGIN_VERSION' or something? We have the same problem with C# 
plugins too.

-- Richard



More information about the Kde-bindings mailing list