[Kde-bindings] Minimal dcop client
Richard Dale
Richard_Dale at tipitina.demon.co.uk
Mon Dec 19 23:01:37 UTC 2005
On Monday 19 December 2005 21:59, Han Holl wrote:
> Hello,
>
> I have a ruby script that does system("dcop ..... ") calls, and I want to
> replace them with call from ruby directly.
>
> What I want to write is roughly:
>
> require 'Korundum'
> dk = KDE::DCOPRef.new('kdesktop', 'KBackgroundIface')
> dk.setWallpaper('/backup/tinelot/ting/winter 2002/imm016_edited.jpg', 4)
>
> What I have to write though:
>
> require 'Korundum'
>
> KDE::CmdLineArgs.init(KDE::AboutData.new("a", "", '', '', 0))
> KDE::Application.new
>
> dk = KDE::DCOPRef.new('kdesktop', 'KBackgroundIface')
> dk.setWallpaper('/backup/tinelot/ting/winter 2002/imm016_edited.jpg', 4)
Invoke ruby with 'ruby -r korundum'
Then you need these four lines:
KDE::CmdLineArgs.init(ARGV, KDE::AboutData.new("chwallpaper", "Change
wallpaper", "0.1"))
a = KDE::Application.new()
dk = KDE::DCOPRef.new('kdesktop', 'KBackgroundIface')
dk.setWallpaper('/backup/tinelot/ting/winter 2002/imm016_edited.jpg', 4)
>
> I find this kind of unsatisfactory: apparently KDE::Application.new, does
> more than just construct a KDE::Application: it has side effects that
> enable the KDE::DCOPRef call in some secret magic way.
> Also KDE::Application.new doesn't work without the line above it: wouldn't
> it be clearer if something you need is a required contructor argument ?
Well, it might be nice to have a shorter way to create a KDE app, but for the
moment that's as small as it can be. Maybe a dcop wrapper script could be
included with korundum, but it will only save a couple of lines.
> If you omit the initialization lines, you get a quite mystifying error
> message.
Yes, but that's from KDE not the ruby bindings.
> And while trying to figure all this out I had a couple of SEGFAULTS.
> Richard if you're interested I'm sure I can reconstruct a couple of them.
The seg faults are probably in the C++ code, and so it isn't necessarily easy
to trap all of them. But please post them and I can see if it's possible to
do some extra error checking in ruby.
-- Richard
More information about the Kde-bindings
mailing list