[Vala] How to override a "class closure for a signal"?




Hey all,

I have a subclass of Gtk.ListBox and I'm trying to override Gtk.Container::gtk_container_set_focus_child on it to prevent its default behaviour of automatically scrolling to the new focus child. The docs for that method say this:

This function emits the GtkContainer::set_focus_child signal of container. Implementations of GtkContainer can override the default behaviour by overriding the class closure of this signal.

How exactly do I do that? I tried overriding the method using:

public override void set_focus_child(Gtk.Widget? child) { ... }

But even if I do not chain up using a call to "base.set_focus_child(child)", it seems Gtk.Container's method is still invoked.

I also tried overriding the signal body using variously:

public override signal void set_focus_child(Gtk.Widget? child) { ... }
public new signal void set_focus_child(Gtk.Widget? child) { ... }

But then valac complains that it "hides inherited signal" in the first case and "Only virtual signals can have a default signal handler body" for both.

Any hints? Thanks!

//Mike

--
⊨ Michael Gratton, Percept Wrangler.
⚙ <http://mjog.vee.net/>




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]