gir.core icon indicating copy to clipboard operation
gir.core copied to clipboard

Support generating interface signals

Open cameronwhite opened this issue 1 year ago • 2 comments

When porting some Pinta code to Gtk.ListView I couldn't find Gtk.SingleSelection.OnSelectionChanged. I think this is likely because this is an interface signal from Gtk.SelectionModel (https://docs.gtk.org/gtk4/signal.SelectionModel.selection-changed.html) which doesn't seem to have any support currently

cameronwhite avatar Mar 15 '23 03:03 cameronwhite

Ah yes there is no signal support for interfaces available anywhere not even in the class for the gir/xml: https://github.com/gircore/gir.core/blob/main/src/Generation/GirLoader/Input/Interface.cs

badcel avatar Mar 15 '23 05:03 badcel

I hit the same thing recently. I wanted to listen for the changed signal on an Adw.EntryRow, which is part of the Editable interface: https://docs.gtk.org/gtk4/signal.Editable.changed.html

@badcel suggested using GObject.Signal directly, which worked great:

var signal = new Signal<EntryRow>("changed", "changed");
signal.Connect(_name, (_, _) => Console.WriteLine("Hello!"));

Daniel15 avatar Jul 20 '24 23:07 Daniel15