clarity of concept
clarity of concept
Posted Nov 11, 2014 16:13 UTC (Tue) by ceplm (subscriber, #41334)In reply to: clarity of concept by mezcalero
Parent article: Kdbus meets linux-kernel
However, one thing which have bothered me always: why is DBUS API so horribly complicated. In the good old days of DCOP (and now I don't care about that particular technology, just that the API could be way simpler) I was able to write this in KJS:
#!/usr/bin/env kjscmd
var dcop = new DCOPClient(this);
var box = new QHBox(this);
var go = new KPushButton(box);
var loc = new KLineEdit(box);
go.pixmap = StdIcons.DesktopIcon("go",32);
go.connect(go, "clicked()", this, "getWeather");
dcop.attach();
box.show();
function getWeather() {
if ( dcop.isAttached() ) {
var icn = new Image(this);
icn.pixmap = dcop.call("KWeatherService",
"WeatherService","icon(QString)", loc.text);
icn.smoothScale(32,32);
go.pixmap = icn.pixmap;
}
}
application.exec();
And that was everything I needed (including complete GUI). The call to DCOP itself was way more simple. I understand that DBUS is capable of doing way more complicated things, but why is it pushed down our throat? I just need a way how to address a simple object and method on it. So why the call you have shown couldn't be just something way more simple like:
impomrt dbus
bus = dbus.get_bus(dbus.SESSION_BUS)
bus.call('org.freedesktop.timedate1', 'SetTimezon', 'Europe/Berlin')
In the moment I don't need more than one object with one method (or few method) why do I need to deal with all this other stuff?
The LWN site is currently under high scraper load, so comment display has been suppressed for anonymous users. If you are a human, you may read the comments by clicking the button below:
Note: you can avoid this step in the future by logging into your LWN account.
