[fpc-pascal] D-Bus. Non blocking listening for signals

Matthias Klumpp matthias at nlinux.org
Thu Jan 13 18:26:50 CET 2011


On Thu, 13 Jan 2011 15:20:47 +0100, dibo20 at wp.pl wrote:
> W dniu 13.01.2011 14:41, Matthias Klumpp pisze:
>> Hi!
>> I developed the Listaller Project, a cross-distro Linux software
manager,
>> which uses techniques like D-BUS and PolicyKit and had very similar
>> problems. You can run Qt4 applications which use GLib (but only GLib!),
>> but
>> you need to call g_type_init() in the Qt application somewhere to make
>> GObject work. (But only _once_, otherwise you get very strange
behavior)
>> This makes the application depend on GLib, but not on GTK+. I won't
need
>> my
>> Listaller D-BUS daemon anymore next time, cause the required parts will
>> get
>> merged with the PackageKit project. (D-BUS in Pascal is a PAIN! I wrote
a
>> small set of simplifications, but it's far away from a state like
C/GLib,
>> where DBus is very easy to use) Projects like PackageKit, PolicyKit or
>> Canberra are the reason why KDE has GLib installed in most times, so
>> depending on GLib and Qt is not really a problem considering the
>> dependencies.
>> Cheers
>>    Matthias Klumpp
>>
> Thanks for this info Matthias. Simple question:
> If I use g_main_context_set_poll_func, does it matter what I return in 
> TGPollFunc? Can this be just 0? Documentation say:
> "/Returns/ : the number of GPollFD 
>
<http://library.gnome.org/devel/glib/unstable/glib-The-Main-Event-Loop.html#GPollFD>
> 
> elements which have events or errors reported, or -1 if an error
occurred"
> ... and I don't understand this :P
Hi!
Very simple: You just return the number of GPollFD records which have
failed (G_IO_ERR). If everything is fine, you return 0. For any other error
which makes this function fail, you return -1
(But I must admit I never used this directly)
It is so great seeing someone building DBus bindings for Pascal! I
requested this years ago, and finally it happens! (There are great
use-cases for this, even if I won't use it in Listaller directly anymore)
Regards
  Matthias





More information about the fpc-pascal mailing list