From kde-devel Mon Sep 20 03:30:25 2004 From: Richard Dale Date: Mon, 20 Sep 2004 03:30:25 +0000 To: kde-devel Subject: Re: Implmenting DCOP Message-Id: <200409200430.26060.Richard_Dale () tipitina ! demon ! co ! uk> X-MARC-Message: https://marc.info/?l=kde-devel&m=109565098811849 On Monday 20 September 2004 02:32, Ian Reinhart Geiser wrote: > Richard Lärkäng said: > > On Sunday 19 September 2004 20.28, PiggZ wrote: > >> next question, a call to dcop returns kppp-PID, > > [...] > > > I don't thinks it's possible to listen for a dcop-signal in a shell > > script, > > but I could be wrong. OTOH, if you program in something like > > perl/python/ruby > > there's bindings for DCOP in the kdebindings module, from which you can > > do really cool stuff. > > its possible with some hacks i did a few years ago, but its not so pretty. > Bsicly i wrote a small C++ app that just connected to the slots and > returned to stdout the results. > > the javascript, python and afaik ruby bindings both support dcop signals > and slots. shell is funny when it comes to slots, since they are > asynchronous by nature and a shell script is not. Here's a ruby app that connects to kppp via dcop signals: require 'Korundum' class KpppMonitor < KDE::DCOPObject def initialize(*args) super connectDCOPSignal(nil, "KpppIface", "connected()", "kpppConnect()", false) connectDCOPSignal(nil, "KpppIface", "disconnected()", "kpppDisconnect()", false) end def kpppConnect() puts "kppp has connected" end def kpppDisconnect() puts "kppp has disconnected" end end class MainWindow < KDE::MainWindow def initialize(*args) super @kppp = KpppMonitor.new end end aboutData = KDE::AboutData.new("kpppmonitor", "Kppp Monitor", "0.1", "Monitor kppp via signals", KDE::AboutData::License_GPL, "Richard Dale") KDE::CmdLineArgs.init(ARGV, aboutData) app = KDE::Application.new mainWindow = MainWindow.new mainWindow.show app.exec >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<