gircore / gir.core

A C# binding generator for GObject based libraries providing a C# friendly API surface
https://gircore.github.io/
MIT License
314 stars 29 forks source link

Support generating interface signals #831

Open cameronwhite opened 1 year ago

cameronwhite commented 1 year ago

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

badcel commented 1 year ago

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

Daniel15 commented 3 months ago

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!"));