gotk4 icon indicating copy to clipboard operation
gotk4 copied to clipboard

Deprecate Object.Connect

Open diamondburned opened this issue 3 years ago • 0 comments

This issue tracks the progress for deprecating the (*glib.Object).Connect and (*glib.Object).ConnectAfter methods, reason being that they're not needed anymore with autogenerated signal methods (which are more performant and correct).

  • [ ] Find a way to specify ConnectAfter
    • [ ] Consider generating ConnectAfter methods instead, but that might bloat up documentation.
    • [ ] Consider explicit flags: w.ConnectHide(0, func() {})
    • [ ] Evaluate if function flags is a better idea:
func (w *Widget) ConnectHide(f func(), flags ...externglib.ConnectFlags)

w.ConnectHide(func() {
    // Might look too ugly.
}, glib.ConnectAfter)
  • [ ] Consider autogenerating Connect methods that allow eliding arguments:
    • Will mostly help easing the transition from traditional Connect methods.
func (w *Widget) ConnectHide()

switch f := getFunc().(type) {
case func():
    f()
case func(label string):
    f(label)
case func(label string, target *gdk.Drop):
    f(label, target)
}
  • [ ] Add a Notify function for notify:: signals:
// Notify connects f to the "notify" signal for the given property. f will be
// called every time the property's value is changed.
func (o *Object) Notify(property string, f func())
  • [ ] Deduplicate the callback for signals with the signature func()
    • These are super common, so doing this will remove lots of repetitive code.
  • [ ] Remove pkg gobject-introspection
    • We don't need this once we stop generating _get_type() marshalers.

diamondburned avatar Feb 19 '22 23:02 diamondburned