Re: [Vala] timers with callbacks
- From: Jürg Billeter <j bitron ch>
- To: Sam Liddicott <sam liddicott com>
- Cc: vala-list gnome org
- Subject: Re: [Vala] timers with callbacks
- Date: Tue, 17 Jun 2008 22:49:18 +0200
On Tue, 2008-06-17 at 19:59 +0100, Sam Liddicott wrote:
I've grep'd all my vapi files and can't find any timer classes that
provide callbacks, can anyone help?
I've seen the example at: http://live.gnome.org/Vala/Tutorial
but O'm just running Gtk.main, not making a loop, so I don't have
anything to time.attach to.
Gtk.main uses a mainloop, so you can use something as follows:
Timeout.add (interval, callback);
I've also modified the vala glade demo to make connect_signals more
reasonable:
if (!module.symbol ("glade_phone_ui_" + handler_name, out sym)
&& !module.symbol (handler_name, out sym)) {
Of course "glade_phone_ui" is my namespace hierachy, but is there a
magical preprocessor token to pull out the current namespace hierachy
prefix to save me hard wiring it? That would be a reasonable change to
the glade example.
No, that's not possible at the moment. It would be nice if we find a
convenient solution for this - I'd focus on GtkBuilder instead of Glade,
though.
Finally, (cos I'm an old Delphi nut) I want to extend the
connect_signals stuff to connect more than signals, but also widget
names, so I'll be pulling back all widget names, and then looking for
exported symbols in a similar manner; however I guess I should be doing
some RTTI stuff to make sure the symbol I'm about to populate is of the
right types. Any clues?? I'll do it typeless for now.
I'm annoyed that this C syntax isn't supported:
if (this.module = Module.open (null, ModuleFlags.BIND_LAZY)) {
That's by design, if expects a boolean condition and this.module is
certainly not a boolean.
However this doesn't work either:
if ((this.module = Module.open (null,
ModuleFlags.BIND_LAZY))!=NULL) {
I've not managed to find the equivalent for NULL checking yet. (This was
to save re-opening module for every attached signal).
`NULL' in C is `null' in Vala
Jürg
--
Jürg Billeter <j bitron ch>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]