Gen: re-run gen script
- commit
- 42eb86ea7d14607789a5dc287ca02cc33bce5a1e
- author
- jwijenbergh · · 2024-03-05 12:03 UTC
- committer
- jwijenbergh · · 2024-03-05 12:07 UTC
- parent
- 867f32f
- signature
- GPG Unverified
1A2298F6C34F96E5The key is unknown
261 files · +6159 -2300
M v4/adw/adw-about-window.go +12 -3
| @@ -7,6 +7,7 @@ import ( | |||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | ||
| 10 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | 11 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 11 | "github.com/jwijenbergh/puregotk/v4/gsk" | 12 | "github.com/jwijenbergh/puregotk/v4/gsk" | ||
| 12 | "github.com/jwijenbergh/puregotk/v4/gtk" | 13 | "github.com/jwijenbergh/puregotk/v4/gtk" | ||
| @@ -905,15 +906,23 @@ func (c *AboutWindow) SetGoPointer(ptr uintptr) { | |||||
| 905 | // | 906 | // | ||
| 906 | // Applications may connect to it to override the default behavior, which is | 907 | // Applications may connect to it to override the default behavior, which is | ||
| 907 | // to call [func@Gtk.show_uri]. | 908 | // to call [func@Gtk.show_uri]. | ||
| 908 | - | func (x *AboutWindow) ConnectActivateLink(cb func(AboutWindow, string) bool) uint32 { | 909 | + | func (x *AboutWindow) ConnectActivateLink(cb *func(AboutWindow, string) bool) uint32 { |
| 910 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 911 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 912 | + | return gobject.SignalConnect(x.GoPointer(), "activate-link", cbRefPtr) | |||
| 913 | + | } | |||
| 914 | + | ||||
| 909 | fcb := func(clsPtr uintptr, UriVarp string) bool { | 915 | fcb := func(clsPtr uintptr, UriVarp string) bool { | ||
| 910 | fa := AboutWindow{} | 916 | fa := AboutWindow{} | ||
| 911 | fa.Ptr = clsPtr | 917 | fa.Ptr = clsPtr | ||
| 918 | + | cbFn := *cb | |||
| 912 | 919 | ||||
| 913 | - | return cb(fa, UriVarp) | 920 | + | return cbFn(fa, UriVarp) |
| 914 | 921 | ||||
| 915 | } | 922 | } | ||
| 916 | - | return gobject.SignalConnect(x.GoPointer(), "activate-link", purego.NewCallback(fcb)) | 923 | + | cbRefPtr := purego.NewCallback(fcb) |
| 924 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 925 | + | return gobject.SignalConnect(x.GoPointer(), "activate-link", cbRefPtr) | |||
| 917 | } | 926 | } | ||
| 918 | 927 | ||||
| 919 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 928 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/adw/adw-action-row.go +11 -3
| @@ -265,15 +265,23 @@ func (c *ActionRow) SetGoPointer(ptr uintptr) { | |||||
| 265 | } | 265 | } | ||
| 266 | 266 | ||||
| 267 | // This signal is emitted after the row has been activated. | 267 | // This signal is emitted after the row has been activated. | ||
| 268 | - | func (x *ActionRow) ConnectActivated(cb func(ActionRow)) uint32 { | 268 | + | func (x *ActionRow) ConnectActivated(cb *func(ActionRow)) uint32 { |
| 269 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 270 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 271 | + | return gobject.SignalConnect(x.GoPointer(), "activated", cbRefPtr) | |||
| 272 | + | } | |||
| 273 | + | ||||
| 269 | fcb := func(clsPtr uintptr) { | 274 | fcb := func(clsPtr uintptr) { | ||
| 270 | fa := ActionRow{} | 275 | fa := ActionRow{} | ||
| 271 | fa.Ptr = clsPtr | 276 | fa.Ptr = clsPtr | ||
| 277 | + | cbFn := *cb | |||
| 272 | 278 | ||||
| 273 | - | cb(fa) | 279 | + | cbFn(fa) |
| 274 | 280 | ||||
| 275 | } | 281 | } | ||
| 276 | - | return gobject.SignalConnect(x.GoPointer(), "activated", purego.NewCallback(fcb)) | 282 | + | cbRefPtr := purego.NewCallback(fcb) |
| 283 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 284 | + | return gobject.SignalConnect(x.GoPointer(), "activated", cbRefPtr) | |||
| 277 | } | 285 | } | ||
| 278 | 286 | ||||
| 279 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 287 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/adw/adw-animation-target.go +2 -2
| @@ -69,10 +69,10 @@ var xNewCallbackAnimationTarget func(uintptr, uintptr, uintptr) uintptr | |||||
| 69 | 69 | ||||
| 70 | // Creates a new `AdwAnimationTarget` that calls the given @callback during | 70 | // Creates a new `AdwAnimationTarget` that calls the given @callback during | ||
| 71 | // the animation. | 71 | // the animation. | ||
| 72 | - | func NewCallbackAnimationTarget(CallbackVar AnimationTargetFunc, UserDataVar uintptr, DestroyVar glib.DestroyNotify) *CallbackAnimationTarget { | 72 | + | func NewCallbackAnimationTarget(CallbackVar *AnimationTargetFunc, UserDataVar uintptr, DestroyVar *glib.DestroyNotify) *CallbackAnimationTarget { |
| 73 | var cls *CallbackAnimationTarget | 73 | var cls *CallbackAnimationTarget | ||
| 74 | 74 | ||||
| 75 | - | cret := xNewCallbackAnimationTarget(purego.NewCallback(CallbackVar), UserDataVar, purego.NewCallback(DestroyVar)) | 75 | + | cret := xNewCallbackAnimationTarget(glib.NewCallback(CallbackVar), UserDataVar, glib.NewCallback(DestroyVar)) |
| 76 | 76 | ||||
| 77 | if cret == 0 { | 77 | if cret == 0 { | ||
| 78 | return nil | 78 | return nil | ||
M v4/adw/adw-animation.go +12 -3
| @@ -6,6 +6,7 @@ import ( | |||||
| 6 | 6 | ||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 9 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 10 | "github.com/jwijenbergh/puregotk/v4/gtk" | 11 | "github.com/jwijenbergh/puregotk/v4/gtk" | ||
| 11 | ) | 12 | ) | ||
| @@ -285,15 +286,23 @@ func (c *Animation) SetGoPointer(ptr uintptr) { | |||||
| 285 | 286 | ||||
| 286 | // This signal is emitted when the animation has been completed, either on its | 287 | // This signal is emitted when the animation has been completed, either on its | ||
| 287 | // own or via calling [method@Animation.skip]. | 288 | // own or via calling [method@Animation.skip]. | ||
| 288 | - | func (x *Animation) ConnectDone(cb func(Animation)) uint32 { | 289 | + | func (x *Animation) ConnectDone(cb *func(Animation)) uint32 { |
| 290 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 291 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 292 | + | return gobject.SignalConnect(x.GoPointer(), "done", cbRefPtr) | |||
| 293 | + | } | |||
| 294 | + | ||||
| 289 | fcb := func(clsPtr uintptr) { | 295 | fcb := func(clsPtr uintptr) { | ||
| 290 | fa := Animation{} | 296 | fa := Animation{} | ||
| 291 | fa.Ptr = clsPtr | 297 | fa.Ptr = clsPtr | ||
| 298 | + | cbFn := *cb | |||
| 292 | 299 | ||||
| 293 | - | cb(fa) | 300 | + | cbFn(fa) |
| 294 | 301 | ||||
| 295 | } | 302 | } | ||
| 296 | - | return gobject.SignalConnect(x.GoPointer(), "done", purego.NewCallback(fcb)) | 303 | + | cbRefPtr := purego.NewCallback(fcb) |
| 304 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 305 | + | return gobject.SignalConnect(x.GoPointer(), "done", cbRefPtr) | |||
| 297 | } | 306 | } | ||
| 298 | 307 | ||||
| 299 | func init() { | 308 | func init() { | ||
M v4/adw/adw-banner.go +11 -3
| @@ -162,15 +162,23 @@ func (c *Banner) SetGoPointer(ptr uintptr) { | |||||
| 162 | // This signal is emitted after the action button has been clicked. | 162 | // This signal is emitted after the action button has been clicked. | ||
| 163 | // | 163 | // | ||
| 164 | // It can be used as an alternative to setting an action. | 164 | // It can be used as an alternative to setting an action. | ||
| 165 | - | func (x *Banner) ConnectButtonClicked(cb func(Banner)) uint32 { | 165 | + | func (x *Banner) ConnectButtonClicked(cb *func(Banner)) uint32 { |
| 166 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 167 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 168 | + | return gobject.SignalConnect(x.GoPointer(), "button-clicked", cbRefPtr) | |||
| 169 | + | } | |||
| 170 | + | ||||
| 166 | fcb := func(clsPtr uintptr) { | 171 | fcb := func(clsPtr uintptr) { | ||
| 167 | fa := Banner{} | 172 | fa := Banner{} | ||
| 168 | fa.Ptr = clsPtr | 173 | fa.Ptr = clsPtr | ||
| 174 | + | cbFn := *cb | |||
| 169 | 175 | ||||
| 170 | - | cb(fa) | 176 | + | cbFn(fa) |
| 171 | 177 | ||||
| 172 | } | 178 | } | ||
| 173 | - | return gobject.SignalConnect(x.GoPointer(), "button-clicked", purego.NewCallback(fcb)) | 179 | + | cbRefPtr := purego.NewCallback(fcb) |
| 180 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 181 | + | return gobject.SignalConnect(x.GoPointer(), "button-clicked", cbRefPtr) | |||
| 174 | } | 182 | } | ||
| 175 | 183 | ||||
| 176 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 184 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/adw/adw-carousel.go +12 -3
| @@ -7,6 +7,7 @@ import ( | |||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | ||
| 10 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | 11 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 11 | "github.com/jwijenbergh/puregotk/v4/gtk" | 12 | "github.com/jwijenbergh/puregotk/v4/gtk" | ||
| 12 | ) | 13 | ) | ||
| @@ -320,15 +321,23 @@ func (c *Carousel) SetGoPointer(ptr uintptr) { | |||||
| 320 | // It can be used to implement "infinite scrolling" by amending the pages | 321 | // It can be used to implement "infinite scrolling" by amending the pages | ||
| 321 | // after every scroll. Note that an empty carousel is indicated by | 322 | // after every scroll. Note that an empty carousel is indicated by | ||
| 322 | // `(int)index == -1`. | 323 | // `(int)index == -1`. | ||
| 323 | - | func (x *Carousel) ConnectPageChanged(cb func(Carousel, uint)) uint32 { | 324 | + | func (x *Carousel) ConnectPageChanged(cb *func(Carousel, uint)) uint32 { |
| 325 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 326 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 327 | + | return gobject.SignalConnect(x.GoPointer(), "page-changed", cbRefPtr) | |||
| 328 | + | } | |||
| 329 | + | ||||
| 324 | fcb := func(clsPtr uintptr, IndexVarp uint) { | 330 | fcb := func(clsPtr uintptr, IndexVarp uint) { | ||
| 325 | fa := Carousel{} | 331 | fa := Carousel{} | ||
| 326 | fa.Ptr = clsPtr | 332 | fa.Ptr = clsPtr | ||
| 333 | + | cbFn := *cb | |||
| 327 | 334 | ||||
| 328 | - | cb(fa, IndexVarp) | 335 | + | cbFn(fa, IndexVarp) |
| 329 | 336 | ||||
| 330 | } | 337 | } | ||
| 331 | - | return gobject.SignalConnect(x.GoPointer(), "page-changed", purego.NewCallback(fcb)) | 338 | + | cbRefPtr := purego.NewCallback(fcb) |
| 339 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 340 | + | return gobject.SignalConnect(x.GoPointer(), "page-changed", cbRefPtr) | |||
| 332 | } | 341 | } | ||
| 333 | 342 | ||||
| 334 | // Gets the progress @self will snap back to after the gesture is canceled. | 343 | // Gets the progress @self will snap back to after the gesture is canceled. | ||
M v4/adw/adw-entry-row.go +22 -6
| @@ -259,27 +259,43 @@ func (c *EntryRow) SetGoPointer(ptr uintptr) { | |||||
| 259 | // Emitted when the apply button is pressed. | 259 | // Emitted when the apply button is pressed. | ||
| 260 | // | 260 | // | ||
| 261 | // See [property@EntryRow:show-apply-button]. | 261 | // See [property@EntryRow:show-apply-button]. | ||
| 262 | - | func (x *EntryRow) ConnectApply(cb func(EntryRow)) uint32 { | 262 | + | func (x *EntryRow) ConnectApply(cb *func(EntryRow)) uint32 { |
| 263 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 264 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 265 | + | return gobject.SignalConnect(x.GoPointer(), "apply", cbRefPtr) | |||
| 266 | + | } | |||
| 267 | + | ||||
| 263 | fcb := func(clsPtr uintptr) { | 268 | fcb := func(clsPtr uintptr) { | ||
| 264 | fa := EntryRow{} | 269 | fa := EntryRow{} | ||
| 265 | fa.Ptr = clsPtr | 270 | fa.Ptr = clsPtr | ||
| 271 | + | cbFn := *cb | |||
| 266 | 272 | ||||
| 267 | - | cb(fa) | 273 | + | cbFn(fa) |
| 268 | 274 | ||||
| 269 | } | 275 | } | ||
| 270 | - | return gobject.SignalConnect(x.GoPointer(), "apply", purego.NewCallback(fcb)) | 276 | + | cbRefPtr := purego.NewCallback(fcb) |
| 277 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 278 | + | return gobject.SignalConnect(x.GoPointer(), "apply", cbRefPtr) | |||
| 271 | } | 279 | } | ||
| 272 | 280 | ||||
| 273 | // Emitted when the embedded entry is activated. | 281 | // Emitted when the embedded entry is activated. | ||
| 274 | - | func (x *EntryRow) ConnectEntryActivated(cb func(EntryRow)) uint32 { | 282 | + | func (x *EntryRow) ConnectEntryActivated(cb *func(EntryRow)) uint32 { |
| 283 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 284 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 285 | + | return gobject.SignalConnect(x.GoPointer(), "entry-activated", cbRefPtr) | |||
| 286 | + | } | |||
| 287 | + | ||||
| 275 | fcb := func(clsPtr uintptr) { | 288 | fcb := func(clsPtr uintptr) { | ||
| 276 | fa := EntryRow{} | 289 | fa := EntryRow{} | ||
| 277 | fa.Ptr = clsPtr | 290 | fa.Ptr = clsPtr | ||
| 291 | + | cbFn := *cb | |||
| 278 | 292 | ||||
| 279 | - | cb(fa) | 293 | + | cbFn(fa) |
| 280 | 294 | ||||
| 281 | } | 295 | } | ||
| 282 | - | return gobject.SignalConnect(x.GoPointer(), "entry-activated", purego.NewCallback(fcb)) | 296 | + | cbRefPtr := purego.NewCallback(fcb) |
| 297 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 298 | + | return gobject.SignalConnect(x.GoPointer(), "entry-activated", cbRefPtr) | |||
| 283 | } | 299 | } | ||
| 284 | 300 | ||||
| 285 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 301 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/adw/adw-message-dialog.go +14 -5
| @@ -8,6 +8,7 @@ import ( | |||||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | ||
| 10 | "github.com/jwijenbergh/puregotk/v4/gio" | 10 | "github.com/jwijenbergh/puregotk/v4/gio" | ||
| 11 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 11 | "github.com/jwijenbergh/puregotk/v4/gobject" | 12 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 12 | "github.com/jwijenbergh/puregotk/v4/gsk" | 13 | "github.com/jwijenbergh/puregotk/v4/gsk" | ||
| 13 | "github.com/jwijenbergh/puregotk/v4/gtk" | 14 | "github.com/jwijenbergh/puregotk/v4/gtk" | ||
| @@ -278,9 +279,9 @@ var xMessageDialogChoose func(uintptr, uintptr, uintptr, uintptr) | |||||
| 278 | // | 279 | // | ||
| 279 | // The @callback will be called when the alert is dismissed. It should call | 280 | // The @callback will be called when the alert is dismissed. It should call | ||
| 280 | // [method@MessageDialog.choose_finish] to obtain the result. | 281 | // [method@MessageDialog.choose_finish] to obtain the result. | ||
| 281 | - | func (x *MessageDialog) Choose(CancellableVar *gio.Cancellable, CallbackVar gio.AsyncReadyCallback, UserDataVar uintptr) { | 282 | + | func (x *MessageDialog) Choose(CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) { |
| 282 | 283 | ||||
| 283 | - | xMessageDialogChoose(x.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 284 | + | xMessageDialogChoose(x.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 284 | 285 | ||||
| 285 | } | 286 | } | ||
| 286 | 287 | ||||
| @@ -627,15 +628,23 @@ func (c *MessageDialog) SetGoPointer(ptr uintptr) { | |||||
| 627 | // if the dialog was closed by pressing <kbd>Escape</kbd> or with a system | 628 | // if the dialog was closed by pressing <kbd>Escape</kbd> or with a system | ||
| 628 | // action, @response will be set to the value of | 629 | // action, @response will be set to the value of | ||
| 629 | // [property@MessageDialog:close-response]. | 630 | // [property@MessageDialog:close-response]. | ||
| 630 | - | func (x *MessageDialog) ConnectResponse(cb func(MessageDialog, string)) uint32 { | 631 | + | func (x *MessageDialog) ConnectResponse(cb *func(MessageDialog, string)) uint32 { |
| 632 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 633 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 634 | + | return gobject.SignalConnect(x.GoPointer(), "response", cbRefPtr) | |||
| 635 | + | } | |||
| 636 | + | ||||
| 631 | fcb := func(clsPtr uintptr, ResponseVarp string) { | 637 | fcb := func(clsPtr uintptr, ResponseVarp string) { | ||
| 632 | fa := MessageDialog{} | 638 | fa := MessageDialog{} | ||
| 633 | fa.Ptr = clsPtr | 639 | fa.Ptr = clsPtr | ||
| 640 | + | cbFn := *cb | |||
| 634 | 641 | ||||
| 635 | - | cb(fa, ResponseVarp) | 642 | + | cbFn(fa, ResponseVarp) |
| 636 | 643 | ||||
| 637 | } | 644 | } | ||
| 638 | - | return gobject.SignalConnect(x.GoPointer(), "response", purego.NewCallback(fcb)) | 645 | + | cbRefPtr := purego.NewCallback(fcb) |
| 646 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 647 | + | return gobject.SignalConnect(x.GoPointer(), "response", cbRefPtr) | |||
| 639 | } | 648 | } | ||
| 640 | 649 | ||||
| 641 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 650 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/adw/adw-split-button.go +22 -6
| @@ -319,27 +319,43 @@ func (c *SplitButton) SetGoPointer(ptr uintptr) { | |||||
| 319 | // | 319 | // | ||
| 320 | // This is an action signal. Applications should never connect to this signal, | 320 | // This is an action signal. Applications should never connect to this signal, | ||
| 321 | // but use the [signal@SplitButton::clicked] signal. | 321 | // but use the [signal@SplitButton::clicked] signal. | ||
| 322 | - | func (x *SplitButton) ConnectActivate(cb func(SplitButton)) uint32 { | 322 | + | func (x *SplitButton) ConnectActivate(cb *func(SplitButton)) uint32 { |
| 323 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 324 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 325 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 326 | + | } | |||
| 327 | + | ||||
| 323 | fcb := func(clsPtr uintptr) { | 328 | fcb := func(clsPtr uintptr) { | ||
| 324 | fa := SplitButton{} | 329 | fa := SplitButton{} | ||
| 325 | fa.Ptr = clsPtr | 330 | fa.Ptr = clsPtr | ||
| 331 | + | cbFn := *cb | |||
| 326 | 332 | ||||
| 327 | - | cb(fa) | 333 | + | cbFn(fa) |
| 328 | 334 | ||||
| 329 | } | 335 | } | ||
| 330 | - | return gobject.SignalConnect(x.GoPointer(), "activate", purego.NewCallback(fcb)) | 336 | + | cbRefPtr := purego.NewCallback(fcb) |
| 337 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 338 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 331 | } | 339 | } | ||
| 332 | 340 | ||||
| 333 | // Emitted when the button has been activated (pressed and released). | 341 | // Emitted when the button has been activated (pressed and released). | ||
| 334 | - | func (x *SplitButton) ConnectClicked(cb func(SplitButton)) uint32 { | 342 | + | func (x *SplitButton) ConnectClicked(cb *func(SplitButton)) uint32 { |
| 343 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 344 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 345 | + | return gobject.SignalConnect(x.GoPointer(), "clicked", cbRefPtr) | |||
| 346 | + | } | |||
| 347 | + | ||||
| 335 | fcb := func(clsPtr uintptr) { | 348 | fcb := func(clsPtr uintptr) { | ||
| 336 | fa := SplitButton{} | 349 | fa := SplitButton{} | ||
| 337 | fa.Ptr = clsPtr | 350 | fa.Ptr = clsPtr | ||
| 351 | + | cbFn := *cb | |||
| 338 | 352 | ||||
| 339 | - | cb(fa) | 353 | + | cbFn(fa) |
| 340 | 354 | ||||
| 341 | } | 355 | } | ||
| 342 | - | return gobject.SignalConnect(x.GoPointer(), "clicked", purego.NewCallback(fcb)) | 356 | + | cbRefPtr := purego.NewCallback(fcb) |
| 357 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 358 | + | return gobject.SignalConnect(x.GoPointer(), "clicked", cbRefPtr) | |||
| 343 | } | 359 | } | ||
| 344 | 360 | ||||
| 345 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 361 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/adw/adw-swipe-tracker.go +45 -12
| @@ -6,6 +6,7 @@ import ( | |||||
| 6 | 6 | ||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 9 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 10 | "github.com/jwijenbergh/puregotk/v4/gtk" | 11 | "github.com/jwijenbergh/puregotk/v4/gtk" | ||
| 11 | ) | 12 | ) | ||
| @@ -174,15 +175,23 @@ func (c *SwipeTracker) SetGoPointer(ptr uintptr) { | |||||
| 174 | 175 | ||||
| 175 | // This signal is emitted right before a swipe will be started, after the | 176 | // This signal is emitted right before a swipe will be started, after the | ||
| 176 | // drag threshold has been passed. | 177 | // drag threshold has been passed. | ||
| 177 | - | func (x *SwipeTracker) ConnectBeginSwipe(cb func(SwipeTracker)) uint32 { | 178 | + | func (x *SwipeTracker) ConnectBeginSwipe(cb *func(SwipeTracker)) uint32 { |
| 179 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 180 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 181 | + | return gobject.SignalConnect(x.GoPointer(), "begin-swipe", cbRefPtr) | |||
| 182 | + | } | |||
| 183 | + | ||||
| 178 | fcb := func(clsPtr uintptr) { | 184 | fcb := func(clsPtr uintptr) { | ||
| 179 | fa := SwipeTracker{} | 185 | fa := SwipeTracker{} | ||
| 180 | fa.Ptr = clsPtr | 186 | fa.Ptr = clsPtr | ||
| 187 | + | cbFn := *cb | |||
| 181 | 188 | ||||
| 182 | - | cb(fa) | 189 | + | cbFn(fa) |
| 183 | 190 | ||||
| 184 | } | 191 | } | ||
| 185 | - | return gobject.SignalConnect(x.GoPointer(), "begin-swipe", purego.NewCallback(fcb)) | 192 | + | cbRefPtr := purego.NewCallback(fcb) |
| 193 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 194 | + | return gobject.SignalConnect(x.GoPointer(), "begin-swipe", cbRefPtr) | |||
| 186 | } | 195 | } | ||
| 187 | 196 | ||||
| 188 | // This signal is emitted as soon as the gesture has stopped. | 197 | // This signal is emitted as soon as the gesture has stopped. | ||
| @@ -191,42 +200,66 @@ func (x *SwipeTracker) ConnectBeginSwipe(cb func(SwipeTracker)) uint32 { | |||||
| 191 | // value to @to with an animation using @velocity as the initial velocity, | 200 | // value to @to with an animation using @velocity as the initial velocity, | ||
| 192 | // provided in pixels per second. [class@SpringAnimation] is usually a good | 201 | // provided in pixels per second. [class@SpringAnimation] is usually a good | ||
| 193 | // fit for this. | 202 | // fit for this. | ||
| 194 | - | func (x *SwipeTracker) ConnectEndSwipe(cb func(SwipeTracker, float64, float64)) uint32 { | 203 | + | func (x *SwipeTracker) ConnectEndSwipe(cb *func(SwipeTracker, float64, float64)) uint32 { |
| 204 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 205 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 206 | + | return gobject.SignalConnect(x.GoPointer(), "end-swipe", cbRefPtr) | |||
| 207 | + | } | |||
| 208 | + | ||||
| 195 | fcb := func(clsPtr uintptr, VelocityVarp float64, ToVarp float64) { | 209 | fcb := func(clsPtr uintptr, VelocityVarp float64, ToVarp float64) { | ||
| 196 | fa := SwipeTracker{} | 210 | fa := SwipeTracker{} | ||
| 197 | fa.Ptr = clsPtr | 211 | fa.Ptr = clsPtr | ||
| 212 | + | cbFn := *cb | |||
| 198 | 213 | ||||
| 199 | - | cb(fa, VelocityVarp, ToVarp) | 214 | + | cbFn(fa, VelocityVarp, ToVarp) |
| 200 | 215 | ||||
| 201 | } | 216 | } | ||
| 202 | - | return gobject.SignalConnect(x.GoPointer(), "end-swipe", purego.NewCallback(fcb)) | 217 | + | cbRefPtr := purego.NewCallback(fcb) |
| 218 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 219 | + | return gobject.SignalConnect(x.GoPointer(), "end-swipe", cbRefPtr) | |||
| 203 | } | 220 | } | ||
| 204 | 221 | ||||
| 205 | // This signal is emitted when a possible swipe is detected. | 222 | // This signal is emitted when a possible swipe is detected. | ||
| 206 | // | 223 | // | ||
| 207 | // The @direction value can be used to restrict the swipe to a certain | 224 | // The @direction value can be used to restrict the swipe to a certain | ||
| 208 | // direction. | 225 | // direction. | ||
| 209 | - | func (x *SwipeTracker) ConnectPrepare(cb func(SwipeTracker, NavigationDirection)) uint32 { | 226 | + | func (x *SwipeTracker) ConnectPrepare(cb *func(SwipeTracker, NavigationDirection)) uint32 { |
| 227 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 228 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 229 | + | return gobject.SignalConnect(x.GoPointer(), "prepare", cbRefPtr) | |||
| 230 | + | } | |||
| 231 | + | ||||
| 210 | fcb := func(clsPtr uintptr, DirectionVarp NavigationDirection) { | 232 | fcb := func(clsPtr uintptr, DirectionVarp NavigationDirection) { | ||
| 211 | fa := SwipeTracker{} | 233 | fa := SwipeTracker{} | ||
| 212 | fa.Ptr = clsPtr | 234 | fa.Ptr = clsPtr | ||
| 235 | + | cbFn := *cb | |||
| 213 | 236 | ||||
| 214 | - | cb(fa, DirectionVarp) | 237 | + | cbFn(fa, DirectionVarp) |
| 215 | 238 | ||||
| 216 | } | 239 | } | ||
| 217 | - | return gobject.SignalConnect(x.GoPointer(), "prepare", purego.NewCallback(fcb)) | 240 | + | cbRefPtr := purego.NewCallback(fcb) |
| 241 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 242 | + | return gobject.SignalConnect(x.GoPointer(), "prepare", cbRefPtr) | |||
| 218 | } | 243 | } | ||
| 219 | 244 | ||||
| 220 | // This signal is emitted every time the progress value changes. | 245 | // This signal is emitted every time the progress value changes. | ||
| 221 | - | func (x *SwipeTracker) ConnectUpdateSwipe(cb func(SwipeTracker, float64)) uint32 { | 246 | + | func (x *SwipeTracker) ConnectUpdateSwipe(cb *func(SwipeTracker, float64)) uint32 { |
| 247 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 248 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 249 | + | return gobject.SignalConnect(x.GoPointer(), "update-swipe", cbRefPtr) | |||
| 250 | + | } | |||
| 251 | + | ||||
| 222 | fcb := func(clsPtr uintptr, ProgressVarp float64) { | 252 | fcb := func(clsPtr uintptr, ProgressVarp float64) { | ||
| 223 | fa := SwipeTracker{} | 253 | fa := SwipeTracker{} | ||
| 224 | fa.Ptr = clsPtr | 254 | fa.Ptr = clsPtr | ||
| 255 | + | cbFn := *cb | |||
| 225 | 256 | ||||
| 226 | - | cb(fa, ProgressVarp) | 257 | + | cbFn(fa, ProgressVarp) |
| 227 | 258 | ||||
| 228 | } | 259 | } | ||
| 229 | - | return gobject.SignalConnect(x.GoPointer(), "update-swipe", purego.NewCallback(fcb)) | 260 | + | cbRefPtr := purego.NewCallback(fcb) |
| 261 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 262 | + | return gobject.SignalConnect(x.GoPointer(), "update-swipe", cbRefPtr) | |||
| 230 | } | 263 | } | ||
| 231 | 264 | ||||
| 232 | // Retrieves the orientation of the @orientable. | 265 | // Retrieves the orientation of the @orientable. | ||
M v4/adw/adw-tab-bar.go +23 -6
| @@ -7,6 +7,7 @@ import ( | |||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | ||
| 10 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | 11 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 11 | "github.com/jwijenbergh/puregotk/v4/gtk" | 12 | "github.com/jwijenbergh/puregotk/v4/gtk" | ||
| 12 | ) | 13 | ) | ||
| @@ -286,15 +287,23 @@ func (c *TabBar) SetGoPointer(ptr uintptr) { | |||||
| 286 | // [method@TabBar.setup_extra_drop_target]. | 287 | // [method@TabBar.setup_extra_drop_target]. | ||
| 287 | // | 288 | // | ||
| 288 | // See [signal@Gtk.DropTarget::drop]. | 289 | // See [signal@Gtk.DropTarget::drop]. | ||
| 289 | - | func (x *TabBar) ConnectExtraDragDrop(cb func(TabBar, uintptr, uintptr) bool) uint32 { | 290 | + | func (x *TabBar) ConnectExtraDragDrop(cb *func(TabBar, uintptr, uintptr) bool) uint32 { |
| 291 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 292 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 293 | + | return gobject.SignalConnect(x.GoPointer(), "extra-drag-drop", cbRefPtr) | |||
| 294 | + | } | |||
| 295 | + | ||||
| 290 | fcb := func(clsPtr uintptr, PageVarp uintptr, ValueVarp uintptr) bool { | 296 | fcb := func(clsPtr uintptr, PageVarp uintptr, ValueVarp uintptr) bool { | ||
| 291 | fa := TabBar{} | 297 | fa := TabBar{} | ||
| 292 | fa.Ptr = clsPtr | 298 | fa.Ptr = clsPtr | ||
| 299 | + | cbFn := *cb | |||
| 293 | 300 | ||||
| 294 | - | return cb(fa, PageVarp, ValueVarp) | 301 | + | return cbFn(fa, PageVarp, ValueVarp) |
| 295 | 302 | ||||
| 296 | } | 303 | } | ||
| 297 | - | return gobject.SignalConnect(x.GoPointer(), "extra-drag-drop", purego.NewCallback(fcb)) | 304 | + | cbRefPtr := purego.NewCallback(fcb) |
| 305 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 306 | + | return gobject.SignalConnect(x.GoPointer(), "extra-drag-drop", cbRefPtr) | |||
| 298 | } | 307 | } | ||
| 299 | 308 | ||||
| 300 | // This signal is emitted when the dropped content is preloaded. | 309 | // This signal is emitted when the dropped content is preloaded. | ||
| @@ -306,15 +315,23 @@ func (x *TabBar) ConnectExtraDragDrop(cb func(TabBar, uintptr, uintptr) bool) ui | |||||
| 306 | // [method@TabBar.setup_extra_drop_target]. | 315 | // [method@TabBar.setup_extra_drop_target]. | ||
| 307 | // | 316 | // | ||
| 308 | // See [property@Gtk.DropTarget:value]. | 317 | // See [property@Gtk.DropTarget:value]. | ||
| 309 | - | func (x *TabBar) ConnectExtraDragValue(cb func(TabBar, uintptr, uintptr) gdk.DragAction) uint32 { | 318 | + | func (x *TabBar) ConnectExtraDragValue(cb *func(TabBar, uintptr, uintptr) gdk.DragAction) uint32 { |
| 319 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 320 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 321 | + | return gobject.SignalConnect(x.GoPointer(), "extra-drag-value", cbRefPtr) | |||
| 322 | + | } | |||
| 323 | + | ||||
| 310 | fcb := func(clsPtr uintptr, PageVarp uintptr, ValueVarp uintptr) gdk.DragAction { | 324 | fcb := func(clsPtr uintptr, PageVarp uintptr, ValueVarp uintptr) gdk.DragAction { | ||
| 311 | fa := TabBar{} | 325 | fa := TabBar{} | ||
| 312 | fa.Ptr = clsPtr | 326 | fa.Ptr = clsPtr | ||
| 327 | + | cbFn := *cb | |||
| 313 | 328 | ||||
| 314 | - | return cb(fa, PageVarp, ValueVarp) | 329 | + | return cbFn(fa, PageVarp, ValueVarp) |
| 315 | 330 | ||||
| 316 | } | 331 | } | ||
| 317 | - | return gobject.SignalConnect(x.GoPointer(), "extra-drag-value", purego.NewCallback(fcb)) | 332 | + | cbRefPtr := purego.NewCallback(fcb) |
| 333 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 334 | + | return gobject.SignalConnect(x.GoPointer(), "extra-drag-value", cbRefPtr) | |||
| 318 | } | 335 | } | ||
| 319 | 336 | ||||
| 320 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 337 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/adw/adw-tab-button.go +22 -6
| @@ -116,27 +116,43 @@ func (c *TabButton) SetGoPointer(ptr uintptr) { | |||||
| 116 | // | 116 | // | ||
| 117 | // This is an action signal. Applications should never connect to this signal, | 117 | // This is an action signal. Applications should never connect to this signal, | ||
| 118 | // but use the [signal@TabButton::clicked] signal. | 118 | // but use the [signal@TabButton::clicked] signal. | ||
| 119 | - | func (x *TabButton) ConnectActivate(cb func(TabButton)) uint32 { | 119 | + | func (x *TabButton) ConnectActivate(cb *func(TabButton)) uint32 { |
| 120 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 121 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 122 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 123 | + | } | |||
| 124 | + | ||||
| 120 | fcb := func(clsPtr uintptr) { | 125 | fcb := func(clsPtr uintptr) { | ||
| 121 | fa := TabButton{} | 126 | fa := TabButton{} | ||
| 122 | fa.Ptr = clsPtr | 127 | fa.Ptr = clsPtr | ||
| 128 | + | cbFn := *cb | |||
| 123 | 129 | ||||
| 124 | - | cb(fa) | 130 | + | cbFn(fa) |
| 125 | 131 | ||||
| 126 | } | 132 | } | ||
| 127 | - | return gobject.SignalConnect(x.GoPointer(), "activate", purego.NewCallback(fcb)) | 133 | + | cbRefPtr := purego.NewCallback(fcb) |
| 134 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 135 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 128 | } | 136 | } | ||
| 129 | 137 | ||||
| 130 | // Emitted when the button has been activated (pressed and released). | 138 | // Emitted when the button has been activated (pressed and released). | ||
| 131 | - | func (x *TabButton) ConnectClicked(cb func(TabButton)) uint32 { | 139 | + | func (x *TabButton) ConnectClicked(cb *func(TabButton)) uint32 { |
| 140 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 141 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 142 | + | return gobject.SignalConnect(x.GoPointer(), "clicked", cbRefPtr) | |||
| 143 | + | } | |||
| 144 | + | ||||
| 132 | fcb := func(clsPtr uintptr) { | 145 | fcb := func(clsPtr uintptr) { | ||
| 133 | fa := TabButton{} | 146 | fa := TabButton{} | ||
| 134 | fa.Ptr = clsPtr | 147 | fa.Ptr = clsPtr | ||
| 148 | + | cbFn := *cb | |||
| 135 | 149 | ||||
| 136 | - | cb(fa) | 150 | + | cbFn(fa) |
| 137 | 151 | ||||
| 138 | } | 152 | } | ||
| 139 | - | return gobject.SignalConnect(x.GoPointer(), "clicked", purego.NewCallback(fcb)) | 153 | + | cbRefPtr := purego.NewCallback(fcb) |
| 154 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 155 | + | return gobject.SignalConnect(x.GoPointer(), "clicked", cbRefPtr) | |||
| 140 | } | 156 | } | ||
| 141 | 157 | ||||
| 142 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 158 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/adw/adw-tab-overview.go +34 -9
| @@ -8,6 +8,7 @@ import ( | |||||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | ||
| 10 | "github.com/jwijenbergh/puregotk/v4/gio" | 10 | "github.com/jwijenbergh/puregotk/v4/gio" | ||
| 11 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 11 | "github.com/jwijenbergh/puregotk/v4/gobject" | 12 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 12 | "github.com/jwijenbergh/puregotk/v4/gtk" | 13 | "github.com/jwijenbergh/puregotk/v4/gtk" | ||
| 13 | ) | 14 | ) | ||
| @@ -379,16 +380,24 @@ func (c *TabOverview) SetGoPointer(ptr uintptr) { | |||||
| 379 | // | 380 | // | ||
| 380 | // The signal handler is expected to create a new page in the corresponding | 381 | // The signal handler is expected to create a new page in the corresponding | ||
| 381 | // [class@TabView] and return it. | 382 | // [class@TabView] and return it. | ||
| 382 | - | func (x *TabOverview) ConnectCreateTab(cb func(TabOverview) TabPage) uint32 { | 383 | + | func (x *TabOverview) ConnectCreateTab(cb *func(TabOverview) TabPage) uint32 { |
| 384 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 385 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 386 | + | return gobject.SignalConnect(x.GoPointer(), "create-tab", cbRefPtr) | |||
| 387 | + | } | |||
| 388 | + | ||||
| 383 | fcb := func(clsPtr uintptr) uintptr { | 389 | fcb := func(clsPtr uintptr) uintptr { | ||
| 384 | fa := TabOverview{} | 390 | fa := TabOverview{} | ||
| 385 | fa.Ptr = clsPtr | 391 | fa.Ptr = clsPtr | ||
| 392 | + | cbFn := *cb | |||
| 386 | 393 | ||||
| 387 | - | CreateTabCls := cb(fa) | 394 | + | CreateTabCls := cbFn(fa) |
| 388 | return CreateTabCls.Ptr | 395 | return CreateTabCls.Ptr | ||
| 389 | 396 | ||||
| 390 | } | 397 | } | ||
| 391 | - | return gobject.SignalConnect(x.GoPointer(), "create-tab", purego.NewCallback(fcb)) | 398 | + | cbRefPtr := purego.NewCallback(fcb) |
| 399 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 400 | + | return gobject.SignalConnect(x.GoPointer(), "create-tab", cbRefPtr) | |||
| 392 | } | 401 | } | ||
| 393 | 402 | ||||
| 394 | // This signal is emitted when content is dropped onto a tab. | 403 | // This signal is emitted when content is dropped onto a tab. | ||
| @@ -397,15 +406,23 @@ func (x *TabOverview) ConnectCreateTab(cb func(TabOverview) TabPage) uint32 { | |||||
| 397 | // [method@TabOverview.setup_extra_drop_target]. | 406 | // [method@TabOverview.setup_extra_drop_target]. | ||
| 398 | // | 407 | // | ||
| 399 | // See [signal@Gtk.DropTarget::drop]. | 408 | // See [signal@Gtk.DropTarget::drop]. | ||
| 400 | - | func (x *TabOverview) ConnectExtraDragDrop(cb func(TabOverview, uintptr, uintptr) bool) uint32 { | 409 | + | func (x *TabOverview) ConnectExtraDragDrop(cb *func(TabOverview, uintptr, uintptr) bool) uint32 { |
| 410 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 411 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 412 | + | return gobject.SignalConnect(x.GoPointer(), "extra-drag-drop", cbRefPtr) | |||
| 413 | + | } | |||
| 414 | + | ||||
| 401 | fcb := func(clsPtr uintptr, PageVarp uintptr, ValueVarp uintptr) bool { | 415 | fcb := func(clsPtr uintptr, PageVarp uintptr, ValueVarp uintptr) bool { | ||
| 402 | fa := TabOverview{} | 416 | fa := TabOverview{} | ||
| 403 | fa.Ptr = clsPtr | 417 | fa.Ptr = clsPtr | ||
| 418 | + | cbFn := *cb | |||
| 404 | 419 | ||||
| 405 | - | return cb(fa, PageVarp, ValueVarp) | 420 | + | return cbFn(fa, PageVarp, ValueVarp) |
| 406 | 421 | ||||
| 407 | } | 422 | } | ||
| 408 | - | return gobject.SignalConnect(x.GoPointer(), "extra-drag-drop", purego.NewCallback(fcb)) | 423 | + | cbRefPtr := purego.NewCallback(fcb) |
| 424 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 425 | + | return gobject.SignalConnect(x.GoPointer(), "extra-drag-drop", cbRefPtr) | |||
| 409 | } | 426 | } | ||
| 410 | 427 | ||||
| 411 | // This signal is emitted when the dropped content is preloaded. | 428 | // This signal is emitted when the dropped content is preloaded. | ||
| @@ -417,15 +434,23 @@ func (x *TabOverview) ConnectExtraDragDrop(cb func(TabOverview, uintptr, uintptr | |||||
| 417 | // [method@TabOverview.setup_extra_drop_target]. | 434 | // [method@TabOverview.setup_extra_drop_target]. | ||
| 418 | // | 435 | // | ||
| 419 | // See [property@Gtk.DropTarget:value]. | 436 | // See [property@Gtk.DropTarget:value]. | ||
| 420 | - | func (x *TabOverview) ConnectExtraDragValue(cb func(TabOverview, uintptr, uintptr) gdk.DragAction) uint32 { | 437 | + | func (x *TabOverview) ConnectExtraDragValue(cb *func(TabOverview, uintptr, uintptr) gdk.DragAction) uint32 { |
| 438 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 439 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 440 | + | return gobject.SignalConnect(x.GoPointer(), "extra-drag-value", cbRefPtr) | |||
| 441 | + | } | |||
| 442 | + | ||||
| 421 | fcb := func(clsPtr uintptr, PageVarp uintptr, ValueVarp uintptr) gdk.DragAction { | 443 | fcb := func(clsPtr uintptr, PageVarp uintptr, ValueVarp uintptr) gdk.DragAction { | ||
| 422 | fa := TabOverview{} | 444 | fa := TabOverview{} | ||
| 423 | fa.Ptr = clsPtr | 445 | fa.Ptr = clsPtr | ||
| 446 | + | cbFn := *cb | |||
| 424 | 447 | ||||
| 425 | - | return cb(fa, PageVarp, ValueVarp) | 448 | + | return cbFn(fa, PageVarp, ValueVarp) |
| 426 | 449 | ||||
| 427 | } | 450 | } | ||
| 428 | - | return gobject.SignalConnect(x.GoPointer(), "extra-drag-value", purego.NewCallback(fcb)) | 451 | + | cbRefPtr := purego.NewCallback(fcb) |
| 452 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 453 | + | return gobject.SignalConnect(x.GoPointer(), "extra-drag-value", cbRefPtr) | |||
| 429 | } | 454 | } | ||
| 430 | 455 | ||||
| 431 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 456 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/adw/adw-tab-view.go +78 -21
| @@ -7,6 +7,7 @@ import ( | |||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | "github.com/jwijenbergh/puregotk/v4/gio" | 9 | "github.com/jwijenbergh/puregotk/v4/gio" | ||
| 10 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | 11 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 11 | "github.com/jwijenbergh/puregotk/v4/gtk" | 12 | "github.com/jwijenbergh/puregotk/v4/gtk" | ||
| 12 | ) | 13 | ) | ||
| @@ -1300,15 +1301,23 @@ func (c *TabView) SetGoPointer(ptr uintptr) { | |||||
| 1300 | // | 1301 | // | ||
| 1301 | // A typical reason to connect to this signal is to show a confirmation dialog | 1302 | // A typical reason to connect to this signal is to show a confirmation dialog | ||
| 1302 | // for closing a tab. | 1303 | // for closing a tab. | ||
| 1303 | - | func (x *TabView) ConnectClosePage(cb func(TabView, uintptr) bool) uint32 { | 1304 | + | func (x *TabView) ConnectClosePage(cb *func(TabView, uintptr) bool) uint32 { |
| 1305 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1306 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1307 | + | return gobject.SignalConnect(x.GoPointer(), "close-page", cbRefPtr) | |||
| 1308 | + | } | |||
| 1309 | + | ||||
| 1304 | fcb := func(clsPtr uintptr, PageVarp uintptr) bool { | 1310 | fcb := func(clsPtr uintptr, PageVarp uintptr) bool { | ||
| 1305 | fa := TabView{} | 1311 | fa := TabView{} | ||
| 1306 | fa.Ptr = clsPtr | 1312 | fa.Ptr = clsPtr | ||
| 1313 | + | cbFn := *cb | |||
| 1307 | 1314 | ||||
| 1308 | - | return cb(fa, PageVarp) | 1315 | + | return cbFn(fa, PageVarp) |
| 1309 | 1316 | ||||
| 1310 | } | 1317 | } | ||
| 1311 | - | return gobject.SignalConnect(x.GoPointer(), "close-page", purego.NewCallback(fcb)) | 1318 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1319 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1320 | + | return gobject.SignalConnect(x.GoPointer(), "close-page", cbRefPtr) | |||
| 1312 | } | 1321 | } | ||
| 1313 | 1322 | ||||
| 1314 | // Emitted when a tab should be transferred into a new window. | 1323 | // Emitted when a tab should be transferred into a new window. | ||
| @@ -1317,46 +1326,70 @@ func (x *TabView) ConnectClosePage(cb func(TabView, uintptr) bool) uint32 { | |||||
| 1317 | // | 1326 | // | ||
| 1318 | // The signal handler is expected to create a new window, position it as | 1327 | // The signal handler is expected to create a new window, position it as | ||
| 1319 | // needed and return its `AdwTabView` that the page will be transferred into. | 1328 | // needed and return its `AdwTabView` that the page will be transferred into. | ||
| 1320 | - | func (x *TabView) ConnectCreateWindow(cb func(TabView) TabView) uint32 { | 1329 | + | func (x *TabView) ConnectCreateWindow(cb *func(TabView) TabView) uint32 { |
| 1330 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1331 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1332 | + | return gobject.SignalConnect(x.GoPointer(), "create-window", cbRefPtr) | |||
| 1333 | + | } | |||
| 1334 | + | ||||
| 1321 | fcb := func(clsPtr uintptr) uintptr { | 1335 | fcb := func(clsPtr uintptr) uintptr { | ||
| 1322 | fa := TabView{} | 1336 | fa := TabView{} | ||
| 1323 | fa.Ptr = clsPtr | 1337 | fa.Ptr = clsPtr | ||
| 1338 | + | cbFn := *cb | |||
| 1324 | 1339 | ||||
| 1325 | - | CreateWindowCls := cb(fa) | 1340 | + | CreateWindowCls := cbFn(fa) |
| 1326 | return CreateWindowCls.Ptr | 1341 | return CreateWindowCls.Ptr | ||
| 1327 | 1342 | ||||
| 1328 | } | 1343 | } | ||
| 1329 | - | return gobject.SignalConnect(x.GoPointer(), "create-window", purego.NewCallback(fcb)) | 1344 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1345 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1346 | + | return gobject.SignalConnect(x.GoPointer(), "create-window", cbRefPtr) | |||
| 1330 | } | 1347 | } | ||
| 1331 | 1348 | ||||
| 1332 | // Emitted after the indicator icon on @page has been activated. | 1349 | // Emitted after the indicator icon on @page has been activated. | ||
| 1333 | // | 1350 | // | ||
| 1334 | // See [property@TabPage:indicator-icon] and | 1351 | // See [property@TabPage:indicator-icon] and | ||
| 1335 | // [property@TabPage:indicator-activatable]. | 1352 | // [property@TabPage:indicator-activatable]. | ||
| 1336 | - | func (x *TabView) ConnectIndicatorActivated(cb func(TabView, uintptr)) uint32 { | 1353 | + | func (x *TabView) ConnectIndicatorActivated(cb *func(TabView, uintptr)) uint32 { |
| 1354 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1355 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1356 | + | return gobject.SignalConnect(x.GoPointer(), "indicator-activated", cbRefPtr) | |||
| 1357 | + | } | |||
| 1358 | + | ||||
| 1337 | fcb := func(clsPtr uintptr, PageVarp uintptr) { | 1359 | fcb := func(clsPtr uintptr, PageVarp uintptr) { | ||
| 1338 | fa := TabView{} | 1360 | fa := TabView{} | ||
| 1339 | fa.Ptr = clsPtr | 1361 | fa.Ptr = clsPtr | ||
| 1362 | + | cbFn := *cb | |||
| 1340 | 1363 | ||||
| 1341 | - | cb(fa, PageVarp) | 1364 | + | cbFn(fa, PageVarp) |
| 1342 | 1365 | ||||
| 1343 | } | 1366 | } | ||
| 1344 | - | return gobject.SignalConnect(x.GoPointer(), "indicator-activated", purego.NewCallback(fcb)) | 1367 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1368 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1369 | + | return gobject.SignalConnect(x.GoPointer(), "indicator-activated", cbRefPtr) | |||
| 1345 | } | 1370 | } | ||
| 1346 | 1371 | ||||
| 1347 | // Emitted when a page has been created or transferred to @self. | 1372 | // Emitted when a page has been created or transferred to @self. | ||
| 1348 | // | 1373 | // | ||
| 1349 | // A typical reason to connect to this signal would be to connect to page | 1374 | // A typical reason to connect to this signal would be to connect to page | ||
| 1350 | // signals for things such as updating window title. | 1375 | // signals for things such as updating window title. | ||
| 1351 | - | func (x *TabView) ConnectPageAttached(cb func(TabView, uintptr, int)) uint32 { | 1376 | + | func (x *TabView) ConnectPageAttached(cb *func(TabView, uintptr, int)) uint32 { |
| 1377 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1378 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1379 | + | return gobject.SignalConnect(x.GoPointer(), "page-attached", cbRefPtr) | |||
| 1380 | + | } | |||
| 1381 | + | ||||
| 1352 | fcb := func(clsPtr uintptr, PageVarp uintptr, PositionVarp int) { | 1382 | fcb := func(clsPtr uintptr, PageVarp uintptr, PositionVarp int) { | ||
| 1353 | fa := TabView{} | 1383 | fa := TabView{} | ||
| 1354 | fa.Ptr = clsPtr | 1384 | fa.Ptr = clsPtr | ||
| 1385 | + | cbFn := *cb | |||
| 1355 | 1386 | ||||
| 1356 | - | cb(fa, PageVarp, PositionVarp) | 1387 | + | cbFn(fa, PageVarp, PositionVarp) |
| 1357 | 1388 | ||||
| 1358 | } | 1389 | } | ||
| 1359 | - | return gobject.SignalConnect(x.GoPointer(), "page-attached", purego.NewCallback(fcb)) | 1390 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1391 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1392 | + | return gobject.SignalConnect(x.GoPointer(), "page-attached", cbRefPtr) | |||
| 1360 | } | 1393 | } | ||
| 1361 | 1394 | ||||
| 1362 | // Emitted when a page has been removed or transferred to another view. | 1395 | // Emitted when a page has been removed or transferred to another view. | ||
| @@ -1368,27 +1401,43 @@ func (x *TabView) ConnectPageAttached(cb func(TabView, uintptr, int)) uint32 { | |||||
| 1368 | // this function as the child might merely be moved to another window; use | 1401 | // this function as the child might merely be moved to another window; use | ||
| 1369 | // child dispose handler for that or do it in sync with your | 1402 | // child dispose handler for that or do it in sync with your | ||
| 1370 | // [method@TabView.close_page_finish] calls. | 1403 | // [method@TabView.close_page_finish] calls. | ||
| 1371 | - | func (x *TabView) ConnectPageDetached(cb func(TabView, uintptr, int)) uint32 { | 1404 | + | func (x *TabView) ConnectPageDetached(cb *func(TabView, uintptr, int)) uint32 { |
| 1405 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1406 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1407 | + | return gobject.SignalConnect(x.GoPointer(), "page-detached", cbRefPtr) | |||
| 1408 | + | } | |||
| 1409 | + | ||||
| 1372 | fcb := func(clsPtr uintptr, PageVarp uintptr, PositionVarp int) { | 1410 | fcb := func(clsPtr uintptr, PageVarp uintptr, PositionVarp int) { | ||
| 1373 | fa := TabView{} | 1411 | fa := TabView{} | ||
| 1374 | fa.Ptr = clsPtr | 1412 | fa.Ptr = clsPtr | ||
| 1413 | + | cbFn := *cb | |||
| 1375 | 1414 | ||||
| 1376 | - | cb(fa, PageVarp, PositionVarp) | 1415 | + | cbFn(fa, PageVarp, PositionVarp) |
| 1377 | 1416 | ||||
| 1378 | } | 1417 | } | ||
| 1379 | - | return gobject.SignalConnect(x.GoPointer(), "page-detached", purego.NewCallback(fcb)) | 1418 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1419 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1420 | + | return gobject.SignalConnect(x.GoPointer(), "page-detached", cbRefPtr) | |||
| 1380 | } | 1421 | } | ||
| 1381 | 1422 | ||||
| 1382 | // Emitted after @page has been reordered to @position. | 1423 | // Emitted after @page has been reordered to @position. | ||
| 1383 | - | func (x *TabView) ConnectPageReordered(cb func(TabView, uintptr, int)) uint32 { | 1424 | + | func (x *TabView) ConnectPageReordered(cb *func(TabView, uintptr, int)) uint32 { |
| 1425 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1426 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1427 | + | return gobject.SignalConnect(x.GoPointer(), "page-reordered", cbRefPtr) | |||
| 1428 | + | } | |||
| 1429 | + | ||||
| 1384 | fcb := func(clsPtr uintptr, PageVarp uintptr, PositionVarp int) { | 1430 | fcb := func(clsPtr uintptr, PageVarp uintptr, PositionVarp int) { | ||
| 1385 | fa := TabView{} | 1431 | fa := TabView{} | ||
| 1386 | fa.Ptr = clsPtr | 1432 | fa.Ptr = clsPtr | ||
| 1433 | + | cbFn := *cb | |||
| 1387 | 1434 | ||||
| 1388 | - | cb(fa, PageVarp, PositionVarp) | 1435 | + | cbFn(fa, PageVarp, PositionVarp) |
| 1389 | 1436 | ||||
| 1390 | } | 1437 | } | ||
| 1391 | - | return gobject.SignalConnect(x.GoPointer(), "page-reordered", purego.NewCallback(fcb)) | 1438 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1439 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1440 | + | return gobject.SignalConnect(x.GoPointer(), "page-reordered", cbRefPtr) | |||
| 1392 | } | 1441 | } | ||
| 1393 | 1442 | ||||
| 1394 | // Emitted when a context menu is opened or closed for @page. | 1443 | // Emitted when a context menu is opened or closed for @page. | ||
| @@ -1397,15 +1446,23 @@ func (x *TabView) ConnectPageReordered(cb func(TabView, uintptr, int)) uint32 { | |||||
| 1397 | // | 1446 | // | ||
| 1398 | // It can be used to set up menu actions before showing the menu, for example | 1447 | // It can be used to set up menu actions before showing the menu, for example | ||
| 1399 | // disable actions not applicable to @page. | 1448 | // disable actions not applicable to @page. | ||
| 1400 | - | func (x *TabView) ConnectSetupMenu(cb func(TabView, uintptr)) uint32 { | 1449 | + | func (x *TabView) ConnectSetupMenu(cb *func(TabView, uintptr)) uint32 { |
| 1450 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1451 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1452 | + | return gobject.SignalConnect(x.GoPointer(), "setup-menu", cbRefPtr) | |||
| 1453 | + | } | |||
| 1454 | + | ||||
| 1401 | fcb := func(clsPtr uintptr, PageVarp uintptr) { | 1455 | fcb := func(clsPtr uintptr, PageVarp uintptr) { | ||
| 1402 | fa := TabView{} | 1456 | fa := TabView{} | ||
| 1403 | fa.Ptr = clsPtr | 1457 | fa.Ptr = clsPtr | ||
| 1458 | + | cbFn := *cb | |||
| 1404 | 1459 | ||||
| 1405 | - | cb(fa, PageVarp) | 1460 | + | cbFn(fa, PageVarp) |
| 1406 | 1461 | ||||
| 1407 | } | 1462 | } | ||
| 1408 | - | return gobject.SignalConnect(x.GoPointer(), "setup-menu", purego.NewCallback(fcb)) | 1463 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1464 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1465 | + | return gobject.SignalConnect(x.GoPointer(), "setup-menu", cbRefPtr) | |||
| 1409 | } | 1466 | } | ||
| 1410 | 1467 | ||||
| 1411 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 1468 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/adw/adw-toast.go +22 -6
| @@ -440,27 +440,43 @@ func (c *Toast) SetGoPointer(ptr uintptr) { | |||||
| 440 | // Emitted after the button has been clicked. | 440 | // Emitted after the button has been clicked. | ||
| 441 | // | 441 | // | ||
| 442 | // It can be used as an alternative to setting an action. | 442 | // It can be used as an alternative to setting an action. | ||
| 443 | - | func (x *Toast) ConnectButtonClicked(cb func(Toast)) uint32 { | 443 | + | func (x *Toast) ConnectButtonClicked(cb *func(Toast)) uint32 { |
| 444 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 445 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 446 | + | return gobject.SignalConnect(x.GoPointer(), "button-clicked", cbRefPtr) | |||
| 447 | + | } | |||
| 448 | + | ||||
| 444 | fcb := func(clsPtr uintptr) { | 449 | fcb := func(clsPtr uintptr) { | ||
| 445 | fa := Toast{} | 450 | fa := Toast{} | ||
| 446 | fa.Ptr = clsPtr | 451 | fa.Ptr = clsPtr | ||
| 452 | + | cbFn := *cb | |||
| 447 | 453 | ||||
| 448 | - | cb(fa) | 454 | + | cbFn(fa) |
| 449 | 455 | ||||
| 450 | } | 456 | } | ||
| 451 | - | return gobject.SignalConnect(x.GoPointer(), "button-clicked", purego.NewCallback(fcb)) | 457 | + | cbRefPtr := purego.NewCallback(fcb) |
| 458 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 459 | + | return gobject.SignalConnect(x.GoPointer(), "button-clicked", cbRefPtr) | |||
| 452 | } | 460 | } | ||
| 453 | 461 | ||||
| 454 | // Emitted when the toast has been dismissed. | 462 | // Emitted when the toast has been dismissed. | ||
| 455 | - | func (x *Toast) ConnectDismissed(cb func(Toast)) uint32 { | 463 | + | func (x *Toast) ConnectDismissed(cb *func(Toast)) uint32 { |
| 464 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 465 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 466 | + | return gobject.SignalConnect(x.GoPointer(), "dismissed", cbRefPtr) | |||
| 467 | + | } | |||
| 468 | + | ||||
| 456 | fcb := func(clsPtr uintptr) { | 469 | fcb := func(clsPtr uintptr) { | ||
| 457 | fa := Toast{} | 470 | fa := Toast{} | ||
| 458 | fa.Ptr = clsPtr | 471 | fa.Ptr = clsPtr | ||
| 472 | + | cbFn := *cb | |||
| 459 | 473 | ||||
| 460 | - | cb(fa) | 474 | + | cbFn(fa) |
| 461 | 475 | ||||
| 462 | } | 476 | } | ||
| 463 | - | return gobject.SignalConnect(x.GoPointer(), "dismissed", purego.NewCallback(fcb)) | 477 | + | cbRefPtr := purego.NewCallback(fcb) |
| 478 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 479 | + | return gobject.SignalConnect(x.GoPointer(), "dismissed", cbRefPtr) | |||
| 464 | } | 480 | } | ||
| 465 | 481 | ||||
| 466 | func init() { | 482 | func init() { | ||
M v4/gdk/gdkclipboard.go +23 -13
| @@ -2,6 +2,8 @@ | |||||
| 2 | package gdk | 2 | package gdk | ||
| 3 | 3 | ||||
| 4 | import ( | 4 | import ( | ||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 5 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 6 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 7 | "github.com/jwijenbergh/puregotk/v4/gio" | 9 | "github.com/jwijenbergh/puregotk/v4/gio" | ||
| @@ -107,9 +109,9 @@ var xClipboardReadAsync func(uintptr, []string, int, uintptr, uintptr, uintptr) | |||||
| 107 | // | 109 | // | ||
| 108 | // The clipboard will choose the most suitable mime type from the given list | 110 | // The clipboard will choose the most suitable mime type from the given list | ||
| 109 | // to fulfill the request, preferring the ones listed first. | 111 | // to fulfill the request, preferring the ones listed first. | ||
| 110 | - | func (x *Clipboard) ReadAsync(MimeTypesVar []string, IoPriorityVar int, CancellableVar *gio.Cancellable, CallbackVar gio.AsyncReadyCallback, UserDataVar uintptr) { | 112 | + | func (x *Clipboard) ReadAsync(MimeTypesVar []string, IoPriorityVar int, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) { |
| 111 | 113 | ||||
| 112 | - | xClipboardReadAsync(x.GoPointer(), MimeTypesVar, IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 114 | + | xClipboardReadAsync(x.GoPointer(), MimeTypesVar, IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 113 | 115 | ||||
| 114 | } | 116 | } | ||
| 115 | 117 | ||||
| @@ -146,9 +148,9 @@ var xClipboardReadTextAsync func(uintptr, uintptr, uintptr, uintptr) | |||||
| 146 | // This is a simple wrapper around [method@Gdk.Clipboard.read_value_async]. | 148 | // This is a simple wrapper around [method@Gdk.Clipboard.read_value_async]. | ||
| 147 | // Use that function or [method@Gdk.Clipboard.read_async] directly if you | 149 | // Use that function or [method@Gdk.Clipboard.read_async] directly if you | ||
| 148 | // need more control over the operation. | 150 | // need more control over the operation. | ||
| 149 | - | func (x *Clipboard) ReadTextAsync(CancellableVar *gio.Cancellable, CallbackVar gio.AsyncReadyCallback, UserDataVar uintptr) { | 151 | + | func (x *Clipboard) ReadTextAsync(CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) { |
| 150 | 152 | ||||
| 151 | - | xClipboardReadTextAsync(x.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 153 | + | xClipboardReadTextAsync(x.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 152 | 154 | ||||
| 153 | } | 155 | } | ||
| 154 | 156 | ||||
| @@ -178,9 +180,9 @@ var xClipboardReadTextureAsync func(uintptr, uintptr, uintptr, uintptr) | |||||
| 178 | // This is a simple wrapper around [method@Gdk.Clipboard.read_value_async]. | 180 | // This is a simple wrapper around [method@Gdk.Clipboard.read_value_async]. | ||
| 179 | // Use that function or [method@Gdk.Clipboard.read_async] directly if you | 181 | // Use that function or [method@Gdk.Clipboard.read_async] directly if you | ||
| 180 | // need more control over the operation. | 182 | // need more control over the operation. | ||
| 181 | - | func (x *Clipboard) ReadTextureAsync(CancellableVar *gio.Cancellable, CallbackVar gio.AsyncReadyCallback, UserDataVar uintptr) { | 183 | + | func (x *Clipboard) ReadTextureAsync(CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) { |
| 182 | 184 | ||||
| 183 | - | xClipboardReadTextureAsync(x.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 185 | + | xClipboardReadTextureAsync(x.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 184 | 186 | ||||
| 185 | } | 187 | } | ||
| 186 | 188 | ||||
| @@ -218,9 +220,9 @@ var xClipboardReadValueAsync func(uintptr, []interface{}, int, uintptr, uintptr, | |||||
| 218 | // For local clipboard contents that are available in the given `GType`, | 220 | // For local clipboard contents that are available in the given `GType`, | ||
| 219 | // the value will be copied directly. Otherwise, GDK will try to use | 221 | // the value will be copied directly. Otherwise, GDK will try to use | ||
| 220 | // [func@content_deserialize_async] to convert the clipboard's data. | 222 | // [func@content_deserialize_async] to convert the clipboard's data. | ||
| 221 | - | func (x *Clipboard) ReadValueAsync(TypeVar []interface{}, IoPriorityVar int, CancellableVar *gio.Cancellable, CallbackVar gio.AsyncReadyCallback, UserDataVar uintptr) { | 223 | + | func (x *Clipboard) ReadValueAsync(TypeVar []interface{}, IoPriorityVar int, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) { |
| 222 | 224 | ||||
| 223 | - | xClipboardReadValueAsync(x.GoPointer(), TypeVar, IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 225 | + | xClipboardReadValueAsync(x.GoPointer(), TypeVar, IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 224 | 226 | ||||
| 225 | } | 227 | } | ||
| 226 | 228 | ||||
| @@ -330,9 +332,9 @@ var xClipboardStoreAsync func(uintptr, int, uintptr, uintptr, uintptr) | |||||
| 330 | // | 332 | // | ||
| 331 | // This function is called automatically when a [class@Gtk.Application] is | 333 | // This function is called automatically when a [class@Gtk.Application] is | ||
| 332 | // shut down, so you likely don't need to call it. | 334 | // shut down, so you likely don't need to call it. | ||
| 333 | - | func (x *Clipboard) StoreAsync(IoPriorityVar int, CancellableVar *gio.Cancellable, CallbackVar gio.AsyncReadyCallback, UserDataVar uintptr) { | 335 | + | func (x *Clipboard) StoreAsync(IoPriorityVar int, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) { |
| 334 | 336 | ||||
| 335 | - | xClipboardStoreAsync(x.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 337 | + | xClipboardStoreAsync(x.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 336 | 338 | ||||
| 337 | } | 339 | } | ||
| 338 | 340 | ||||
| @@ -361,15 +363,23 @@ func (c *Clipboard) SetGoPointer(ptr uintptr) { | |||||
| 361 | } | 363 | } | ||
| 362 | 364 | ||||
| 363 | // Emitted when the clipboard changes ownership. | 365 | // Emitted when the clipboard changes ownership. | ||
| 364 | - | func (x *Clipboard) ConnectChanged(cb func(Clipboard)) uint32 { | 366 | + | func (x *Clipboard) ConnectChanged(cb *func(Clipboard)) uint32 { |
| 367 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 368 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 369 | + | return gobject.SignalConnect(x.GoPointer(), "changed", cbRefPtr) | |||
| 370 | + | } | |||
| 371 | + | ||||
| 365 | fcb := func(clsPtr uintptr) { | 372 | fcb := func(clsPtr uintptr) { | ||
| 366 | fa := Clipboard{} | 373 | fa := Clipboard{} | ||
| 367 | fa.Ptr = clsPtr | 374 | fa.Ptr = clsPtr | ||
| 375 | + | cbFn := *cb | |||
| 368 | 376 | ||||
| 369 | - | cb(fa) | 377 | + | cbFn(fa) |
| 370 | 378 | ||||
| 371 | } | 379 | } | ||
| 372 | - | return gobject.SignalConnect(x.GoPointer(), "changed", purego.NewCallback(fcb)) | 380 | + | cbRefPtr := purego.NewCallback(fcb) |
| 381 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 382 | + | return gobject.SignalConnect(x.GoPointer(), "changed", cbRefPtr) | |||
| 373 | } | 383 | } | ||
| 374 | 384 | ||||
| 375 | func init() { | 385 | func init() { | ||
M v4/gdk/gdkcontentdeserializer.go +6 -6
| @@ -25,9 +25,9 @@ var xContentDeserializeAsync func(uintptr, string, []interface{}, int, uintptr, | |||||
| 25 | // | 25 | // | ||
| 26 | // When the operation is finished, @callback will be called. You must then | 26 | // When the operation is finished, @callback will be called. You must then | ||
| 27 | // call [func@Gdk.content_deserialize_finish] to get the result of the operation. | 27 | // call [func@Gdk.content_deserialize_finish] to get the result of the operation. | ||
| 28 | - | func ContentDeserializeAsync(StreamVar *gio.InputStream, MimeTypeVar string, TypeVar []interface{}, IoPriorityVar int, CancellableVar *gio.Cancellable, CallbackVar gio.AsyncReadyCallback, UserDataVar uintptr) { | 28 | + | func ContentDeserializeAsync(StreamVar *gio.InputStream, MimeTypeVar string, TypeVar []interface{}, IoPriorityVar int, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) { |
| 29 | 29 | ||||
| 30 | - | xContentDeserializeAsync(StreamVar.GoPointer(), MimeTypeVar, TypeVar, IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 30 | + | xContentDeserializeAsync(StreamVar.GoPointer(), MimeTypeVar, TypeVar, IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 31 | 31 | ||||
| 32 | } | 32 | } | ||
| 33 | 33 | ||||
| @@ -48,9 +48,9 @@ func ContentDeserializeFinish(ResultVar gio.AsyncResult, ValueVar *gobject.Value | |||||
| 48 | var xContentRegisterDeserializer func(string, []interface{}, uintptr, uintptr, uintptr) | 48 | var xContentRegisterDeserializer func(string, []interface{}, uintptr, uintptr, uintptr) | ||
| 49 | 49 | ||||
| 50 | // Registers a function to deserialize object of a given type. | 50 | // Registers a function to deserialize object of a given type. | ||
| 51 | - | func ContentRegisterDeserializer(MimeTypeVar string, TypeVar []interface{}, DeserializeVar ContentDeserializeFunc, DataVar uintptr, NotifyVar glib.DestroyNotify) { | 51 | + | func ContentRegisterDeserializer(MimeTypeVar string, TypeVar []interface{}, DeserializeVar *ContentDeserializeFunc, DataVar uintptr, NotifyVar *glib.DestroyNotify) { |
| 52 | 52 | ||||
| 53 | - | xContentRegisterDeserializer(MimeTypeVar, TypeVar, purego.NewCallback(DeserializeVar), DataVar, purego.NewCallback(NotifyVar)) | 53 | + | xContentRegisterDeserializer(MimeTypeVar, TypeVar, glib.NewCallback(DeserializeVar), DataVar, glib.NewCallback(NotifyVar)) |
| 54 | 54 | ||||
| 55 | } | 55 | } | ||
| 56 | 56 | ||||
| @@ -194,9 +194,9 @@ func (x *ContentDeserializer) ReturnSuccess() { | |||||
| 194 | var xContentDeserializerSetTaskData func(uintptr, uintptr, uintptr) | 194 | var xContentDeserializerSetTaskData func(uintptr, uintptr, uintptr) | ||
| 195 | 195 | ||||
| 196 | // Associate data with the current deserialization operation. | 196 | // Associate data with the current deserialization operation. | ||
| 197 | - | func (x *ContentDeserializer) SetTaskData(DataVar uintptr, NotifyVar glib.DestroyNotify) { | 197 | + | func (x *ContentDeserializer) SetTaskData(DataVar uintptr, NotifyVar *glib.DestroyNotify) { |
| 198 | 198 | ||||
| 199 | - | xContentDeserializerSetTaskData(x.GoPointer(), DataVar, purego.NewCallback(NotifyVar)) | 199 | + | xContentDeserializerSetTaskData(x.GoPointer(), DataVar, glib.NewCallback(NotifyVar)) |
| 200 | 200 | ||||
| 201 | } | 201 | } | ||
| 202 | 202 | ||||
M v4/gdk/gdkcontentprovider.go +13 -5
| @@ -192,9 +192,9 @@ var xContentProviderWriteMimeTypeAsync func(uintptr, string, uintptr, int, uintp | |||||
| 192 | // not supported, `G_IO_ERROR_NOT_SUPPORTED` will be reported. | 192 | // not supported, `G_IO_ERROR_NOT_SUPPORTED` will be reported. | ||
| 193 | // | 193 | // | ||
| 194 | // The given @stream will not be closed. | 194 | // The given @stream will not be closed. | ||
| 195 | - | func (x *ContentProvider) WriteMimeTypeAsync(MimeTypeVar string, StreamVar *gio.OutputStream, IoPriorityVar int, CancellableVar *gio.Cancellable, CallbackVar gio.AsyncReadyCallback, UserDataVar uintptr) { | 195 | + | func (x *ContentProvider) WriteMimeTypeAsync(MimeTypeVar string, StreamVar *gio.OutputStream, IoPriorityVar int, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) { |
| 196 | 196 | ||||
| 197 | - | xContentProviderWriteMimeTypeAsync(x.GoPointer(), MimeTypeVar, StreamVar.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 197 | + | xContentProviderWriteMimeTypeAsync(x.GoPointer(), MimeTypeVar, StreamVar.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 198 | 198 | ||||
| 199 | } | 199 | } | ||
| 200 | 200 | ||||
| @@ -223,15 +223,23 @@ func (c *ContentProvider) SetGoPointer(ptr uintptr) { | |||||
| 223 | } | 223 | } | ||
| 224 | 224 | ||||
| 225 | // Emitted whenever the content provided by this provider has changed. | 225 | // Emitted whenever the content provided by this provider has changed. | ||
| 226 | - | func (x *ContentProvider) ConnectContentChanged(cb func(ContentProvider)) uint32 { | 226 | + | func (x *ContentProvider) ConnectContentChanged(cb *func(ContentProvider)) uint32 { |
| 227 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 228 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 229 | + | return gobject.SignalConnect(x.GoPointer(), "content-changed", cbRefPtr) | |||
| 230 | + | } | |||
| 231 | + | ||||
| 227 | fcb := func(clsPtr uintptr) { | 232 | fcb := func(clsPtr uintptr) { | ||
| 228 | fa := ContentProvider{} | 233 | fa := ContentProvider{} | ||
| 229 | fa.Ptr = clsPtr | 234 | fa.Ptr = clsPtr | ||
| 235 | + | cbFn := *cb | |||
| 230 | 236 | ||||
| 231 | - | cb(fa) | 237 | + | cbFn(fa) |
| 232 | 238 | ||||
| 233 | } | 239 | } | ||
| 234 | - | return gobject.SignalConnect(x.GoPointer(), "content-changed", purego.NewCallback(fcb)) | 240 | + | cbRefPtr := purego.NewCallback(fcb) |
| 241 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 242 | + | return gobject.SignalConnect(x.GoPointer(), "content-changed", cbRefPtr) | |||
| 235 | } | 243 | } | ||
| 236 | 244 | ||||
| 237 | func init() { | 245 | func init() { | ||
M v4/gdk/gdkcontentserializer.go +6 -6
| @@ -19,9 +19,9 @@ type ContentSerializeFunc func(uintptr) | |||||
| 19 | var xContentRegisterSerializer func([]interface{}, string, uintptr, uintptr, uintptr) | 19 | var xContentRegisterSerializer func([]interface{}, string, uintptr, uintptr, uintptr) | ||
| 20 | 20 | ||||
| 21 | // Registers a function to serialize objects of a given type. | 21 | // Registers a function to serialize objects of a given type. | ||
| 22 | - | func ContentRegisterSerializer(TypeVar []interface{}, MimeTypeVar string, SerializeVar ContentSerializeFunc, DataVar uintptr, NotifyVar glib.DestroyNotify) { | 22 | + | func ContentRegisterSerializer(TypeVar []interface{}, MimeTypeVar string, SerializeVar *ContentSerializeFunc, DataVar uintptr, NotifyVar *glib.DestroyNotify) { |
| 23 | 23 | ||||
| 24 | - | xContentRegisterSerializer(TypeVar, MimeTypeVar, purego.NewCallback(SerializeVar), DataVar, purego.NewCallback(NotifyVar)) | 24 | + | xContentRegisterSerializer(TypeVar, MimeTypeVar, glib.NewCallback(SerializeVar), DataVar, glib.NewCallback(NotifyVar)) |
| 25 | 25 | ||||
| 26 | } | 26 | } | ||
| 27 | 27 | ||||
| @@ -34,9 +34,9 @@ var xContentSerializeAsync func(uintptr, string, *gobject.Value, int, uintptr, u | |||||
| 34 | // | 34 | // | ||
| 35 | // When the operation is finished, @callback will be called. You must then | 35 | // When the operation is finished, @callback will be called. You must then | ||
| 36 | // call [func@Gdk.content_serialize_finish] to get the result of the operation. | 36 | // call [func@Gdk.content_serialize_finish] to get the result of the operation. | ||
| 37 | - | func ContentSerializeAsync(StreamVar *gio.OutputStream, MimeTypeVar string, ValueVar *gobject.Value, IoPriorityVar int, CancellableVar *gio.Cancellable, CallbackVar gio.AsyncReadyCallback, UserDataVar uintptr) { | 37 | + | func ContentSerializeAsync(StreamVar *gio.OutputStream, MimeTypeVar string, ValueVar *gobject.Value, IoPriorityVar int, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) { |
| 38 | 38 | ||||
| 39 | - | xContentSerializeAsync(StreamVar.GoPointer(), MimeTypeVar, ValueVar, IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 39 | + | xContentSerializeAsync(StreamVar.GoPointer(), MimeTypeVar, ValueVar, IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 40 | 40 | ||||
| 41 | } | 41 | } | ||
| 42 | 42 | ||||
| @@ -195,9 +195,9 @@ func (x *ContentSerializer) ReturnSuccess() { | |||||
| 195 | var xContentSerializerSetTaskData func(uintptr, uintptr, uintptr) | 195 | var xContentSerializerSetTaskData func(uintptr, uintptr, uintptr) | ||
| 196 | 196 | ||||
| 197 | // Associate data with the current serialization operation. | 197 | // Associate data with the current serialization operation. | ||
| 198 | - | func (x *ContentSerializer) SetTaskData(DataVar uintptr, NotifyVar glib.DestroyNotify) { | 198 | + | func (x *ContentSerializer) SetTaskData(DataVar uintptr, NotifyVar *glib.DestroyNotify) { |
| 199 | 199 | ||||
| 200 | - | xContentSerializerSetTaskData(x.GoPointer(), DataVar, purego.NewCallback(NotifyVar)) | 200 | + | xContentSerializerSetTaskData(x.GoPointer(), DataVar, glib.NewCallback(NotifyVar)) |
| 201 | 201 | ||||
| 202 | } | 202 | } | ||
| 203 | 203 | ||||
M v4/gdk/gdkdevice.go +23 -6
| @@ -6,6 +6,7 @@ import ( | |||||
| 6 | 6 | ||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 9 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 10 | "github.com/jwijenbergh/puregotk/v4/pango" | 11 | "github.com/jwijenbergh/puregotk/v4/pango" | ||
| 11 | ) | 12 | ) | ||
| @@ -327,27 +328,43 @@ func (c *Device) SetGoPointer(ptr uintptr) { | |||||
| 327 | // example, user switches from the USB mouse to a tablet); in | 328 | // example, user switches from the USB mouse to a tablet); in | ||
| 328 | // that case the logical device will change to reflect the axes | 329 | // that case the logical device will change to reflect the axes | ||
| 329 | // and keys on the new physical device. | 330 | // and keys on the new physical device. | ||
| 330 | - | func (x *Device) ConnectChanged(cb func(Device)) uint32 { | 331 | + | func (x *Device) ConnectChanged(cb *func(Device)) uint32 { |
| 332 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 333 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 334 | + | return gobject.SignalConnect(x.GoPointer(), "changed", cbRefPtr) | |||
| 335 | + | } | |||
| 336 | + | ||||
| 331 | fcb := func(clsPtr uintptr) { | 337 | fcb := func(clsPtr uintptr) { | ||
| 332 | fa := Device{} | 338 | fa := Device{} | ||
| 333 | fa.Ptr = clsPtr | 339 | fa.Ptr = clsPtr | ||
| 340 | + | cbFn := *cb | |||
| 334 | 341 | ||||
| 335 | - | cb(fa) | 342 | + | cbFn(fa) |
| 336 | 343 | ||||
| 337 | } | 344 | } | ||
| 338 | - | return gobject.SignalConnect(x.GoPointer(), "changed", purego.NewCallback(fcb)) | 345 | + | cbRefPtr := purego.NewCallback(fcb) |
| 346 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 347 | + | return gobject.SignalConnect(x.GoPointer(), "changed", cbRefPtr) | |||
| 339 | } | 348 | } | ||
| 340 | 349 | ||||
| 341 | // Emitted on pen/eraser devices whenever tools enter or leave proximity. | 350 | // Emitted on pen/eraser devices whenever tools enter or leave proximity. | ||
| 342 | - | func (x *Device) ConnectToolChanged(cb func(Device, uintptr)) uint32 { | 351 | + | func (x *Device) ConnectToolChanged(cb *func(Device, uintptr)) uint32 { |
| 352 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 353 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 354 | + | return gobject.SignalConnect(x.GoPointer(), "tool-changed", cbRefPtr) | |||
| 355 | + | } | |||
| 356 | + | ||||
| 343 | fcb := func(clsPtr uintptr, ToolVarp uintptr) { | 357 | fcb := func(clsPtr uintptr, ToolVarp uintptr) { | ||
| 344 | fa := Device{} | 358 | fa := Device{} | ||
| 345 | fa.Ptr = clsPtr | 359 | fa.Ptr = clsPtr | ||
| 360 | + | cbFn := *cb | |||
| 346 | 361 | ||||
| 347 | - | cb(fa, ToolVarp) | 362 | + | cbFn(fa, ToolVarp) |
| 348 | 363 | ||||
| 349 | } | 364 | } | ||
| 350 | - | return gobject.SignalConnect(x.GoPointer(), "tool-changed", purego.NewCallback(fcb)) | 365 | + | cbRefPtr := purego.NewCallback(fcb) |
| 366 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 367 | + | return gobject.SignalConnect(x.GoPointer(), "tool-changed", cbRefPtr) | |||
| 351 | } | 368 | } | ||
| 352 | 369 | ||||
| 353 | func init() { | 370 | func init() { | ||
M v4/gdk/gdkdisplay.go +57 -15
| @@ -2,6 +2,8 @@ | |||||
| 2 | package gdk | 2 | package gdk | ||
| 3 | 3 | ||||
| 4 | import ( | 4 | import ( | ||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 5 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 6 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 7 | "github.com/jwijenbergh/puregotk/v4/gio" | 9 | "github.com/jwijenbergh/puregotk/v4/gio" | ||
| @@ -474,63 +476,103 @@ func (c *Display) SetGoPointer(ptr uintptr) { | |||||
| 474 | } | 476 | } | ||
| 475 | 477 | ||||
| 476 | // Emitted when the connection to the windowing system for @display is closed. | 478 | // Emitted when the connection to the windowing system for @display is closed. | ||
| 477 | - | func (x *Display) ConnectClosed(cb func(Display, bool)) uint32 { | 479 | + | func (x *Display) ConnectClosed(cb *func(Display, bool)) uint32 { |
| 480 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 481 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 482 | + | return gobject.SignalConnect(x.GoPointer(), "closed", cbRefPtr) | |||
| 483 | + | } | |||
| 484 | + | ||||
| 478 | fcb := func(clsPtr uintptr, IsErrorVarp bool) { | 485 | fcb := func(clsPtr uintptr, IsErrorVarp bool) { | ||
| 479 | fa := Display{} | 486 | fa := Display{} | ||
| 480 | fa.Ptr = clsPtr | 487 | fa.Ptr = clsPtr | ||
| 488 | + | cbFn := *cb | |||
| 481 | 489 | ||||
| 482 | - | cb(fa, IsErrorVarp) | 490 | + | cbFn(fa, IsErrorVarp) |
| 483 | 491 | ||||
| 484 | } | 492 | } | ||
| 485 | - | return gobject.SignalConnect(x.GoPointer(), "closed", purego.NewCallback(fcb)) | 493 | + | cbRefPtr := purego.NewCallback(fcb) |
| 494 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 495 | + | return gobject.SignalConnect(x.GoPointer(), "closed", cbRefPtr) | |||
| 486 | } | 496 | } | ||
| 487 | 497 | ||||
| 488 | // Emitted when the connection to the windowing system for @display is opened. | 498 | // Emitted when the connection to the windowing system for @display is opened. | ||
| 489 | - | func (x *Display) ConnectOpened(cb func(Display)) uint32 { | 499 | + | func (x *Display) ConnectOpened(cb *func(Display)) uint32 { |
| 500 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 501 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 502 | + | return gobject.SignalConnect(x.GoPointer(), "opened", cbRefPtr) | |||
| 503 | + | } | |||
| 504 | + | ||||
| 490 | fcb := func(clsPtr uintptr) { | 505 | fcb := func(clsPtr uintptr) { | ||
| 491 | fa := Display{} | 506 | fa := Display{} | ||
| 492 | fa.Ptr = clsPtr | 507 | fa.Ptr = clsPtr | ||
| 508 | + | cbFn := *cb | |||
| 493 | 509 | ||||
| 494 | - | cb(fa) | 510 | + | cbFn(fa) |
| 495 | 511 | ||||
| 496 | } | 512 | } | ||
| 497 | - | return gobject.SignalConnect(x.GoPointer(), "opened", purego.NewCallback(fcb)) | 513 | + | cbRefPtr := purego.NewCallback(fcb) |
| 514 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 515 | + | return gobject.SignalConnect(x.GoPointer(), "opened", cbRefPtr) | |||
| 498 | } | 516 | } | ||
| 499 | 517 | ||||
| 500 | // Emitted whenever a new seat is made known to the windowing system. | 518 | // Emitted whenever a new seat is made known to the windowing system. | ||
| 501 | - | func (x *Display) ConnectSeatAdded(cb func(Display, uintptr)) uint32 { | 519 | + | func (x *Display) ConnectSeatAdded(cb *func(Display, uintptr)) uint32 { |
| 520 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 521 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 522 | + | return gobject.SignalConnect(x.GoPointer(), "seat-added", cbRefPtr) | |||
| 523 | + | } | |||
| 524 | + | ||||
| 502 | fcb := func(clsPtr uintptr, SeatVarp uintptr) { | 525 | fcb := func(clsPtr uintptr, SeatVarp uintptr) { | ||
| 503 | fa := Display{} | 526 | fa := Display{} | ||
| 504 | fa.Ptr = clsPtr | 527 | fa.Ptr = clsPtr | ||
| 528 | + | cbFn := *cb | |||
| 505 | 529 | ||||
| 506 | - | cb(fa, SeatVarp) | 530 | + | cbFn(fa, SeatVarp) |
| 507 | 531 | ||||
| 508 | } | 532 | } | ||
| 509 | - | return gobject.SignalConnect(x.GoPointer(), "seat-added", purego.NewCallback(fcb)) | 533 | + | cbRefPtr := purego.NewCallback(fcb) |
| 534 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 535 | + | return gobject.SignalConnect(x.GoPointer(), "seat-added", cbRefPtr) | |||
| 510 | } | 536 | } | ||
| 511 | 537 | ||||
| 512 | // Emitted whenever a seat is removed by the windowing system. | 538 | // Emitted whenever a seat is removed by the windowing system. | ||
| 513 | - | func (x *Display) ConnectSeatRemoved(cb func(Display, uintptr)) uint32 { | 539 | + | func (x *Display) ConnectSeatRemoved(cb *func(Display, uintptr)) uint32 { |
| 540 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 541 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 542 | + | return gobject.SignalConnect(x.GoPointer(), "seat-removed", cbRefPtr) | |||
| 543 | + | } | |||
| 544 | + | ||||
| 514 | fcb := func(clsPtr uintptr, SeatVarp uintptr) { | 545 | fcb := func(clsPtr uintptr, SeatVarp uintptr) { | ||
| 515 | fa := Display{} | 546 | fa := Display{} | ||
| 516 | fa.Ptr = clsPtr | 547 | fa.Ptr = clsPtr | ||
| 548 | + | cbFn := *cb | |||
| 517 | 549 | ||||
| 518 | - | cb(fa, SeatVarp) | 550 | + | cbFn(fa, SeatVarp) |
| 519 | 551 | ||||
| 520 | } | 552 | } | ||
| 521 | - | return gobject.SignalConnect(x.GoPointer(), "seat-removed", purego.NewCallback(fcb)) | 553 | + | cbRefPtr := purego.NewCallback(fcb) |
| 554 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 555 | + | return gobject.SignalConnect(x.GoPointer(), "seat-removed", cbRefPtr) | |||
| 522 | } | 556 | } | ||
| 523 | 557 | ||||
| 524 | // Emitted whenever a setting changes its value. | 558 | // Emitted whenever a setting changes its value. | ||
| 525 | - | func (x *Display) ConnectSettingChanged(cb func(Display, string)) uint32 { | 559 | + | func (x *Display) ConnectSettingChanged(cb *func(Display, string)) uint32 { |
| 560 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 561 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 562 | + | return gobject.SignalConnect(x.GoPointer(), "setting-changed", cbRefPtr) | |||
| 563 | + | } | |||
| 564 | + | ||||
| 526 | fcb := func(clsPtr uintptr, SettingVarp string) { | 565 | fcb := func(clsPtr uintptr, SettingVarp string) { | ||
| 527 | fa := Display{} | 566 | fa := Display{} | ||
| 528 | fa.Ptr = clsPtr | 567 | fa.Ptr = clsPtr | ||
| 568 | + | cbFn := *cb | |||
| 529 | 569 | ||||
| 530 | - | cb(fa, SettingVarp) | 570 | + | cbFn(fa, SettingVarp) |
| 531 | 571 | ||||
| 532 | } | 572 | } | ||
| 533 | - | return gobject.SignalConnect(x.GoPointer(), "setting-changed", purego.NewCallback(fcb)) | 573 | + | cbRefPtr := purego.NewCallback(fcb) |
| 574 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 575 | + | return gobject.SignalConnect(x.GoPointer(), "setting-changed", cbRefPtr) | |||
| 534 | } | 576 | } | ||
| 535 | 577 | ||||
| 536 | var xDisplayGetDefault func() uintptr | 578 | var xDisplayGetDefault func() uintptr | ||
M v4/gdk/gdkdisplaymanager.go +13 -3
| @@ -2,6 +2,8 @@ | |||||
| 2 | package gdk | 2 | package gdk | ||
| 3 | 3 | ||||
| 4 | import ( | 4 | import ( | ||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 5 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 6 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 7 | "github.com/jwijenbergh/puregotk/v4/glib" | 9 | "github.com/jwijenbergh/puregotk/v4/glib" | ||
| @@ -168,15 +170,23 @@ func (c *DisplayManager) SetGoPointer(ptr uintptr) { | |||||
| 168 | } | 170 | } | ||
| 169 | 171 | ||||
| 170 | // Emitted when a display is opened. | 172 | // Emitted when a display is opened. | ||
| 171 | - | func (x *DisplayManager) ConnectDisplayOpened(cb func(DisplayManager, uintptr)) uint32 { | 173 | + | func (x *DisplayManager) ConnectDisplayOpened(cb *func(DisplayManager, uintptr)) uint32 { |
| 174 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 175 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 176 | + | return gobject.SignalConnect(x.GoPointer(), "display-opened", cbRefPtr) | |||
| 177 | + | } | |||
| 178 | + | ||||
| 172 | fcb := func(clsPtr uintptr, DisplayVarp uintptr) { | 179 | fcb := func(clsPtr uintptr, DisplayVarp uintptr) { | ||
| 173 | fa := DisplayManager{} | 180 | fa := DisplayManager{} | ||
| 174 | fa.Ptr = clsPtr | 181 | fa.Ptr = clsPtr | ||
| 182 | + | cbFn := *cb | |||
| 175 | 183 | ||||
| 176 | - | cb(fa, DisplayVarp) | 184 | + | cbFn(fa, DisplayVarp) |
| 177 | 185 | ||||
| 178 | } | 186 | } | ||
| 179 | - | return gobject.SignalConnect(x.GoPointer(), "display-opened", purego.NewCallback(fcb)) | 187 | + | cbRefPtr := purego.NewCallback(fcb) |
| 188 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 189 | + | return gobject.SignalConnect(x.GoPointer(), "display-opened", cbRefPtr) | |||
| 180 | } | 190 | } | ||
| 181 | 191 | ||||
| 182 | var xDisplayManagerGet func() uintptr | 192 | var xDisplayManagerGet func() uintptr | ||
M v4/gdk/gdkdrag.go +36 -9
| @@ -2,8 +2,11 @@ | |||||
| 2 | package gdk | 2 | package gdk | ||
| 3 | 3 | ||||
| 4 | import ( | 4 | import ( | ||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 5 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 6 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 7 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 8 | ) | 11 | ) | ||
| 9 | 12 | ||||
| @@ -211,41 +214,65 @@ func (c *Drag) SetGoPointer(ptr uintptr) { | |||||
| 211 | } | 214 | } | ||
| 212 | 215 | ||||
| 213 | // Emitted when the drag operation is cancelled. | 216 | // Emitted when the drag operation is cancelled. | ||
| 214 | - | func (x *Drag) ConnectCancel(cb func(Drag, DragCancelReason)) uint32 { | 217 | + | func (x *Drag) ConnectCancel(cb *func(Drag, DragCancelReason)) uint32 { |
| 218 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 219 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 220 | + | return gobject.SignalConnect(x.GoPointer(), "cancel", cbRefPtr) | |||
| 221 | + | } | |||
| 222 | + | ||||
| 215 | fcb := func(clsPtr uintptr, ReasonVarp DragCancelReason) { | 223 | fcb := func(clsPtr uintptr, ReasonVarp DragCancelReason) { | ||
| 216 | fa := Drag{} | 224 | fa := Drag{} | ||
| 217 | fa.Ptr = clsPtr | 225 | fa.Ptr = clsPtr | ||
| 226 | + | cbFn := *cb | |||
| 218 | 227 | ||||
| 219 | - | cb(fa, ReasonVarp) | 228 | + | cbFn(fa, ReasonVarp) |
| 220 | 229 | ||||
| 221 | } | 230 | } | ||
| 222 | - | return gobject.SignalConnect(x.GoPointer(), "cancel", purego.NewCallback(fcb)) | 231 | + | cbRefPtr := purego.NewCallback(fcb) |
| 232 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 233 | + | return gobject.SignalConnect(x.GoPointer(), "cancel", cbRefPtr) | |||
| 223 | } | 234 | } | ||
| 224 | 235 | ||||
| 225 | // Emitted when the destination side has finished reading all data. | 236 | // Emitted when the destination side has finished reading all data. | ||
| 226 | // | 237 | // | ||
| 227 | // The drag object can now free all miscellaneous data. | 238 | // The drag object can now free all miscellaneous data. | ||
| 228 | - | func (x *Drag) ConnectDndFinished(cb func(Drag)) uint32 { | 239 | + | func (x *Drag) ConnectDndFinished(cb *func(Drag)) uint32 { |
| 240 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 241 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 242 | + | return gobject.SignalConnect(x.GoPointer(), "dnd-finished", cbRefPtr) | |||
| 243 | + | } | |||
| 244 | + | ||||
| 229 | fcb := func(clsPtr uintptr) { | 245 | fcb := func(clsPtr uintptr) { | ||
| 230 | fa := Drag{} | 246 | fa := Drag{} | ||
| 231 | fa.Ptr = clsPtr | 247 | fa.Ptr = clsPtr | ||
| 248 | + | cbFn := *cb | |||
| 232 | 249 | ||||
| 233 | - | cb(fa) | 250 | + | cbFn(fa) |
| 234 | 251 | ||||
| 235 | } | 252 | } | ||
| 236 | - | return gobject.SignalConnect(x.GoPointer(), "dnd-finished", purego.NewCallback(fcb)) | 253 | + | cbRefPtr := purego.NewCallback(fcb) |
| 254 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 255 | + | return gobject.SignalConnect(x.GoPointer(), "dnd-finished", cbRefPtr) | |||
| 237 | } | 256 | } | ||
| 238 | 257 | ||||
| 239 | // Emitted when the drop operation is performed on an accepting client. | 258 | // Emitted when the drop operation is performed on an accepting client. | ||
| 240 | - | func (x *Drag) ConnectDropPerformed(cb func(Drag)) uint32 { | 259 | + | func (x *Drag) ConnectDropPerformed(cb *func(Drag)) uint32 { |
| 260 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 261 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 262 | + | return gobject.SignalConnect(x.GoPointer(), "drop-performed", cbRefPtr) | |||
| 263 | + | } | |||
| 264 | + | ||||
| 241 | fcb := func(clsPtr uintptr) { | 265 | fcb := func(clsPtr uintptr) { | ||
| 242 | fa := Drag{} | 266 | fa := Drag{} | ||
| 243 | fa.Ptr = clsPtr | 267 | fa.Ptr = clsPtr | ||
| 268 | + | cbFn := *cb | |||
| 244 | 269 | ||||
| 245 | - | cb(fa) | 270 | + | cbFn(fa) |
| 246 | 271 | ||||
| 247 | } | 272 | } | ||
| 248 | - | return gobject.SignalConnect(x.GoPointer(), "drop-performed", purego.NewCallback(fcb)) | 273 | + | cbRefPtr := purego.NewCallback(fcb) |
| 274 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 275 | + | return gobject.SignalConnect(x.GoPointer(), "drop-performed", cbRefPtr) | |||
| 249 | } | 276 | } | ||
| 250 | 277 | ||||
| 251 | var xDragBegin func(uintptr, uintptr, uintptr, DragAction, float64, float64) uintptr | 278 | var xDragBegin func(uintptr, uintptr, uintptr, DragAction, float64, float64) uintptr | ||
M v4/gdk/gdkdrop.go +4 -4
| @@ -152,9 +152,9 @@ var xDropReadAsync func(uintptr, []string, int, uintptr, uintptr, uintptr) | |||||
| 152 | 152 | ||||
| 153 | // Asynchronously read the dropped data from a `GdkDrop` | 153 | // Asynchronously read the dropped data from a `GdkDrop` | ||
| 154 | // in a format that complies with one of the mime types. | 154 | // in a format that complies with one of the mime types. | ||
| 155 | - | func (x *Drop) ReadAsync(MimeTypesVar []string, IoPriorityVar int, CancellableVar *gio.Cancellable, CallbackVar gio.AsyncReadyCallback, UserDataVar uintptr) { | 155 | + | func (x *Drop) ReadAsync(MimeTypesVar []string, IoPriorityVar int, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) { |
| 156 | 156 | ||||
| 157 | - | xDropReadAsync(x.GoPointer(), MimeTypesVar, IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 157 | + | xDropReadAsync(x.GoPointer(), MimeTypesVar, IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 158 | 158 | ||||
| 159 | } | 159 | } | ||
| 160 | 160 | ||||
| @@ -198,9 +198,9 @@ var xDropReadValueAsync func(uintptr, []interface{}, int, uintptr, uintptr, uint | |||||
| 198 | // For local drag-and-drop operations that are available in the given | 198 | // For local drag-and-drop operations that are available in the given | ||
| 199 | // `GType`, the value will be copied directly. Otherwise, GDK will | 199 | // `GType`, the value will be copied directly. Otherwise, GDK will | ||
| 200 | // try to use [func@Gdk.content_deserialize_async] to convert the data. | 200 | // try to use [func@Gdk.content_deserialize_async] to convert the data. | ||
| 201 | - | func (x *Drop) ReadValueAsync(TypeVar []interface{}, IoPriorityVar int, CancellableVar *gio.Cancellable, CallbackVar gio.AsyncReadyCallback, UserDataVar uintptr) { | 201 | + | func (x *Drop) ReadValueAsync(TypeVar []interface{}, IoPriorityVar int, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) { |
| 202 | 202 | ||||
| 203 | - | xDropReadValueAsync(x.GoPointer(), TypeVar, IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 203 | + | xDropReadValueAsync(x.GoPointer(), TypeVar, IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 204 | 204 | ||||
| 205 | } | 205 | } | ||
| 206 | 206 | ||||
M v4/gdk/gdkframeclock.go +78 -21
| @@ -6,6 +6,7 @@ import ( | |||||
| 6 | 6 | ||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 9 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 10 | ) | 11 | ) | ||
| 11 | 12 | ||||
| @@ -236,44 +237,68 @@ func (c *FrameClock) SetGoPointer(ptr uintptr) { | |||||
| 236 | // This signal ends processing of the frame. | 237 | // This signal ends processing of the frame. | ||
| 237 | // | 238 | // | ||
| 238 | // Applications should generally not handle this signal. | 239 | // Applications should generally not handle this signal. | ||
| 239 | - | func (x *FrameClock) ConnectAfterPaint(cb func(FrameClock)) uint32 { | 240 | + | func (x *FrameClock) ConnectAfterPaint(cb *func(FrameClock)) uint32 { |
| 241 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 242 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 243 | + | return gobject.SignalConnect(x.GoPointer(), "after-paint", cbRefPtr) | |||
| 244 | + | } | |||
| 245 | + | ||||
| 240 | fcb := func(clsPtr uintptr) { | 246 | fcb := func(clsPtr uintptr) { | ||
| 241 | fa := FrameClock{} | 247 | fa := FrameClock{} | ||
| 242 | fa.Ptr = clsPtr | 248 | fa.Ptr = clsPtr | ||
| 249 | + | cbFn := *cb | |||
| 243 | 250 | ||||
| 244 | - | cb(fa) | 251 | + | cbFn(fa) |
| 245 | 252 | ||||
| 246 | } | 253 | } | ||
| 247 | - | return gobject.SignalConnect(x.GoPointer(), "after-paint", purego.NewCallback(fcb)) | 254 | + | cbRefPtr := purego.NewCallback(fcb) |
| 255 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 256 | + | return gobject.SignalConnect(x.GoPointer(), "after-paint", cbRefPtr) | |||
| 248 | } | 257 | } | ||
| 249 | 258 | ||||
| 250 | // Begins processing of the frame. | 259 | // Begins processing of the frame. | ||
| 251 | // | 260 | // | ||
| 252 | // Applications should generally not handle this signal. | 261 | // Applications should generally not handle this signal. | ||
| 253 | - | func (x *FrameClock) ConnectBeforePaint(cb func(FrameClock)) uint32 { | 262 | + | func (x *FrameClock) ConnectBeforePaint(cb *func(FrameClock)) uint32 { |
| 263 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 264 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 265 | + | return gobject.SignalConnect(x.GoPointer(), "before-paint", cbRefPtr) | |||
| 266 | + | } | |||
| 267 | + | ||||
| 254 | fcb := func(clsPtr uintptr) { | 268 | fcb := func(clsPtr uintptr) { | ||
| 255 | fa := FrameClock{} | 269 | fa := FrameClock{} | ||
| 256 | fa.Ptr = clsPtr | 270 | fa.Ptr = clsPtr | ||
| 271 | + | cbFn := *cb | |||
| 257 | 272 | ||||
| 258 | - | cb(fa) | 273 | + | cbFn(fa) |
| 259 | 274 | ||||
| 260 | } | 275 | } | ||
| 261 | - | return gobject.SignalConnect(x.GoPointer(), "before-paint", purego.NewCallback(fcb)) | 276 | + | cbRefPtr := purego.NewCallback(fcb) |
| 277 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 278 | + | return gobject.SignalConnect(x.GoPointer(), "before-paint", cbRefPtr) | |||
| 262 | } | 279 | } | ||
| 263 | 280 | ||||
| 264 | // Used to flush pending motion events that are being batched up and | 281 | // Used to flush pending motion events that are being batched up and | ||
| 265 | // compressed together. | 282 | // compressed together. | ||
| 266 | // | 283 | // | ||
| 267 | // Applications should not handle this signal. | 284 | // Applications should not handle this signal. | ||
| 268 | - | func (x *FrameClock) ConnectFlushEvents(cb func(FrameClock)) uint32 { | 285 | + | func (x *FrameClock) ConnectFlushEvents(cb *func(FrameClock)) uint32 { |
| 286 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 287 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 288 | + | return gobject.SignalConnect(x.GoPointer(), "flush-events", cbRefPtr) | |||
| 289 | + | } | |||
| 290 | + | ||||
| 269 | fcb := func(clsPtr uintptr) { | 291 | fcb := func(clsPtr uintptr) { | ||
| 270 | fa := FrameClock{} | 292 | fa := FrameClock{} | ||
| 271 | fa.Ptr = clsPtr | 293 | fa.Ptr = clsPtr | ||
| 294 | + | cbFn := *cb | |||
| 272 | 295 | ||||
| 273 | - | cb(fa) | 296 | + | cbFn(fa) |
| 274 | 297 | ||||
| 275 | } | 298 | } | ||
| 276 | - | return gobject.SignalConnect(x.GoPointer(), "flush-events", purego.NewCallback(fcb)) | 299 | + | cbRefPtr := purego.NewCallback(fcb) |
| 300 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 301 | + | return gobject.SignalConnect(x.GoPointer(), "flush-events", cbRefPtr) | |||
| 277 | } | 302 | } | ||
| 278 | 303 | ||||
| 279 | // Emitted as the second step of toolkit and application processing | 304 | // Emitted as the second step of toolkit and application processing | ||
| @@ -281,15 +306,23 @@ func (x *FrameClock) ConnectFlushEvents(cb func(FrameClock)) uint32 { | |||||
| 281 | // | 306 | // | ||
| 282 | // Any work to update sizes and positions of application elements | 307 | // Any work to update sizes and positions of application elements | ||
| 283 | // should be performed. GTK normally handles this internally. | 308 | // should be performed. GTK normally handles this internally. | ||
| 284 | - | func (x *FrameClock) ConnectLayout(cb func(FrameClock)) uint32 { | 309 | + | func (x *FrameClock) ConnectLayout(cb *func(FrameClock)) uint32 { |
| 310 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 311 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 312 | + | return gobject.SignalConnect(x.GoPointer(), "layout", cbRefPtr) | |||
| 313 | + | } | |||
| 314 | + | ||||
| 285 | fcb := func(clsPtr uintptr) { | 315 | fcb := func(clsPtr uintptr) { | ||
| 286 | fa := FrameClock{} | 316 | fa := FrameClock{} | ||
| 287 | fa.Ptr = clsPtr | 317 | fa.Ptr = clsPtr | ||
| 318 | + | cbFn := *cb | |||
| 288 | 319 | ||||
| 289 | - | cb(fa) | 320 | + | cbFn(fa) |
| 290 | 321 | ||||
| 291 | } | 322 | } | ||
| 292 | - | return gobject.SignalConnect(x.GoPointer(), "layout", purego.NewCallback(fcb)) | 323 | + | cbRefPtr := purego.NewCallback(fcb) |
| 324 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 325 | + | return gobject.SignalConnect(x.GoPointer(), "layout", cbRefPtr) | |||
| 293 | } | 326 | } | ||
| 294 | 327 | ||||
| 295 | // Emitted as the third step of toolkit and application processing | 328 | // Emitted as the third step of toolkit and application processing | ||
| @@ -298,30 +331,46 @@ func (x *FrameClock) ConnectLayout(cb func(FrameClock)) uint32 { | |||||
| 298 | // The frame is repainted. GDK normally handles this internally and | 331 | // The frame is repainted. GDK normally handles this internally and | ||
| 299 | // emits [signal@Gdk.Surface::render] signals which are turned into | 332 | // emits [signal@Gdk.Surface::render] signals which are turned into | ||
| 300 | // [signal@Gtk.Widget::snapshot] signals by GTK. | 333 | // [signal@Gtk.Widget::snapshot] signals by GTK. | ||
| 301 | - | func (x *FrameClock) ConnectPaint(cb func(FrameClock)) uint32 { | 334 | + | func (x *FrameClock) ConnectPaint(cb *func(FrameClock)) uint32 { |
| 335 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 336 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 337 | + | return gobject.SignalConnect(x.GoPointer(), "paint", cbRefPtr) | |||
| 338 | + | } | |||
| 339 | + | ||||
| 302 | fcb := func(clsPtr uintptr) { | 340 | fcb := func(clsPtr uintptr) { | ||
| 303 | fa := FrameClock{} | 341 | fa := FrameClock{} | ||
| 304 | fa.Ptr = clsPtr | 342 | fa.Ptr = clsPtr | ||
| 343 | + | cbFn := *cb | |||
| 305 | 344 | ||||
| 306 | - | cb(fa) | 345 | + | cbFn(fa) |
| 307 | 346 | ||||
| 308 | } | 347 | } | ||
| 309 | - | return gobject.SignalConnect(x.GoPointer(), "paint", purego.NewCallback(fcb)) | 348 | + | cbRefPtr := purego.NewCallback(fcb) |
| 349 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 350 | + | return gobject.SignalConnect(x.GoPointer(), "paint", cbRefPtr) | |||
| 310 | } | 351 | } | ||
| 311 | 352 | ||||
| 312 | // Emitted after processing of the frame is finished. | 353 | // Emitted after processing of the frame is finished. | ||
| 313 | // | 354 | // | ||
| 314 | // This signal is handled internally by GTK to resume normal | 355 | // This signal is handled internally by GTK to resume normal | ||
| 315 | // event processing. Applications should not handle this signal. | 356 | // event processing. Applications should not handle this signal. | ||
| 316 | - | func (x *FrameClock) ConnectResumeEvents(cb func(FrameClock)) uint32 { | 357 | + | func (x *FrameClock) ConnectResumeEvents(cb *func(FrameClock)) uint32 { |
| 358 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 359 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 360 | + | return gobject.SignalConnect(x.GoPointer(), "resume-events", cbRefPtr) | |||
| 361 | + | } | |||
| 362 | + | ||||
| 317 | fcb := func(clsPtr uintptr) { | 363 | fcb := func(clsPtr uintptr) { | ||
| 318 | fa := FrameClock{} | 364 | fa := FrameClock{} | ||
| 319 | fa.Ptr = clsPtr | 365 | fa.Ptr = clsPtr | ||
| 366 | + | cbFn := *cb | |||
| 320 | 367 | ||||
| 321 | - | cb(fa) | 368 | + | cbFn(fa) |
| 322 | 369 | ||||
| 323 | } | 370 | } | ||
| 324 | - | return gobject.SignalConnect(x.GoPointer(), "resume-events", purego.NewCallback(fcb)) | 371 | + | cbRefPtr := purego.NewCallback(fcb) |
| 372 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 373 | + | return gobject.SignalConnect(x.GoPointer(), "resume-events", cbRefPtr) | |||
| 325 | } | 374 | } | ||
| 326 | 375 | ||||
| 327 | // Emitted as the first step of toolkit and application processing | 376 | // Emitted as the first step of toolkit and application processing | ||
| @@ -330,15 +379,23 @@ func (x *FrameClock) ConnectResumeEvents(cb func(FrameClock)) uint32 { | |||||
| 330 | // Animations should be updated using [method@Gdk.FrameClock.get_frame_time]. | 379 | // Animations should be updated using [method@Gdk.FrameClock.get_frame_time]. | ||
| 331 | // Applications can connect directly to this signal, or use | 380 | // Applications can connect directly to this signal, or use | ||
| 332 | // [method@Gtk.Widget.add_tick_callback] as a more convenient interface. | 381 | // [method@Gtk.Widget.add_tick_callback] as a more convenient interface. | ||
| 333 | - | func (x *FrameClock) ConnectUpdate(cb func(FrameClock)) uint32 { | 382 | + | func (x *FrameClock) ConnectUpdate(cb *func(FrameClock)) uint32 { |
| 383 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 384 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 385 | + | return gobject.SignalConnect(x.GoPointer(), "update", cbRefPtr) | |||
| 386 | + | } | |||
| 387 | + | ||||
| 334 | fcb := func(clsPtr uintptr) { | 388 | fcb := func(clsPtr uintptr) { | ||
| 335 | fa := FrameClock{} | 389 | fa := FrameClock{} | ||
| 336 | fa.Ptr = clsPtr | 390 | fa.Ptr = clsPtr | ||
| 391 | + | cbFn := *cb | |||
| 337 | 392 | ||||
| 338 | - | cb(fa) | 393 | + | cbFn(fa) |
| 339 | 394 | ||||
| 340 | } | 395 | } | ||
| 341 | - | return gobject.SignalConnect(x.GoPointer(), "update", purego.NewCallback(fcb)) | 396 | + | cbRefPtr := purego.NewCallback(fcb) |
| 397 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 398 | + | return gobject.SignalConnect(x.GoPointer(), "update", cbRefPtr) | |||
| 342 | } | 399 | } | ||
| 343 | 400 | ||||
| 344 | func init() { | 401 | func init() { | ||
M v4/gdk/gdkgltexture.go +4 -4
| @@ -35,10 +35,10 @@ var xNewGLTexture func(uintptr, uint, int, int, uintptr, uintptr) uintptr | |||||
| 35 | // Note that the GL texture must not be modified until @destroy is called, | 35 | // Note that the GL texture must not be modified until @destroy is called, | ||
| 36 | // which will happen when the GdkTexture object is finalized, or due to | 36 | // which will happen when the GdkTexture object is finalized, or due to | ||
| 37 | // an explicit call of [method@Gdk.GLTexture.release]. | 37 | // an explicit call of [method@Gdk.GLTexture.release]. | ||
| 38 | - | func NewGLTexture(ContextVar *GLContext, IdVar uint, WidthVar int, HeightVar int, DestroyVar glib.DestroyNotify, DataVar uintptr) *GLTexture { | 38 | + | func NewGLTexture(ContextVar *GLContext, IdVar uint, WidthVar int, HeightVar int, DestroyVar *glib.DestroyNotify, DataVar uintptr) *GLTexture { |
| 39 | var cls *GLTexture | 39 | var cls *GLTexture | ||
| 40 | 40 | ||||
| 41 | - | cret := xNewGLTexture(ContextVar.GoPointer(), IdVar, WidthVar, HeightVar, purego.NewCallback(DestroyVar), DataVar) | 41 | + | cret := xNewGLTexture(ContextVar.GoPointer(), IdVar, WidthVar, HeightVar, glib.NewCallback(DestroyVar), DataVar) |
| 42 | 42 | ||||
| 43 | if cret == 0 { | 43 | if cret == 0 { | ||
| 44 | return nil | 44 | return nil | ||
| @@ -276,9 +276,9 @@ func (x *GLTexture) Load(SizeVar int, TypeVar string, CancellableVar *gio.Cancel | |||||
| 276 | // Loads an icon asynchronously. To finish this function, see | 276 | // Loads an icon asynchronously. To finish this function, see | ||
| 277 | // g_loadable_icon_load_finish(). For the synchronous, blocking | 277 | // g_loadable_icon_load_finish(). For the synchronous, blocking | ||
| 278 | // version of this function, see g_loadable_icon_load(). | 278 | // version of this function, see g_loadable_icon_load(). | ||
| 279 | - | func (x *GLTexture) LoadAsync(SizeVar int, CancellableVar *gio.Cancellable, CallbackVar gio.AsyncReadyCallback, UserDataVar uintptr) { | 279 | + | func (x *GLTexture) LoadAsync(SizeVar int, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) { |
| 280 | 280 | ||||
| 281 | - | gio.XGLoadableIconLoadAsync(x.GoPointer(), SizeVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 281 | + | gio.XGLoadableIconLoadAsync(x.GoPointer(), SizeVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 282 | 282 | ||||
| 283 | } | 283 | } | ||
| 284 | 284 | ||||
M v4/gdk/gdkmemorytexture.go +2 -2
| @@ -262,9 +262,9 @@ func (x *MemoryTexture) Load(SizeVar int, TypeVar string, CancellableVar *gio.Ca | |||||
| 262 | // Loads an icon asynchronously. To finish this function, see | 262 | // Loads an icon asynchronously. To finish this function, see | ||
| 263 | // g_loadable_icon_load_finish(). For the synchronous, blocking | 263 | // g_loadable_icon_load_finish(). For the synchronous, blocking | ||
| 264 | // version of this function, see g_loadable_icon_load(). | 264 | // version of this function, see g_loadable_icon_load(). | ||
| 265 | - | func (x *MemoryTexture) LoadAsync(SizeVar int, CancellableVar *gio.Cancellable, CallbackVar gio.AsyncReadyCallback, UserDataVar uintptr) { | 265 | + | func (x *MemoryTexture) LoadAsync(SizeVar int, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) { |
| 266 | 266 | ||||
| 267 | - | gio.XGLoadableIconLoadAsync(x.GoPointer(), SizeVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 267 | + | gio.XGLoadableIconLoadAsync(x.GoPointer(), SizeVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 268 | 268 | ||||
| 269 | } | 269 | } | ||
| 270 | 270 | ||||
M v4/gdk/gdkmonitor.go +12 -3
| @@ -6,6 +6,7 @@ import ( | |||||
| 6 | 6 | ||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 9 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 10 | ) | 11 | ) | ||
| 11 | 12 | ||||
| @@ -195,15 +196,23 @@ func (c *Monitor) SetGoPointer(ptr uintptr) { | |||||
| 195 | } | 196 | } | ||
| 196 | 197 | ||||
| 197 | // Emitted when the output represented by @monitor gets disconnected. | 198 | // Emitted when the output represented by @monitor gets disconnected. | ||
| 198 | - | func (x *Monitor) ConnectInvalidate(cb func(Monitor)) uint32 { | 199 | + | func (x *Monitor) ConnectInvalidate(cb *func(Monitor)) uint32 { |
| 200 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 201 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 202 | + | return gobject.SignalConnect(x.GoPointer(), "invalidate", cbRefPtr) | |||
| 203 | + | } | |||
| 204 | + | ||||
| 199 | fcb := func(clsPtr uintptr) { | 205 | fcb := func(clsPtr uintptr) { | ||
| 200 | fa := Monitor{} | 206 | fa := Monitor{} | ||
| 201 | fa.Ptr = clsPtr | 207 | fa.Ptr = clsPtr | ||
| 208 | + | cbFn := *cb | |||
| 202 | 209 | ||||
| 203 | - | cb(fa) | 210 | + | cbFn(fa) |
| 204 | 211 | ||||
| 205 | } | 212 | } | ||
| 206 | - | return gobject.SignalConnect(x.GoPointer(), "invalidate", purego.NewCallback(fcb)) | 213 | + | cbRefPtr := purego.NewCallback(fcb) |
| 214 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 215 | + | return gobject.SignalConnect(x.GoPointer(), "invalidate", cbRefPtr) | |||
| 207 | } | 216 | } | ||
| 208 | 217 | ||||
| 209 | func init() { | 218 | func init() { | ||
M v4/gdk/gdkseat.go +46 -12
| @@ -2,6 +2,8 @@ | |||||
| 2 | package gdk | 2 | package gdk | ||
| 3 | 3 | ||||
| 4 | import ( | 4 | import ( | ||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 5 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 6 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 7 | "github.com/jwijenbergh/puregotk/v4/glib" | 9 | "github.com/jwijenbergh/puregotk/v4/glib" | ||
| @@ -130,27 +132,43 @@ func (c *Seat) SetGoPointer(ptr uintptr) { | |||||
| 130 | } | 132 | } | ||
| 131 | 133 | ||||
| 132 | // Emitted when a new input device is related to this seat. | 134 | // Emitted when a new input device is related to this seat. | ||
| 133 | - | func (x *Seat) ConnectDeviceAdded(cb func(Seat, uintptr)) uint32 { | 135 | + | func (x *Seat) ConnectDeviceAdded(cb *func(Seat, uintptr)) uint32 { |
| 136 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 137 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 138 | + | return gobject.SignalConnect(x.GoPointer(), "device-added", cbRefPtr) | |||
| 139 | + | } | |||
| 140 | + | ||||
| 134 | fcb := func(clsPtr uintptr, DeviceVarp uintptr) { | 141 | fcb := func(clsPtr uintptr, DeviceVarp uintptr) { | ||
| 135 | fa := Seat{} | 142 | fa := Seat{} | ||
| 136 | fa.Ptr = clsPtr | 143 | fa.Ptr = clsPtr | ||
| 144 | + | cbFn := *cb | |||
| 137 | 145 | ||||
| 138 | - | cb(fa, DeviceVarp) | 146 | + | cbFn(fa, DeviceVarp) |
| 139 | 147 | ||||
| 140 | } | 148 | } | ||
| 141 | - | return gobject.SignalConnect(x.GoPointer(), "device-added", purego.NewCallback(fcb)) | 149 | + | cbRefPtr := purego.NewCallback(fcb) |
| 150 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 151 | + | return gobject.SignalConnect(x.GoPointer(), "device-added", cbRefPtr) | |||
| 142 | } | 152 | } | ||
| 143 | 153 | ||||
| 144 | // Emitted when an input device is removed (e.g. unplugged). | 154 | // Emitted when an input device is removed (e.g. unplugged). | ||
| 145 | - | func (x *Seat) ConnectDeviceRemoved(cb func(Seat, uintptr)) uint32 { | 155 | + | func (x *Seat) ConnectDeviceRemoved(cb *func(Seat, uintptr)) uint32 { |
| 156 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 157 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 158 | + | return gobject.SignalConnect(x.GoPointer(), "device-removed", cbRefPtr) | |||
| 159 | + | } | |||
| 160 | + | ||||
| 146 | fcb := func(clsPtr uintptr, DeviceVarp uintptr) { | 161 | fcb := func(clsPtr uintptr, DeviceVarp uintptr) { | ||
| 147 | fa := Seat{} | 162 | fa := Seat{} | ||
| 148 | fa.Ptr = clsPtr | 163 | fa.Ptr = clsPtr | ||
| 164 | + | cbFn := *cb | |||
| 149 | 165 | ||||
| 150 | - | cb(fa, DeviceVarp) | 166 | + | cbFn(fa, DeviceVarp) |
| 151 | 167 | ||||
| 152 | } | 168 | } | ||
| 153 | - | return gobject.SignalConnect(x.GoPointer(), "device-removed", purego.NewCallback(fcb)) | 169 | + | cbRefPtr := purego.NewCallback(fcb) |
| 170 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 171 | + | return gobject.SignalConnect(x.GoPointer(), "device-removed", cbRefPtr) | |||
| 154 | } | 172 | } | ||
| 155 | 173 | ||||
| 156 | // Emitted whenever a new tool is made known to the seat. | 174 | // Emitted whenever a new tool is made known to the seat. | ||
| @@ -160,27 +178,43 @@ func (x *Seat) ConnectDeviceRemoved(cb func(Seat, uintptr)) uint32 { | |||||
| 160 | // [signal@Gdk.Device::tool-changed] signal accordingly. | 178 | // [signal@Gdk.Device::tool-changed] signal accordingly. | ||
| 161 | // | 179 | // | ||
| 162 | // A same tool may be used by several devices. | 180 | // A same tool may be used by several devices. | ||
| 163 | - | func (x *Seat) ConnectToolAdded(cb func(Seat, uintptr)) uint32 { | 181 | + | func (x *Seat) ConnectToolAdded(cb *func(Seat, uintptr)) uint32 { |
| 182 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 183 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 184 | + | return gobject.SignalConnect(x.GoPointer(), "tool-added", cbRefPtr) | |||
| 185 | + | } | |||
| 186 | + | ||||
| 164 | fcb := func(clsPtr uintptr, ToolVarp uintptr) { | 187 | fcb := func(clsPtr uintptr, ToolVarp uintptr) { | ||
| 165 | fa := Seat{} | 188 | fa := Seat{} | ||
| 166 | fa.Ptr = clsPtr | 189 | fa.Ptr = clsPtr | ||
| 190 | + | cbFn := *cb | |||
| 167 | 191 | ||||
| 168 | - | cb(fa, ToolVarp) | 192 | + | cbFn(fa, ToolVarp) |
| 169 | 193 | ||||
| 170 | } | 194 | } | ||
| 171 | - | return gobject.SignalConnect(x.GoPointer(), "tool-added", purego.NewCallback(fcb)) | 195 | + | cbRefPtr := purego.NewCallback(fcb) |
| 196 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 197 | + | return gobject.SignalConnect(x.GoPointer(), "tool-added", cbRefPtr) | |||
| 172 | } | 198 | } | ||
| 173 | 199 | ||||
| 174 | // Emitted whenever a tool is no longer known to this @seat. | 200 | // Emitted whenever a tool is no longer known to this @seat. | ||
| 175 | - | func (x *Seat) ConnectToolRemoved(cb func(Seat, uintptr)) uint32 { | 201 | + | func (x *Seat) ConnectToolRemoved(cb *func(Seat, uintptr)) uint32 { |
| 202 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 203 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 204 | + | return gobject.SignalConnect(x.GoPointer(), "tool-removed", cbRefPtr) | |||
| 205 | + | } | |||
| 206 | + | ||||
| 176 | fcb := func(clsPtr uintptr, ToolVarp uintptr) { | 207 | fcb := func(clsPtr uintptr, ToolVarp uintptr) { | ||
| 177 | fa := Seat{} | 208 | fa := Seat{} | ||
| 178 | fa.Ptr = clsPtr | 209 | fa.Ptr = clsPtr | ||
| 210 | + | cbFn := *cb | |||
| 179 | 211 | ||||
| 180 | - | cb(fa, ToolVarp) | 212 | + | cbFn(fa, ToolVarp) |
| 181 | 213 | ||||
| 182 | } | 214 | } | ||
| 183 | - | return gobject.SignalConnect(x.GoPointer(), "tool-removed", purego.NewCallback(fcb)) | 215 | + | cbRefPtr := purego.NewCallback(fcb) |
| 216 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 217 | + | return gobject.SignalConnect(x.GoPointer(), "tool-removed", cbRefPtr) | |||
| 184 | } | 218 | } | ||
| 185 | 219 | ||||
| 186 | func init() { | 220 | func init() { | ||
M v4/gdk/gdksurface.go +55 -15
| @@ -483,27 +483,43 @@ func (c *Surface) SetGoPointer(ptr uintptr) { | |||||
| 483 | } | 483 | } | ||
| 484 | 484 | ||||
| 485 | // Emitted when @surface starts being present on the monitor. | 485 | // Emitted when @surface starts being present on the monitor. | ||
| 486 | - | func (x *Surface) ConnectEnterMonitor(cb func(Surface, uintptr)) uint32 { | 486 | + | func (x *Surface) ConnectEnterMonitor(cb *func(Surface, uintptr)) uint32 { |
| 487 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 488 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 489 | + | return gobject.SignalConnect(x.GoPointer(), "enter-monitor", cbRefPtr) | |||
| 490 | + | } | |||
| 491 | + | ||||
| 487 | fcb := func(clsPtr uintptr, MonitorVarp uintptr) { | 492 | fcb := func(clsPtr uintptr, MonitorVarp uintptr) { | ||
| 488 | fa := Surface{} | 493 | fa := Surface{} | ||
| 489 | fa.Ptr = clsPtr | 494 | fa.Ptr = clsPtr | ||
| 495 | + | cbFn := *cb | |||
| 490 | 496 | ||||
| 491 | - | cb(fa, MonitorVarp) | 497 | + | cbFn(fa, MonitorVarp) |
| 492 | 498 | ||||
| 493 | } | 499 | } | ||
| 494 | - | return gobject.SignalConnect(x.GoPointer(), "enter-monitor", purego.NewCallback(fcb)) | 500 | + | cbRefPtr := purego.NewCallback(fcb) |
| 501 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 502 | + | return gobject.SignalConnect(x.GoPointer(), "enter-monitor", cbRefPtr) | |||
| 495 | } | 503 | } | ||
| 496 | 504 | ||||
| 497 | // Emitted when GDK receives an input event for @surface. | 505 | // Emitted when GDK receives an input event for @surface. | ||
| 498 | - | func (x *Surface) ConnectEvent(cb func(Surface, *Event) bool) uint32 { | 506 | + | func (x *Surface) ConnectEvent(cb *func(Surface, *Event) bool) uint32 { |
| 507 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 508 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 509 | + | return gobject.SignalConnect(x.GoPointer(), "event", cbRefPtr) | |||
| 510 | + | } | |||
| 511 | + | ||||
| 499 | fcb := func(clsPtr uintptr, EventVarp uintptr) bool { | 512 | fcb := func(clsPtr uintptr, EventVarp uintptr) bool { | ||
| 500 | fa := Surface{} | 513 | fa := Surface{} | ||
| 501 | fa.Ptr = clsPtr | 514 | fa.Ptr = clsPtr | ||
| 515 | + | cbFn := *cb | |||
| 502 | 516 | ||||
| 503 | - | return cb(fa, EventNewFromInternalPtr(EventVarp)) | 517 | + | return cbFn(fa, EventNewFromInternalPtr(EventVarp)) |
| 504 | 518 | ||||
| 505 | } | 519 | } | ||
| 506 | - | return gobject.SignalConnect(x.GoPointer(), "event", purego.NewCallback(fcb)) | 520 | + | cbRefPtr := purego.NewCallback(fcb) |
| 521 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 522 | + | return gobject.SignalConnect(x.GoPointer(), "event", cbRefPtr) | |||
| 507 | } | 523 | } | ||
| 508 | 524 | ||||
| 509 | // Emitted when the size of @surface is changed, or when relayout should | 525 | // Emitted when the size of @surface is changed, or when relayout should | ||
| @@ -511,39 +527,63 @@ func (x *Surface) ConnectEvent(cb func(Surface, *Event) bool) uint32 { | |||||
| 511 | // | 527 | // | ||
| 512 | // Surface size is reported in ”application pixels”, not | 528 | // Surface size is reported in ”application pixels”, not | ||
| 513 | // ”device pixels” (see gdk_surface_get_scale_factor()). | 529 | // ”device pixels” (see gdk_surface_get_scale_factor()). | ||
| 514 | - | func (x *Surface) ConnectLayout(cb func(Surface, int, int)) uint32 { | 530 | + | func (x *Surface) ConnectLayout(cb *func(Surface, int, int)) uint32 { |
| 531 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 532 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 533 | + | return gobject.SignalConnect(x.GoPointer(), "layout", cbRefPtr) | |||
| 534 | + | } | |||
| 535 | + | ||||
| 515 | fcb := func(clsPtr uintptr, WidthVarp int, HeightVarp int) { | 536 | fcb := func(clsPtr uintptr, WidthVarp int, HeightVarp int) { | ||
| 516 | fa := Surface{} | 537 | fa := Surface{} | ||
| 517 | fa.Ptr = clsPtr | 538 | fa.Ptr = clsPtr | ||
| 539 | + | cbFn := *cb | |||
| 518 | 540 | ||||
| 519 | - | cb(fa, WidthVarp, HeightVarp) | 541 | + | cbFn(fa, WidthVarp, HeightVarp) |
| 520 | 542 | ||||
| 521 | } | 543 | } | ||
| 522 | - | return gobject.SignalConnect(x.GoPointer(), "layout", purego.NewCallback(fcb)) | 544 | + | cbRefPtr := purego.NewCallback(fcb) |
| 545 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 546 | + | return gobject.SignalConnect(x.GoPointer(), "layout", cbRefPtr) | |||
| 523 | } | 547 | } | ||
| 524 | 548 | ||||
| 525 | // Emitted when @surface stops being present on the monitor. | 549 | // Emitted when @surface stops being present on the monitor. | ||
| 526 | - | func (x *Surface) ConnectLeaveMonitor(cb func(Surface, uintptr)) uint32 { | 550 | + | func (x *Surface) ConnectLeaveMonitor(cb *func(Surface, uintptr)) uint32 { |
| 551 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 552 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 553 | + | return gobject.SignalConnect(x.GoPointer(), "leave-monitor", cbRefPtr) | |||
| 554 | + | } | |||
| 555 | + | ||||
| 527 | fcb := func(clsPtr uintptr, MonitorVarp uintptr) { | 556 | fcb := func(clsPtr uintptr, MonitorVarp uintptr) { | ||
| 528 | fa := Surface{} | 557 | fa := Surface{} | ||
| 529 | fa.Ptr = clsPtr | 558 | fa.Ptr = clsPtr | ||
| 559 | + | cbFn := *cb | |||
| 530 | 560 | ||||
| 531 | - | cb(fa, MonitorVarp) | 561 | + | cbFn(fa, MonitorVarp) |
| 532 | 562 | ||||
| 533 | } | 563 | } | ||
| 534 | - | return gobject.SignalConnect(x.GoPointer(), "leave-monitor", purego.NewCallback(fcb)) | 564 | + | cbRefPtr := purego.NewCallback(fcb) |
| 565 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 566 | + | return gobject.SignalConnect(x.GoPointer(), "leave-monitor", cbRefPtr) | |||
| 535 | } | 567 | } | ||
| 536 | 568 | ||||
| 537 | // Emitted when part of the surface needs to be redrawn. | 569 | // Emitted when part of the surface needs to be redrawn. | ||
| 538 | - | func (x *Surface) ConnectRender(cb func(Surface, uintptr) bool) uint32 { | 570 | + | func (x *Surface) ConnectRender(cb *func(Surface, uintptr) bool) uint32 { |
| 571 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 572 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 573 | + | return gobject.SignalConnect(x.GoPointer(), "render", cbRefPtr) | |||
| 574 | + | } | |||
| 575 | + | ||||
| 539 | fcb := func(clsPtr uintptr, RegionVarp uintptr) bool { | 576 | fcb := func(clsPtr uintptr, RegionVarp uintptr) bool { | ||
| 540 | fa := Surface{} | 577 | fa := Surface{} | ||
| 541 | fa.Ptr = clsPtr | 578 | fa.Ptr = clsPtr | ||
| 579 | + | cbFn := *cb | |||
| 542 | 580 | ||||
| 543 | - | return cb(fa, RegionVarp) | 581 | + | return cbFn(fa, RegionVarp) |
| 544 | 582 | ||||
| 545 | } | 583 | } | ||
| 546 | - | return gobject.SignalConnect(x.GoPointer(), "render", purego.NewCallback(fcb)) | 584 | + | cbRefPtr := purego.NewCallback(fcb) |
| 585 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 586 | + | return gobject.SignalConnect(x.GoPointer(), "render", cbRefPtr) | |||
| 547 | } | 587 | } | ||
| 548 | 588 | ||||
| 549 | func init() { | 589 | func init() { | ||
M v4/gdk/gdktexture.go +2 -2
| @@ -529,9 +529,9 @@ func (x *Texture) Load(SizeVar int, TypeVar string, CancellableVar *gio.Cancella | |||||
| 529 | // Loads an icon asynchronously. To finish this function, see | 529 | // Loads an icon asynchronously. To finish this function, see | ||
| 530 | // g_loadable_icon_load_finish(). For the synchronous, blocking | 530 | // g_loadable_icon_load_finish(). For the synchronous, blocking | ||
| 531 | // version of this function, see g_loadable_icon_load(). | 531 | // version of this function, see g_loadable_icon_load(). | ||
| 532 | - | func (x *Texture) LoadAsync(SizeVar int, CancellableVar *gio.Cancellable, CallbackVar gio.AsyncReadyCallback, UserDataVar uintptr) { | 532 | + | func (x *Texture) LoadAsync(SizeVar int, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) { |
| 533 | 533 | ||||
| 534 | - | gio.XGLoadableIconLoadAsync(x.GoPointer(), SizeVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 534 | + | gio.XGLoadableIconLoadAsync(x.GoPointer(), SizeVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 535 | 535 | ||||
| 536 | } | 536 | } | ||
| 537 | 537 | ||||
M v4/gdk/gdkvulkancontext.go +13 -3
| @@ -2,6 +2,8 @@ | |||||
| 2 | package gdk | 2 | package gdk | ||
| 3 | 3 | ||||
| 4 | import ( | 4 | import ( | ||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 5 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 6 | "github.com/jwijenbergh/puregotk/v4/gio" | 8 | "github.com/jwijenbergh/puregotk/v4/gio" | ||
| 7 | "github.com/jwijenbergh/puregotk/v4/glib" | 9 | "github.com/jwijenbergh/puregotk/v4/glib" | ||
| @@ -39,15 +41,23 @@ func (c *VulkanContext) SetGoPointer(ptr uintptr) { | |||||
| 39 | // | 41 | // | ||
| 40 | // Usually this means that the swapchain had to be recreated, | 42 | // Usually this means that the swapchain had to be recreated, | ||
| 41 | // for example in response to a change of the surface size. | 43 | // for example in response to a change of the surface size. | ||
| 42 | - | func (x *VulkanContext) ConnectImagesUpdated(cb func(VulkanContext)) uint32 { | 44 | + | func (x *VulkanContext) ConnectImagesUpdated(cb *func(VulkanContext)) uint32 { |
| 45 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 46 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 47 | + | return gobject.SignalConnect(x.GoPointer(), "images-updated", cbRefPtr) | |||
| 48 | + | } | |||
| 49 | + | ||||
| 43 | fcb := func(clsPtr uintptr) { | 50 | fcb := func(clsPtr uintptr) { | ||
| 44 | fa := VulkanContext{} | 51 | fa := VulkanContext{} | ||
| 45 | fa.Ptr = clsPtr | 52 | fa.Ptr = clsPtr | ||
| 53 | + | cbFn := *cb | |||
| 46 | 54 | ||||
| 47 | - | cb(fa) | 55 | + | cbFn(fa) |
| 48 | 56 | ||||
| 49 | } | 57 | } | ||
| 50 | - | return gobject.SignalConnect(x.GoPointer(), "images-updated", purego.NewCallback(fcb)) | 58 | + | cbRefPtr := purego.NewCallback(fcb) |
| 59 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 60 | + | return gobject.SignalConnect(x.GoPointer(), "images-updated", cbRefPtr) | |||
| 51 | } | 61 | } | ||
| 52 | 62 | ||||
| 53 | // Initializes the object implementing the interface. | 63 | // Initializes the object implementing the interface. | ||
M v4/gdkpixbuf/gdk-pixbuf-animation.go +2 -2
| @@ -313,9 +313,9 @@ var xPixbufAnimationNewFromStreamAsync func(uintptr, uintptr, uintptr, uintptr) | |||||
| 313 | // When the operation is finished, `callback` will be called in the main thread. | 313 | // When the operation is finished, `callback` will be called in the main thread. | ||
| 314 | // You can then call gdk_pixbuf_animation_new_from_stream_finish() to get the | 314 | // You can then call gdk_pixbuf_animation_new_from_stream_finish() to get the | ||
| 315 | // result of the operation. | 315 | // result of the operation. | ||
| 316 | - | func PixbufAnimationNewFromStreamAsync(StreamVar *gio.InputStream, CancellableVar *gio.Cancellable, CallbackVar gio.AsyncReadyCallback, UserDataVar uintptr) { | 316 | + | func PixbufAnimationNewFromStreamAsync(StreamVar *gio.InputStream, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) { |
| 317 | 317 | ||||
| 318 | - | xPixbufAnimationNewFromStreamAsync(StreamVar.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 318 | + | xPixbufAnimationNewFromStreamAsync(StreamVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 319 | 319 | ||||
| 320 | } | 320 | } | ||
| 321 | 321 | ||||
M v4/gdkpixbuf/gdk-pixbuf-loader.go +44 -12
| @@ -309,15 +309,23 @@ func (c *PixbufLoader) SetGoPointer(ptr uintptr) { | |||||
| 309 | // After this signal is emitted, applications can call | 309 | // After this signal is emitted, applications can call | ||
| 310 | // gdk_pixbuf_loader_get_pixbuf() to fetch the partially-loaded | 310 | // gdk_pixbuf_loader_get_pixbuf() to fetch the partially-loaded | ||
| 311 | // pixbuf. | 311 | // pixbuf. | ||
| 312 | - | func (x *PixbufLoader) ConnectAreaPrepared(cb func(PixbufLoader)) uint32 { | 312 | + | func (x *PixbufLoader) ConnectAreaPrepared(cb *func(PixbufLoader)) uint32 { |
| 313 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 314 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 315 | + | return gobject.SignalConnect(x.GoPointer(), "area-prepared", cbRefPtr) | |||
| 316 | + | } | |||
| 317 | + | ||||
| 313 | fcb := func(clsPtr uintptr) { | 318 | fcb := func(clsPtr uintptr) { | ||
| 314 | fa := PixbufLoader{} | 319 | fa := PixbufLoader{} | ||
| 315 | fa.Ptr = clsPtr | 320 | fa.Ptr = clsPtr | ||
| 321 | + | cbFn := *cb | |||
| 316 | 322 | ||||
| 317 | - | cb(fa) | 323 | + | cbFn(fa) |
| 318 | 324 | ||||
| 319 | } | 325 | } | ||
| 320 | - | return gobject.SignalConnect(x.GoPointer(), "area-prepared", purego.NewCallback(fcb)) | 326 | + | cbRefPtr := purego.NewCallback(fcb) |
| 327 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 328 | + | return gobject.SignalConnect(x.GoPointer(), "area-prepared", cbRefPtr) | |||
| 321 | } | 329 | } | ||
| 322 | 330 | ||||
| 323 | // This signal is emitted when a significant area of the image being | 331 | // This signal is emitted when a significant area of the image being | ||
| @@ -328,15 +336,23 @@ func (x *PixbufLoader) ConnectAreaPrepared(cb func(PixbufLoader)) uint32 { | |||||
| 328 | // | 336 | // | ||
| 329 | // Applications can use this signal to know when to repaint | 337 | // Applications can use this signal to know when to repaint | ||
| 330 | // areas of an image that is being loaded. | 338 | // areas of an image that is being loaded. | ||
| 331 | - | func (x *PixbufLoader) ConnectAreaUpdated(cb func(PixbufLoader, int, int, int, int)) uint32 { | 339 | + | func (x *PixbufLoader) ConnectAreaUpdated(cb *func(PixbufLoader, int, int, int, int)) uint32 { |
| 340 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 341 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 342 | + | return gobject.SignalConnect(x.GoPointer(), "area-updated", cbRefPtr) | |||
| 343 | + | } | |||
| 344 | + | ||||
| 332 | fcb := func(clsPtr uintptr, XVarp int, YVarp int, WidthVarp int, HeightVarp int) { | 345 | fcb := func(clsPtr uintptr, XVarp int, YVarp int, WidthVarp int, HeightVarp int) { | ||
| 333 | fa := PixbufLoader{} | 346 | fa := PixbufLoader{} | ||
| 334 | fa.Ptr = clsPtr | 347 | fa.Ptr = clsPtr | ||
| 348 | + | cbFn := *cb | |||
| 335 | 349 | ||||
| 336 | - | cb(fa, XVarp, YVarp, WidthVarp, HeightVarp) | 350 | + | cbFn(fa, XVarp, YVarp, WidthVarp, HeightVarp) |
| 337 | 351 | ||||
| 338 | } | 352 | } | ||
| 339 | - | return gobject.SignalConnect(x.GoPointer(), "area-updated", purego.NewCallback(fcb)) | 353 | + | cbRefPtr := purego.NewCallback(fcb) |
| 354 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 355 | + | return gobject.SignalConnect(x.GoPointer(), "area-updated", cbRefPtr) | |||
| 340 | } | 356 | } | ||
| 341 | 357 | ||||
| 342 | // This signal is emitted when gdk_pixbuf_loader_close() is called. | 358 | // This signal is emitted when gdk_pixbuf_loader_close() is called. | ||
| @@ -344,15 +360,23 @@ func (x *PixbufLoader) ConnectAreaUpdated(cb func(PixbufLoader, int, int, int, i | |||||
| 344 | // It can be used by different parts of an application to receive | 360 | // It can be used by different parts of an application to receive | ||
| 345 | // notification when an image loader is closed by the code that | 361 | // notification when an image loader is closed by the code that | ||
| 346 | // drives it. | 362 | // drives it. | ||
| 347 | - | func (x *PixbufLoader) ConnectClosed(cb func(PixbufLoader)) uint32 { | 363 | + | func (x *PixbufLoader) ConnectClosed(cb *func(PixbufLoader)) uint32 { |
| 364 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 365 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 366 | + | return gobject.SignalConnect(x.GoPointer(), "closed", cbRefPtr) | |||
| 367 | + | } | |||
| 368 | + | ||||
| 348 | fcb := func(clsPtr uintptr) { | 369 | fcb := func(clsPtr uintptr) { | ||
| 349 | fa := PixbufLoader{} | 370 | fa := PixbufLoader{} | ||
| 350 | fa.Ptr = clsPtr | 371 | fa.Ptr = clsPtr | ||
| 372 | + | cbFn := *cb | |||
| 351 | 373 | ||||
| 352 | - | cb(fa) | 374 | + | cbFn(fa) |
| 353 | 375 | ||||
| 354 | } | 376 | } | ||
| 355 | - | return gobject.SignalConnect(x.GoPointer(), "closed", purego.NewCallback(fcb)) | 377 | + | cbRefPtr := purego.NewCallback(fcb) |
| 378 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 379 | + | return gobject.SignalConnect(x.GoPointer(), "closed", cbRefPtr) | |||
| 356 | } | 380 | } | ||
| 357 | 381 | ||||
| 358 | // This signal is emitted when the pixbuf loader has been fed the | 382 | // This signal is emitted when the pixbuf loader has been fed the | ||
| @@ -362,15 +386,23 @@ func (x *PixbufLoader) ConnectClosed(cb func(PixbufLoader)) uint32 { | |||||
| 362 | // Applications can call gdk_pixbuf_loader_set_size() in response | 386 | // Applications can call gdk_pixbuf_loader_set_size() in response | ||
| 363 | // to this signal to set the desired size to which the image | 387 | // to this signal to set the desired size to which the image | ||
| 364 | // should be scaled. | 388 | // should be scaled. | ||
| 365 | - | func (x *PixbufLoader) ConnectSizePrepared(cb func(PixbufLoader, int, int)) uint32 { | 389 | + | func (x *PixbufLoader) ConnectSizePrepared(cb *func(PixbufLoader, int, int)) uint32 { |
| 390 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 391 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 392 | + | return gobject.SignalConnect(x.GoPointer(), "size-prepared", cbRefPtr) | |||
| 393 | + | } | |||
| 394 | + | ||||
| 366 | fcb := func(clsPtr uintptr, WidthVarp int, HeightVarp int) { | 395 | fcb := func(clsPtr uintptr, WidthVarp int, HeightVarp int) { | ||
| 367 | fa := PixbufLoader{} | 396 | fa := PixbufLoader{} | ||
| 368 | fa.Ptr = clsPtr | 397 | fa.Ptr = clsPtr | ||
| 398 | + | cbFn := *cb | |||
| 369 | 399 | ||||
| 370 | - | cb(fa, WidthVarp, HeightVarp) | 400 | + | cbFn(fa, WidthVarp, HeightVarp) |
| 371 | 401 | ||||
| 372 | } | 402 | } | ||
| 373 | - | return gobject.SignalConnect(x.GoPointer(), "size-prepared", purego.NewCallback(fcb)) | 403 | + | cbRefPtr := purego.NewCallback(fcb) |
| 404 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 405 | + | return gobject.SignalConnect(x.GoPointer(), "size-prepared", cbRefPtr) | |||
| 374 | } | 406 | } | ||
| 375 | 407 | ||||
| 376 | func init() { | 408 | func init() { | ||
M v4/gdkpixbuf/gdk-pixbuf.go +18 -18
| @@ -212,10 +212,10 @@ var xNewPixbufFromData func(uintptr, Colorspace, bool, int, int, int, int, uintp | |||||
| 212 | // it is its responsibility to free the pixel array. | 212 | // it is its responsibility to free the pixel array. | ||
| 213 | // | 213 | // | ||
| 214 | // See also: [ctor@GdkPixbuf.Pixbuf.new_from_bytes] | 214 | // See also: [ctor@GdkPixbuf.Pixbuf.new_from_bytes] | ||
| 215 | - | func NewPixbufFromData(DataVar uintptr, ColorspaceVar Colorspace, HasAlphaVar bool, BitsPerSampleVar int, WidthVar int, HeightVar int, RowstrideVar int, DestroyFnVar PixbufDestroyNotify, DestroyFnDataVar uintptr) *Pixbuf { | 215 | + | func NewPixbufFromData(DataVar uintptr, ColorspaceVar Colorspace, HasAlphaVar bool, BitsPerSampleVar int, WidthVar int, HeightVar int, RowstrideVar int, DestroyFnVar *PixbufDestroyNotify, DestroyFnDataVar uintptr) *Pixbuf { |
| 216 | var cls *Pixbuf | 216 | var cls *Pixbuf | ||
| 217 | 217 | ||||
| 218 | - | cret := xNewPixbufFromData(DataVar, ColorspaceVar, HasAlphaVar, BitsPerSampleVar, WidthVar, HeightVar, RowstrideVar, purego.NewCallback(DestroyFnVar), DestroyFnDataVar) | 218 | + | cret := xNewPixbufFromData(DataVar, ColorspaceVar, HasAlphaVar, BitsPerSampleVar, WidthVar, HeightVar, RowstrideVar, glib.NewCallback(DestroyFnVar), DestroyFnDataVar) |
| 219 | 219 | ||||
| 220 | if cret == 0 { | 220 | if cret == 0 { | ||
| 221 | return nil | 221 | return nil | ||
| @@ -1138,9 +1138,9 @@ var xPixbufSaveToCallback func(uintptr, uintptr, uintptr, string, **glib.Error, | |||||
| 1138 | // function generates. | 1138 | // function generates. | ||
| 1139 | // | 1139 | // | ||
| 1140 | // See [method@GdkPixbuf.Pixbuf.save] for more details. | 1140 | // See [method@GdkPixbuf.Pixbuf.save] for more details. | ||
| 1141 | - | func (x *Pixbuf) SaveToCallback(SaveFuncVar PixbufSaveFunc, UserDataVar uintptr, TypeVar string, ErrorVar **glib.Error, varArgs ...interface{}) bool { | 1141 | + | func (x *Pixbuf) SaveToCallback(SaveFuncVar *PixbufSaveFunc, UserDataVar uintptr, TypeVar string, ErrorVar **glib.Error, varArgs ...interface{}) bool { |
| 1142 | 1142 | ||||
| 1143 | - | cret := xPixbufSaveToCallback(x.GoPointer(), purego.NewCallback(SaveFuncVar), UserDataVar, TypeVar, ErrorVar, varArgs...) | 1143 | + | cret := xPixbufSaveToCallback(x.GoPointer(), glib.NewCallback(SaveFuncVar), UserDataVar, TypeVar, ErrorVar, varArgs...) |
| 1144 | return cret | 1144 | return cret | ||
| 1145 | } | 1145 | } | ||
| 1146 | 1146 | ||||
| @@ -1154,10 +1154,10 @@ var xPixbufSaveToCallbackv func(uintptr, uintptr, uintptr, string, []string, []s | |||||
| 1154 | // If @error is set, `FALSE` will be returned. | 1154 | // If @error is set, `FALSE` will be returned. | ||
| 1155 | // | 1155 | // | ||
| 1156 | // See [method@GdkPixbuf.Pixbuf.save_to_callback] for more details. | 1156 | // See [method@GdkPixbuf.Pixbuf.save_to_callback] for more details. | ||
| 1157 | - | func (x *Pixbuf) SaveToCallbackv(SaveFuncVar PixbufSaveFunc, UserDataVar uintptr, TypeVar string, OptionKeysVar []string, OptionValuesVar []string) (bool, error) { | 1157 | + | func (x *Pixbuf) SaveToCallbackv(SaveFuncVar *PixbufSaveFunc, UserDataVar uintptr, TypeVar string, OptionKeysVar []string, OptionValuesVar []string) (bool, error) { |
| 1158 | var cerr *glib.Error | 1158 | var cerr *glib.Error | ||
| 1159 | 1159 | ||||
| 1160 | - | cret := xPixbufSaveToCallbackv(x.GoPointer(), purego.NewCallback(SaveFuncVar), UserDataVar, TypeVar, OptionKeysVar, OptionValuesVar, &cerr) | 1160 | + | cret := xPixbufSaveToCallbackv(x.GoPointer(), glib.NewCallback(SaveFuncVar), UserDataVar, TypeVar, OptionKeysVar, OptionValuesVar, &cerr) |
| 1161 | if cerr == nil { | 1161 | if cerr == nil { | ||
| 1162 | return cret, nil | 1162 | return cret, nil | ||
| 1163 | } | 1163 | } | ||
| @@ -1195,9 +1195,9 @@ var xPixbufSaveToStreamAsync func(uintptr, uintptr, string, uintptr, uintptr, ui | |||||
| 1195 | // | 1195 | // | ||
| 1196 | // You can then call gdk_pixbuf_save_to_stream_finish() to get the result of | 1196 | // You can then call gdk_pixbuf_save_to_stream_finish() to get the result of | ||
| 1197 | // the operation. | 1197 | // the operation. | ||
| 1198 | - | func (x *Pixbuf) SaveToStreamAsync(StreamVar *gio.OutputStream, TypeVar string, CancellableVar *gio.Cancellable, CallbackVar gio.AsyncReadyCallback, UserDataVar uintptr, varArgs ...interface{}) { | 1198 | + | func (x *Pixbuf) SaveToStreamAsync(StreamVar *gio.OutputStream, TypeVar string, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr, varArgs ...interface{}) { |
| 1199 | 1199 | ||||
| 1200 | - | xPixbufSaveToStreamAsync(x.GoPointer(), StreamVar.GoPointer(), TypeVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar, varArgs...) | 1200 | + | xPixbufSaveToStreamAsync(x.GoPointer(), StreamVar.GoPointer(), TypeVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar, varArgs...) |
| 1201 | 1201 | ||||
| 1202 | } | 1202 | } | ||
| 1203 | 1203 | ||||
| @@ -1231,9 +1231,9 @@ var xPixbufSaveToStreamvAsync func(uintptr, uintptr, string, uintptr, uintptr, u | |||||
| 1231 | // | 1231 | // | ||
| 1232 | // You can then call gdk_pixbuf_save_to_stream_finish() to get the result of | 1232 | // You can then call gdk_pixbuf_save_to_stream_finish() to get the result of | ||
| 1233 | // the operation. | 1233 | // the operation. | ||
| 1234 | - | func (x *Pixbuf) SaveToStreamvAsync(StreamVar *gio.OutputStream, TypeVar string, OptionKeysVar uintptr, OptionValuesVar uintptr, CancellableVar *gio.Cancellable, CallbackVar gio.AsyncReadyCallback, UserDataVar uintptr) { | 1234 | + | func (x *Pixbuf) SaveToStreamvAsync(StreamVar *gio.OutputStream, TypeVar string, OptionKeysVar uintptr, OptionValuesVar uintptr, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) { |
| 1235 | 1235 | ||||
| 1236 | - | xPixbufSaveToStreamvAsync(x.GoPointer(), StreamVar.GoPointer(), TypeVar, OptionKeysVar, OptionValuesVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 1236 | + | xPixbufSaveToStreamvAsync(x.GoPointer(), StreamVar.GoPointer(), TypeVar, OptionKeysVar, OptionValuesVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 1237 | 1237 | ||||
| 1238 | } | 1238 | } | ||
| 1239 | 1239 | ||||
| @@ -1403,9 +1403,9 @@ func (x *Pixbuf) Load(SizeVar int, TypeVar string, CancellableVar *gio.Cancellab | |||||
| 1403 | // Loads an icon asynchronously. To finish this function, see | 1403 | // Loads an icon asynchronously. To finish this function, see | ||
| 1404 | // g_loadable_icon_load_finish(). For the synchronous, blocking | 1404 | // g_loadable_icon_load_finish(). For the synchronous, blocking | ||
| 1405 | // version of this function, see g_loadable_icon_load(). | 1405 | // version of this function, see g_loadable_icon_load(). | ||
| 1406 | - | func (x *Pixbuf) LoadAsync(SizeVar int, CancellableVar *gio.Cancellable, CallbackVar gio.AsyncReadyCallback, UserDataVar uintptr) { | 1406 | + | func (x *Pixbuf) LoadAsync(SizeVar int, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) { |
| 1407 | 1407 | ||||
| 1408 | - | gio.XGLoadableIconLoadAsync(x.GoPointer(), SizeVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 1408 | + | gio.XGLoadableIconLoadAsync(x.GoPointer(), SizeVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 1409 | 1409 | ||||
| 1410 | } | 1410 | } | ||
| 1411 | 1411 | ||||
| @@ -1461,9 +1461,9 @@ var xPixbufGetFileInfoAsync func(string, uintptr, uintptr, uintptr) | |||||
| 1461 | // When the operation is finished, @callback will be called in the | 1461 | // When the operation is finished, @callback will be called in the | ||
| 1462 | // main thread. You can then call gdk_pixbuf_get_file_info_finish() to | 1462 | // main thread. You can then call gdk_pixbuf_get_file_info_finish() to | ||
| 1463 | // get the result of the operation. | 1463 | // get the result of the operation. | ||
| 1464 | - | func PixbufGetFileInfoAsync(FilenameVar string, CancellableVar *gio.Cancellable, CallbackVar gio.AsyncReadyCallback, UserDataVar uintptr) { | 1464 | + | func PixbufGetFileInfoAsync(FilenameVar string, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) { |
| 1465 | 1465 | ||||
| 1466 | - | xPixbufGetFileInfoAsync(FilenameVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 1466 | + | xPixbufGetFileInfoAsync(FilenameVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 1467 | 1467 | ||||
| 1468 | } | 1468 | } | ||
| 1469 | 1469 | ||||
| @@ -1528,9 +1528,9 @@ var xPixbufNewFromStreamAsync func(uintptr, uintptr, uintptr, uintptr) | |||||
| 1528 | // When the operation is finished, @callback will be called in the main thread. | 1528 | // When the operation is finished, @callback will be called in the main thread. | ||
| 1529 | // You can then call gdk_pixbuf_new_from_stream_finish() to get the result of | 1529 | // You can then call gdk_pixbuf_new_from_stream_finish() to get the result of | ||
| 1530 | // the operation. | 1530 | // the operation. | ||
| 1531 | - | func PixbufNewFromStreamAsync(StreamVar *gio.InputStream, CancellableVar *gio.Cancellable, CallbackVar gio.AsyncReadyCallback, UserDataVar uintptr) { | 1531 | + | func PixbufNewFromStreamAsync(StreamVar *gio.InputStream, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) { |
| 1532 | 1532 | ||||
| 1533 | - | xPixbufNewFromStreamAsync(StreamVar.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 1533 | + | xPixbufNewFromStreamAsync(StreamVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 1534 | 1534 | ||||
| 1535 | } | 1535 | } | ||
| 1536 | 1536 | ||||
| @@ -1543,9 +1543,9 @@ var xPixbufNewFromStreamAtScaleAsync func(uintptr, int, int, bool, uintptr, uint | |||||
| 1543 | // | 1543 | // | ||
| 1544 | // When the operation is finished, @callback will be called in the main thread. | 1544 | // When the operation is finished, @callback will be called in the main thread. | ||
| 1545 | // You can then call gdk_pixbuf_new_from_stream_finish() to get the result of the operation. | 1545 | // You can then call gdk_pixbuf_new_from_stream_finish() to get the result of the operation. | ||
| 1546 | - | func PixbufNewFromStreamAtScaleAsync(StreamVar *gio.InputStream, WidthVar int, HeightVar int, PreserveAspectRatioVar bool, CancellableVar *gio.Cancellable, CallbackVar gio.AsyncReadyCallback, UserDataVar uintptr) { | 1546 | + | func PixbufNewFromStreamAtScaleAsync(StreamVar *gio.InputStream, WidthVar int, HeightVar int, PreserveAspectRatioVar bool, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) { |
| 1547 | 1547 | ||||
| 1548 | - | xPixbufNewFromStreamAtScaleAsync(StreamVar.GoPointer(), WidthVar, HeightVar, PreserveAspectRatioVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 1548 | + | xPixbufNewFromStreamAtScaleAsync(StreamVar.GoPointer(), WidthVar, HeightVar, PreserveAspectRatioVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 1549 | 1549 | ||||
| 1550 | } | 1550 | } | ||
| 1551 | 1551 | ||||
M v4/gio/gappinfo.go +38 -14
| @@ -103,7 +103,7 @@ type AppInfo interface { | |||||
| 103 | GetSupportedTypes() []string | 103 | GetSupportedTypes() []string | ||
| 104 | Launch(FilesVar *glib.List, ContextVar *AppLaunchContext) bool | 104 | Launch(FilesVar *glib.List, ContextVar *AppLaunchContext) bool | ||
| 105 | LaunchUris(UrisVar *glib.List, ContextVar *AppLaunchContext) bool | 105 | LaunchUris(UrisVar *glib.List, ContextVar *AppLaunchContext) bool | ||
| 106 | - | LaunchUrisAsync(UrisVar *glib.List, ContextVar *AppLaunchContext, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 106 | + | LaunchUrisAsync(UrisVar *glib.List, ContextVar *AppLaunchContext, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 107 | LaunchUrisFinish(ResultVar AsyncResult) bool | 107 | LaunchUrisFinish(ResultVar AsyncResult) bool | ||
| 108 | RemoveSupportsType(ContentTypeVar string) bool | 108 | RemoveSupportsType(ContentTypeVar string) bool | ||
| 109 | SetAsDefaultForExtension(ExtensionVar string) bool | 109 | SetAsDefaultForExtension(ExtensionVar string) bool | ||
| @@ -331,9 +331,9 @@ func (x *AppInfoBase) LaunchUris(UrisVar *glib.List, ContextVar *AppLaunchContex | |||||
| 331 | // waits for activation in case of D-Bus–activated applications and also provides | 331 | // waits for activation in case of D-Bus–activated applications and also provides | ||
| 332 | // extended error information for sandboxed applications, see notes for | 332 | // extended error information for sandboxed applications, see notes for | ||
| 333 | // g_app_info_launch_default_for_uri_async(). | 333 | // g_app_info_launch_default_for_uri_async(). | ||
| 334 | - | func (x *AppInfoBase) LaunchUrisAsync(UrisVar *glib.List, ContextVar *AppLaunchContext, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 334 | + | func (x *AppInfoBase) LaunchUrisAsync(UrisVar *glib.List, ContextVar *AppLaunchContext, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 335 | 335 | ||||
| 336 | - | XGAppInfoLaunchUrisAsync(x.GoPointer(), UrisVar, ContextVar.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 336 | + | XGAppInfoLaunchUrisAsync(x.GoPointer(), UrisVar, ContextVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 337 | 337 | ||||
| 338 | } | 338 | } | ||
| 339 | 339 | ||||
| @@ -596,9 +596,9 @@ var xAppInfoLaunchDefaultForUriAsync func(string, uintptr, uintptr, uintptr, uin | |||||
| 596 | // This is also useful if you want to be sure that the D-Bus–activated | 596 | // This is also useful if you want to be sure that the D-Bus–activated | ||
| 597 | // applications are really started before termination and if you are interested | 597 | // applications are really started before termination and if you are interested | ||
| 598 | // in receiving error information from their activation. | 598 | // in receiving error information from their activation. | ||
| 599 | - | func AppInfoLaunchDefaultForUriAsync(UriVar string, ContextVar *AppLaunchContext, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 599 | + | func AppInfoLaunchDefaultForUriAsync(UriVar string, ContextVar *AppLaunchContext, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 600 | 600 | ||||
| 601 | - | xAppInfoLaunchDefaultForUriAsync(UriVar, ContextVar.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 601 | + | xAppInfoLaunchDefaultForUriAsync(UriVar, ContextVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 602 | 602 | ||||
| 603 | } | 603 | } | ||
| 604 | 604 | ||||
| @@ -736,15 +736,23 @@ func (c *AppLaunchContext) SetGoPointer(ptr uintptr) { | |||||
| 736 | // The #GAppLaunchContext::launch-failed signal is emitted when a #GAppInfo launch | 736 | // The #GAppLaunchContext::launch-failed signal is emitted when a #GAppInfo launch | ||
| 737 | // fails. The startup notification id is provided, so that the launcher | 737 | // fails. The startup notification id is provided, so that the launcher | ||
| 738 | // can cancel the startup notification. | 738 | // can cancel the startup notification. | ||
| 739 | - | func (x *AppLaunchContext) ConnectLaunchFailed(cb func(AppLaunchContext, string)) uint32 { | 739 | + | func (x *AppLaunchContext) ConnectLaunchFailed(cb *func(AppLaunchContext, string)) uint32 { |
| 740 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 741 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 742 | + | return gobject.SignalConnect(x.GoPointer(), "launch-failed", cbRefPtr) | |||
| 743 | + | } | |||
| 744 | + | ||||
| 740 | fcb := func(clsPtr uintptr, StartupNotifyIdVarp string) { | 745 | fcb := func(clsPtr uintptr, StartupNotifyIdVarp string) { | ||
| 741 | fa := AppLaunchContext{} | 746 | fa := AppLaunchContext{} | ||
| 742 | fa.Ptr = clsPtr | 747 | fa.Ptr = clsPtr | ||
| 748 | + | cbFn := *cb | |||
| 743 | 749 | ||||
| 744 | - | cb(fa, StartupNotifyIdVarp) | 750 | + | cbFn(fa, StartupNotifyIdVarp) |
| 745 | 751 | ||||
| 746 | } | 752 | } | ||
| 747 | - | return gobject.SignalConnect(x.GoPointer(), "launch-failed", purego.NewCallback(fcb)) | 753 | + | cbRefPtr := purego.NewCallback(fcb) |
| 754 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 755 | + | return gobject.SignalConnect(x.GoPointer(), "launch-failed", cbRefPtr) | |||
| 748 | } | 756 | } | ||
| 749 | 757 | ||||
| 750 | // The #GAppLaunchContext::launch-started signal is emitted when a #GAppInfo is | 758 | // The #GAppLaunchContext::launch-started signal is emitted when a #GAppInfo is | ||
| @@ -761,15 +769,23 @@ func (x *AppLaunchContext) ConnectLaunchFailed(cb func(AppLaunchContext, string) | |||||
| 761 | // | 769 | // | ||
| 762 | // It is guaranteed that this signal is followed by either a #GAppLaunchContext::launched or | 770 | // It is guaranteed that this signal is followed by either a #GAppLaunchContext::launched or | ||
| 763 | // #GAppLaunchContext::launch-failed signal. | 771 | // #GAppLaunchContext::launch-failed signal. | ||
| 764 | - | func (x *AppLaunchContext) ConnectLaunchStarted(cb func(AppLaunchContext, uintptr, uintptr)) uint32 { | 772 | + | func (x *AppLaunchContext) ConnectLaunchStarted(cb *func(AppLaunchContext, uintptr, uintptr)) uint32 { |
| 773 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 774 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 775 | + | return gobject.SignalConnect(x.GoPointer(), "launch-started", cbRefPtr) | |||
| 776 | + | } | |||
| 777 | + | ||||
| 765 | fcb := func(clsPtr uintptr, InfoVarp uintptr, PlatformDataVarp uintptr) { | 778 | fcb := func(clsPtr uintptr, InfoVarp uintptr, PlatformDataVarp uintptr) { | ||
| 766 | fa := AppLaunchContext{} | 779 | fa := AppLaunchContext{} | ||
| 767 | fa.Ptr = clsPtr | 780 | fa.Ptr = clsPtr | ||
| 781 | + | cbFn := *cb | |||
| 768 | 782 | ||||
| 769 | - | cb(fa, InfoVarp, PlatformDataVarp) | 783 | + | cbFn(fa, InfoVarp, PlatformDataVarp) |
| 770 | 784 | ||||
| 771 | } | 785 | } | ||
| 772 | - | return gobject.SignalConnect(x.GoPointer(), "launch-started", purego.NewCallback(fcb)) | 786 | + | cbRefPtr := purego.NewCallback(fcb) |
| 787 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 788 | + | return gobject.SignalConnect(x.GoPointer(), "launch-started", cbRefPtr) | |||
| 773 | } | 789 | } | ||
| 774 | 790 | ||||
| 775 | // The #GAppLaunchContext::launched signal is emitted when a #GAppInfo is successfully | 791 | // The #GAppLaunchContext::launched signal is emitted when a #GAppInfo is successfully | ||
| @@ -781,15 +797,23 @@ func (x *AppLaunchContext) ConnectLaunchStarted(cb func(AppLaunchContext, uintpt | |||||
| 781 | // Since 2.72 the `pid` may be 0 if the process id wasn't known (for | 797 | // Since 2.72 the `pid` may be 0 if the process id wasn't known (for | ||
| 782 | // example if the process was launched via D-Bus). The `pid` may not be | 798 | // example if the process was launched via D-Bus). The `pid` may not be | ||
| 783 | // set at all in subsequent releases. | 799 | // set at all in subsequent releases. | ||
| 784 | - | func (x *AppLaunchContext) ConnectLaunched(cb func(AppLaunchContext, uintptr, uintptr)) uint32 { | 800 | + | func (x *AppLaunchContext) ConnectLaunched(cb *func(AppLaunchContext, uintptr, uintptr)) uint32 { |
| 801 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 802 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 803 | + | return gobject.SignalConnect(x.GoPointer(), "launched", cbRefPtr) | |||
| 804 | + | } | |||
| 805 | + | ||||
| 785 | fcb := func(clsPtr uintptr, InfoVarp uintptr, PlatformDataVarp uintptr) { | 806 | fcb := func(clsPtr uintptr, InfoVarp uintptr, PlatformDataVarp uintptr) { | ||
| 786 | fa := AppLaunchContext{} | 807 | fa := AppLaunchContext{} | ||
| 787 | fa.Ptr = clsPtr | 808 | fa.Ptr = clsPtr | ||
| 809 | + | cbFn := *cb | |||
| 788 | 810 | ||||
| 789 | - | cb(fa, InfoVarp, PlatformDataVarp) | 811 | + | cbFn(fa, InfoVarp, PlatformDataVarp) |
| 790 | 812 | ||||
| 791 | } | 813 | } | ||
| 792 | - | return gobject.SignalConnect(x.GoPointer(), "launched", purego.NewCallback(fcb)) | 814 | + | cbRefPtr := purego.NewCallback(fcb) |
| 815 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 816 | + | return gobject.SignalConnect(x.GoPointer(), "launched", cbRefPtr) | |||
| 793 | } | 817 | } | ||
| 794 | 818 | ||||
| 795 | func init() { | 819 | func init() { | ||
M v4/gio/gapplication.go +77 -21
| @@ -907,29 +907,45 @@ func (c *Application) SetGoPointer(ptr uintptr) { | |||||
| 907 | 907 | ||||
| 908 | // The ::activate signal is emitted on the primary instance when an | 908 | // The ::activate signal is emitted on the primary instance when an | ||
| 909 | // activation occurs. See g_application_activate(). | 909 | // activation occurs. See g_application_activate(). | ||
| 910 | - | func (x *Application) ConnectActivate(cb func(Application)) uint32 { | 910 | + | func (x *Application) ConnectActivate(cb *func(Application)) uint32 { |
| 911 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 912 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 913 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 914 | + | } | |||
| 915 | + | ||||
| 911 | fcb := func(clsPtr uintptr) { | 916 | fcb := func(clsPtr uintptr) { | ||
| 912 | fa := Application{} | 917 | fa := Application{} | ||
| 913 | fa.Ptr = clsPtr | 918 | fa.Ptr = clsPtr | ||
| 919 | + | cbFn := *cb | |||
| 914 | 920 | ||||
| 915 | - | cb(fa) | 921 | + | cbFn(fa) |
| 916 | 922 | ||||
| 917 | } | 923 | } | ||
| 918 | - | return gobject.SignalConnect(x.GoPointer(), "activate", purego.NewCallback(fcb)) | 924 | + | cbRefPtr := purego.NewCallback(fcb) |
| 925 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 926 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 919 | } | 927 | } | ||
| 920 | 928 | ||||
| 921 | // The ::command-line signal is emitted on the primary instance when | 929 | // The ::command-line signal is emitted on the primary instance when | ||
| 922 | // a commandline is not handled locally. See g_application_run() and | 930 | // a commandline is not handled locally. See g_application_run() and | ||
| 923 | // the #GApplicationCommandLine documentation for more information. | 931 | // the #GApplicationCommandLine documentation for more information. | ||
| 924 | - | func (x *Application) ConnectCommandLine(cb func(Application, uintptr) int) uint32 { | 932 | + | func (x *Application) ConnectCommandLine(cb *func(Application, uintptr) int) uint32 { |
| 933 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 934 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 935 | + | return gobject.SignalConnect(x.GoPointer(), "command-line", cbRefPtr) | |||
| 936 | + | } | |||
| 937 | + | ||||
| 925 | fcb := func(clsPtr uintptr, CommandLineVarp uintptr) int { | 938 | fcb := func(clsPtr uintptr, CommandLineVarp uintptr) int { | ||
| 926 | fa := Application{} | 939 | fa := Application{} | ||
| 927 | fa.Ptr = clsPtr | 940 | fa.Ptr = clsPtr | ||
| 941 | + | cbFn := *cb | |||
| 928 | 942 | ||||
| 929 | - | return cb(fa, CommandLineVarp) | 943 | + | return cbFn(fa, CommandLineVarp) |
| 930 | 944 | ||||
| 931 | } | 945 | } | ||
| 932 | - | return gobject.SignalConnect(x.GoPointer(), "command-line", purego.NewCallback(fcb)) | 946 | + | cbRefPtr := purego.NewCallback(fcb) |
| 947 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 948 | + | return gobject.SignalConnect(x.GoPointer(), "command-line", cbRefPtr) | |||
| 933 | } | 949 | } | ||
| 934 | 950 | ||||
| 935 | // The ::handle-local-options signal is emitted on the local instance | 951 | // The ::handle-local-options signal is emitted on the local instance | ||
| @@ -973,15 +989,23 @@ func (x *Application) ConnectCommandLine(cb func(Application, uintptr) int) uint | |||||
| 973 | // You can override local_command_line() if you need more powerful | 989 | // You can override local_command_line() if you need more powerful | ||
| 974 | // capabilities than what is provided here, but this should not | 990 | // capabilities than what is provided here, but this should not | ||
| 975 | // normally be required. | 991 | // normally be required. | ||
| 976 | - | func (x *Application) ConnectHandleLocalOptions(cb func(Application, uintptr) int) uint32 { | 992 | + | func (x *Application) ConnectHandleLocalOptions(cb *func(Application, uintptr) int) uint32 { |
| 993 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 994 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 995 | + | return gobject.SignalConnect(x.GoPointer(), "handle-local-options", cbRefPtr) | |||
| 996 | + | } | |||
| 997 | + | ||||
| 977 | fcb := func(clsPtr uintptr, OptionsVarp uintptr) int { | 998 | fcb := func(clsPtr uintptr, OptionsVarp uintptr) int { | ||
| 978 | fa := Application{} | 999 | fa := Application{} | ||
| 979 | fa.Ptr = clsPtr | 1000 | fa.Ptr = clsPtr | ||
| 1001 | + | cbFn := *cb | |||
| 980 | 1002 | ||||
| 981 | - | return cb(fa, OptionsVarp) | 1003 | + | return cbFn(fa, OptionsVarp) |
| 982 | 1004 | ||||
| 983 | } | 1005 | } | ||
| 984 | - | return gobject.SignalConnect(x.GoPointer(), "handle-local-options", purego.NewCallback(fcb)) | 1006 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1007 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1008 | + | return gobject.SignalConnect(x.GoPointer(), "handle-local-options", cbRefPtr) | |||
| 985 | } | 1009 | } | ||
| 986 | 1010 | ||||
| 987 | // The ::name-lost signal is emitted only on the registered primary instance | 1011 | // The ::name-lost signal is emitted only on the registered primary instance | ||
| @@ -989,54 +1013,86 @@ func (x *Application) ConnectHandleLocalOptions(cb func(Application, uintptr) in | |||||
| 989 | // is using the %G_APPLICATION_ALLOW_REPLACEMENT flag. | 1013 | // is using the %G_APPLICATION_ALLOW_REPLACEMENT flag. | ||
| 990 | // | 1014 | // | ||
| 991 | // The default handler for this signal calls g_application_quit(). | 1015 | // The default handler for this signal calls g_application_quit(). | ||
| 992 | - | func (x *Application) ConnectNameLost(cb func(Application) bool) uint32 { | 1016 | + | func (x *Application) ConnectNameLost(cb *func(Application) bool) uint32 { |
| 1017 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1018 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1019 | + | return gobject.SignalConnect(x.GoPointer(), "name-lost", cbRefPtr) | |||
| 1020 | + | } | |||
| 1021 | + | ||||
| 993 | fcb := func(clsPtr uintptr) bool { | 1022 | fcb := func(clsPtr uintptr) bool { | ||
| 994 | fa := Application{} | 1023 | fa := Application{} | ||
| 995 | fa.Ptr = clsPtr | 1024 | fa.Ptr = clsPtr | ||
| 1025 | + | cbFn := *cb | |||
| 996 | 1026 | ||||
| 997 | - | return cb(fa) | 1027 | + | return cbFn(fa) |
| 998 | 1028 | ||||
| 999 | } | 1029 | } | ||
| 1000 | - | return gobject.SignalConnect(x.GoPointer(), "name-lost", purego.NewCallback(fcb)) | 1030 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1031 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1032 | + | return gobject.SignalConnect(x.GoPointer(), "name-lost", cbRefPtr) | |||
| 1001 | } | 1033 | } | ||
| 1002 | 1034 | ||||
| 1003 | // The ::open signal is emitted on the primary instance when there are | 1035 | // The ::open signal is emitted on the primary instance when there are | ||
| 1004 | // files to open. See g_application_open() for more information. | 1036 | // files to open. See g_application_open() for more information. | ||
| 1005 | - | func (x *Application) ConnectOpen(cb func(Application, uintptr, int, string)) uint32 { | 1037 | + | func (x *Application) ConnectOpen(cb *func(Application, uintptr, int, string)) uint32 { |
| 1038 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1039 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1040 | + | return gobject.SignalConnect(x.GoPointer(), "open", cbRefPtr) | |||
| 1041 | + | } | |||
| 1042 | + | ||||
| 1006 | fcb := func(clsPtr uintptr, FilesVarp uintptr, NFilesVarp int, HintVarp string) { | 1043 | fcb := func(clsPtr uintptr, FilesVarp uintptr, NFilesVarp int, HintVarp string) { | ||
| 1007 | fa := Application{} | 1044 | fa := Application{} | ||
| 1008 | fa.Ptr = clsPtr | 1045 | fa.Ptr = clsPtr | ||
| 1046 | + | cbFn := *cb | |||
| 1009 | 1047 | ||||
| 1010 | - | cb(fa, FilesVarp, NFilesVarp, HintVarp) | 1048 | + | cbFn(fa, FilesVarp, NFilesVarp, HintVarp) |
| 1011 | 1049 | ||||
| 1012 | } | 1050 | } | ||
| 1013 | - | return gobject.SignalConnect(x.GoPointer(), "open", purego.NewCallback(fcb)) | 1051 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1052 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1053 | + | return gobject.SignalConnect(x.GoPointer(), "open", cbRefPtr) | |||
| 1014 | } | 1054 | } | ||
| 1015 | 1055 | ||||
| 1016 | // The ::shutdown signal is emitted only on the registered primary instance | 1056 | // The ::shutdown signal is emitted only on the registered primary instance | ||
| 1017 | // immediately after the main loop terminates. | 1057 | // immediately after the main loop terminates. | ||
| 1018 | - | func (x *Application) ConnectShutdown(cb func(Application)) uint32 { | 1058 | + | func (x *Application) ConnectShutdown(cb *func(Application)) uint32 { |
| 1059 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1060 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1061 | + | return gobject.SignalConnect(x.GoPointer(), "shutdown", cbRefPtr) | |||
| 1062 | + | } | |||
| 1063 | + | ||||
| 1019 | fcb := func(clsPtr uintptr) { | 1064 | fcb := func(clsPtr uintptr) { | ||
| 1020 | fa := Application{} | 1065 | fa := Application{} | ||
| 1021 | fa.Ptr = clsPtr | 1066 | fa.Ptr = clsPtr | ||
| 1067 | + | cbFn := *cb | |||
| 1022 | 1068 | ||||
| 1023 | - | cb(fa) | 1069 | + | cbFn(fa) |
| 1024 | 1070 | ||||
| 1025 | } | 1071 | } | ||
| 1026 | - | return gobject.SignalConnect(x.GoPointer(), "shutdown", purego.NewCallback(fcb)) | 1072 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1073 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1074 | + | return gobject.SignalConnect(x.GoPointer(), "shutdown", cbRefPtr) | |||
| 1027 | } | 1075 | } | ||
| 1028 | 1076 | ||||
| 1029 | // The ::startup signal is emitted on the primary instance immediately | 1077 | // The ::startup signal is emitted on the primary instance immediately | ||
| 1030 | // after registration. See g_application_register(). | 1078 | // after registration. See g_application_register(). | ||
| 1031 | - | func (x *Application) ConnectStartup(cb func(Application)) uint32 { | 1079 | + | func (x *Application) ConnectStartup(cb *func(Application)) uint32 { |
| 1080 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1081 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1082 | + | return gobject.SignalConnect(x.GoPointer(), "startup", cbRefPtr) | |||
| 1083 | + | } | |||
| 1084 | + | ||||
| 1032 | fcb := func(clsPtr uintptr) { | 1085 | fcb := func(clsPtr uintptr) { | ||
| 1033 | fa := Application{} | 1086 | fa := Application{} | ||
| 1034 | fa.Ptr = clsPtr | 1087 | fa.Ptr = clsPtr | ||
| 1088 | + | cbFn := *cb | |||
| 1035 | 1089 | ||||
| 1036 | - | cb(fa) | 1090 | + | cbFn(fa) |
| 1037 | 1091 | ||||
| 1038 | } | 1092 | } | ||
| 1039 | - | return gobject.SignalConnect(x.GoPointer(), "startup", purego.NewCallback(fcb)) | 1093 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1094 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1095 | + | return gobject.SignalConnect(x.GoPointer(), "startup", cbRefPtr) | |||
| 1040 | } | 1096 | } | ||
| 1041 | 1097 | ||||
| 1042 | // Emits the #GActionGroup::action-added signal on @action_group. | 1098 | // Emits the #GActionGroup::action-added signal on @action_group. | ||
M v4/gio/gasyncinitable.go +5 -5
| @@ -131,7 +131,7 @@ func (x *AsyncInitableIface) GoPointer() uintptr { | |||||
| 131 | type AsyncInitable interface { | 131 | type AsyncInitable interface { | ||
| 132 | GoPointer() uintptr | 132 | GoPointer() uintptr | ||
| 133 | SetGoPointer(uintptr) | 133 | SetGoPointer(uintptr) | ||
| 134 | - | InitAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 134 | + | InitAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 135 | InitFinish(ResVar AsyncResult) bool | 135 | InitFinish(ResVar AsyncResult) bool | ||
| 136 | NewFinish(ResVar AsyncResult) *gobject.Object | 136 | NewFinish(ResVar AsyncResult) *gobject.Object | ||
| 137 | } | 137 | } | ||
| @@ -183,9 +183,9 @@ func (x *AsyncInitableBase) SetGoPointer(ptr uintptr) { | |||||
| 183 | // in a thread, so if you want to support asynchronous initialization via | 183 | // in a thread, so if you want to support asynchronous initialization via | ||
| 184 | // threads, just implement the #GAsyncInitable interface without overriding | 184 | // threads, just implement the #GAsyncInitable interface without overriding | ||
| 185 | // any interface methods. | 185 | // any interface methods. | ||
| 186 | - | func (x *AsyncInitableBase) InitAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 186 | + | func (x *AsyncInitableBase) InitAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 187 | 187 | ||||
| 188 | - | XGAsyncInitableInitAsync(x.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 188 | + | XGAsyncInitableInitAsync(x.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 189 | 189 | ||||
| 190 | } | 190 | } | ||
| 191 | 191 | ||||
| @@ -234,9 +234,9 @@ var xAsyncInitableNewvAsync func([]interface{}, uint, *gobject.Parameter, int, u | |||||
| 234 | // When the initialization is finished, @callback will be called. You can | 234 | // When the initialization is finished, @callback will be called. You can | ||
| 235 | // then call g_async_initable_new_finish() to get the new object and check | 235 | // then call g_async_initable_new_finish() to get the new object and check | ||
| 236 | // for any errors. | 236 | // for any errors. | ||
| 237 | - | func AsyncInitableNewvAsync(ObjectTypeVar []interface{}, NParametersVar uint, ParametersVar *gobject.Parameter, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 237 | + | func AsyncInitableNewvAsync(ObjectTypeVar []interface{}, NParametersVar uint, ParametersVar *gobject.Parameter, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 238 | 238 | ||||
| 239 | - | xAsyncInitableNewvAsync(ObjectTypeVar, NParametersVar, ParametersVar, IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 239 | + | xAsyncInitableNewvAsync(ObjectTypeVar, NParametersVar, ParametersVar, IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 240 | 240 | ||||
| 241 | } | 241 | } | ||
| 242 | 242 | ||||
M v4/gio/gbufferedinputstream.go +2 -2
| @@ -127,9 +127,9 @@ var xBufferedInputStreamFillAsync func(uintptr, int, int, uintptr, uintptr, uint | |||||
| 127 | // | 127 | // | ||
| 128 | // If @count is -1 then the attempted read size is equal to the number | 128 | // If @count is -1 then the attempted read size is equal to the number | ||
| 129 | // of bytes that are required to fill the buffer. | 129 | // of bytes that are required to fill the buffer. | ||
| 130 | - | func (x *BufferedInputStream) FillAsync(CountVar int, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 130 | + | func (x *BufferedInputStream) FillAsync(CountVar int, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 131 | 131 | ||||
| 132 | - | xBufferedInputStreamFillAsync(x.GoPointer(), CountVar, IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 132 | + | xBufferedInputStreamFillAsync(x.GoPointer(), CountVar, IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 133 | 133 | ||||
| 134 | } | 134 | } | ||
| 135 | 135 | ||||
M v4/gio/gcancellable.go +13 -5
| @@ -105,9 +105,9 @@ var xCancellableConnect func(uintptr, uintptr, uintptr, uintptr) uint32 | |||||
| 105 | // @callback is invoked. This lifts a restriction in place for | 105 | // @callback is invoked. This lifts a restriction in place for | ||
| 106 | // earlier GLib versions which now makes it easier to write cleanup | 106 | // earlier GLib versions which now makes it easier to write cleanup | ||
| 107 | // code that unconditionally invokes e.g. g_cancellable_cancel(). | 107 | // code that unconditionally invokes e.g. g_cancellable_cancel(). | ||
| 108 | - | func (x *Cancellable) Connect(CallbackVar gobject.Callback, DataVar uintptr, DataDestroyFuncVar glib.DestroyNotify) uint32 { | 108 | + | func (x *Cancellable) Connect(CallbackVar *gobject.Callback, DataVar uintptr, DataDestroyFuncVar *glib.DestroyNotify) uint32 { |
| 109 | 109 | ||||
| 110 | - | cret := xCancellableConnect(x.GoPointer(), purego.NewCallback(CallbackVar), DataVar, purego.NewCallback(DataDestroyFuncVar)) | 110 | + | cret := xCancellableConnect(x.GoPointer(), glib.NewCallback(CallbackVar), DataVar, glib.NewCallback(DataDestroyFuncVar)) |
| 111 | return cret | 111 | return cret | ||
| 112 | } | 112 | } | ||
| 113 | 113 | ||||
| @@ -344,15 +344,23 @@ func (c *Cancellable) SetGoPointer(ptr uintptr) { | |||||
| 344 | // Note that the cancelled signal is emitted in the thread that | 344 | // Note that the cancelled signal is emitted in the thread that | ||
| 345 | // the user cancelled from, which may be the main thread. So, the | 345 | // the user cancelled from, which may be the main thread. So, the | ||
| 346 | // cancellable signal should not do something that can block. | 346 | // cancellable signal should not do something that can block. | ||
| 347 | - | func (x *Cancellable) ConnectCancelled(cb func(Cancellable)) uint32 { | 347 | + | func (x *Cancellable) ConnectCancelled(cb *func(Cancellable)) uint32 { |
| 348 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 349 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 350 | + | return gobject.SignalConnect(x.GoPointer(), "cancelled", cbRefPtr) | |||
| 351 | + | } | |||
| 352 | + | ||||
| 348 | fcb := func(clsPtr uintptr) { | 353 | fcb := func(clsPtr uintptr) { | ||
| 349 | fa := Cancellable{} | 354 | fa := Cancellable{} | ||
| 350 | fa.Ptr = clsPtr | 355 | fa.Ptr = clsPtr | ||
| 356 | + | cbFn := *cb | |||
| 351 | 357 | ||||
| 352 | - | cb(fa) | 358 | + | cbFn(fa) |
| 353 | 359 | ||||
| 354 | } | 360 | } | ||
| 355 | - | return gobject.SignalConnect(x.GoPointer(), "cancelled", purego.NewCallback(fcb)) | 361 | + | cbRefPtr := purego.NewCallback(fcb) |
| 362 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 363 | + | return gobject.SignalConnect(x.GoPointer(), "cancelled", cbRefPtr) | |||
| 356 | } | 364 | } | ||
| 357 | 365 | ||||
| 358 | var xCancellableGetCurrent func() uintptr | 366 | var xCancellableGetCurrent func() uintptr | ||
M v4/gio/gdatainputstream.go +6 -6
| @@ -171,9 +171,9 @@ var xDataInputStreamReadLineAsync func(uintptr, int, uintptr, uintptr, uintptr) | |||||
| 171 | // When the operation is finished, @callback will be called. You | 171 | // When the operation is finished, @callback will be called. You | ||
| 172 | // can then call g_data_input_stream_read_line_finish() to get | 172 | // can then call g_data_input_stream_read_line_finish() to get | ||
| 173 | // the result of the operation. | 173 | // the result of the operation. | ||
| 174 | - | func (x *DataInputStream) ReadLineAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 174 | + | func (x *DataInputStream) ReadLineAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 175 | 175 | ||||
| 176 | - | xDataInputStreamReadLineAsync(x.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 176 | + | xDataInputStreamReadLineAsync(x.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 177 | 177 | ||||
| 178 | } | 178 | } | ||
| 179 | 179 | ||||
| @@ -327,9 +327,9 @@ var xDataInputStreamReadUntilAsync func(uintptr, string, int, uintptr, uintptr, | |||||
| 327 | // inconsistent with g_data_input_stream_read_until(). Both functions | 327 | // inconsistent with g_data_input_stream_read_until(). Both functions | ||
| 328 | // will be marked as deprecated in a future release. Use | 328 | // will be marked as deprecated in a future release. Use | ||
| 329 | // g_data_input_stream_read_upto_async() instead. | 329 | // g_data_input_stream_read_upto_async() instead. | ||
| 330 | - | func (x *DataInputStream) ReadUntilAsync(StopCharsVar string, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 330 | + | func (x *DataInputStream) ReadUntilAsync(StopCharsVar string, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 331 | 331 | ||||
| 332 | - | xDataInputStreamReadUntilAsync(x.GoPointer(), StopCharsVar, IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 332 | + | xDataInputStreamReadUntilAsync(x.GoPointer(), StopCharsVar, IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 333 | 333 | ||||
| 334 | } | 334 | } | ||
| 335 | 335 | ||||
| @@ -389,9 +389,9 @@ var xDataInputStreamReadUptoAsync func(uintptr, string, int, int, uintptr, uintp | |||||
| 389 | // When the operation is finished, @callback will be called. You | 389 | // When the operation is finished, @callback will be called. You | ||
| 390 | // can then call g_data_input_stream_read_upto_finish() to get | 390 | // can then call g_data_input_stream_read_upto_finish() to get | ||
| 391 | // the result of the operation. | 391 | // the result of the operation. | ||
| 392 | - | func (x *DataInputStream) ReadUptoAsync(StopCharsVar string, StopCharsLenVar int, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 392 | + | func (x *DataInputStream) ReadUptoAsync(StopCharsVar string, StopCharsLenVar int, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 393 | 393 | ||||
| 394 | - | xDataInputStreamReadUptoAsync(x.GoPointer(), StopCharsVar, StopCharsLenVar, IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 394 | + | xDataInputStreamReadUptoAsync(x.GoPointer(), StopCharsVar, StopCharsLenVar, IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 395 | 395 | ||||
| 396 | } | 396 | } | ||
| 397 | 397 | ||||
M v4/gio/gdbusaddress.go +2 -2
| @@ -54,9 +54,9 @@ var xDbusAddressGetStream func(string, uintptr, uintptr, uintptr) | |||||
| 54 | // | 54 | // | ||
| 55 | // This is an asynchronous failable function. See | 55 | // This is an asynchronous failable function. See | ||
| 56 | // g_dbus_address_get_stream_sync() for the synchronous version. | 56 | // g_dbus_address_get_stream_sync() for the synchronous version. | ||
| 57 | - | func DbusAddressGetStream(AddressVar string, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 57 | + | func DbusAddressGetStream(AddressVar string, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 58 | 58 | ||||
| 59 | - | xDbusAddressGetStream(AddressVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 59 | + | xDbusAddressGetStream(AddressVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 60 | 60 | ||||
| 61 | } | 61 | } | ||
| 62 | 62 | ||||
M v4/gio/gdbusconnection.go +2 -2
| @@ -209,9 +209,9 @@ var xBusGet func(BusType, uintptr, uintptr, uintptr) | |||||
| 209 | // | 209 | // | ||
| 210 | // This is an asynchronous failable function. See g_bus_get_sync() for | 210 | // This is an asynchronous failable function. See g_bus_get_sync() for | ||
| 211 | // the synchronous version. | 211 | // the synchronous version. | ||
| 212 | - | func BusGet(BusTypeVar BusType, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 212 | + | func BusGet(BusTypeVar BusType, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 213 | 213 | ||||
| 214 | - | xBusGet(BusTypeVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 214 | + | xBusGet(BusTypeVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 215 | 215 | ||||
| 216 | } | 216 | } | ||
| 217 | 217 | ||||
M v4/gio/gdbusinterfaceskeleton.go +11 -3
| @@ -235,15 +235,23 @@ func (c *DBusInterfaceSkeleton) SetGoPointer(ptr uintptr) { | |||||
| 235 | // flags set, no dedicated thread is ever used and the call will be | 235 | // flags set, no dedicated thread is ever used and the call will be | ||
| 236 | // handled in the same thread as the object that @interface belongs | 236 | // handled in the same thread as the object that @interface belongs | ||
| 237 | // to was exported in. | 237 | // to was exported in. | ||
| 238 | - | func (x *DBusInterfaceSkeleton) ConnectGAuthorizeMethod(cb func(DBusInterfaceSkeleton, uintptr) bool) uint32 { | 238 | + | func (x *DBusInterfaceSkeleton) ConnectGAuthorizeMethod(cb *func(DBusInterfaceSkeleton, uintptr) bool) uint32 { |
| 239 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 240 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 241 | + | return gobject.SignalConnect(x.GoPointer(), "g-authorize-method", cbRefPtr) | |||
| 242 | + | } | |||
| 243 | + | ||||
| 239 | fcb := func(clsPtr uintptr, InvocationVarp uintptr) bool { | 244 | fcb := func(clsPtr uintptr, InvocationVarp uintptr) bool { | ||
| 240 | fa := DBusInterfaceSkeleton{} | 245 | fa := DBusInterfaceSkeleton{} | ||
| 241 | fa.Ptr = clsPtr | 246 | fa.Ptr = clsPtr | ||
| 247 | + | cbFn := *cb | |||
| 242 | 248 | ||||
| 243 | - | return cb(fa, InvocationVarp) | 249 | + | return cbFn(fa, InvocationVarp) |
| 244 | 250 | ||||
| 245 | } | 251 | } | ||
| 246 | - | return gobject.SignalConnect(x.GoPointer(), "g-authorize-method", purego.NewCallback(fcb)) | 252 | + | cbRefPtr := purego.NewCallback(fcb) |
| 253 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 254 | + | return gobject.SignalConnect(x.GoPointer(), "g-authorize-method", cbRefPtr) | |||
| 247 | } | 255 | } | ||
| 248 | 256 | ||||
| 249 | // Gets the #GDBusObject that @interface_ belongs to, if any. | 257 | // Gets the #GDBusObject that @interface_ belongs to, if any. | ||
M v4/gio/gdbusnameowning.go +4 -4
| @@ -68,9 +68,9 @@ var xBusOwnName func(BusType, string, BusNameOwnerFlags, uintptr, uintptr, uintp | |||||
| 68 | // to [own names][gdbus-owning-names] and export objects. | 68 | // to [own names][gdbus-owning-names] and export objects. | ||
| 69 | // Simply register objects to be exported in @bus_acquired_handler and | 69 | // Simply register objects to be exported in @bus_acquired_handler and | ||
| 70 | // unregister the objects (if any) in @name_lost_handler. | 70 | // unregister the objects (if any) in @name_lost_handler. | ||
| 71 | - | func BusOwnName(BusTypeVar BusType, NameVar string, FlagsVar BusNameOwnerFlags, BusAcquiredHandlerVar BusAcquiredCallback, NameAcquiredHandlerVar BusNameAcquiredCallback, NameLostHandlerVar BusNameLostCallback, UserDataVar uintptr, UserDataFreeFuncVar glib.DestroyNotify) uint { | 71 | + | func BusOwnName(BusTypeVar BusType, NameVar string, FlagsVar BusNameOwnerFlags, BusAcquiredHandlerVar *BusAcquiredCallback, NameAcquiredHandlerVar *BusNameAcquiredCallback, NameLostHandlerVar *BusNameLostCallback, UserDataVar uintptr, UserDataFreeFuncVar *glib.DestroyNotify) uint { |
| 72 | 72 | ||||
| 73 | - | cret := xBusOwnName(BusTypeVar, NameVar, FlagsVar, purego.NewCallback(BusAcquiredHandlerVar), purego.NewCallback(NameAcquiredHandlerVar), purego.NewCallback(NameLostHandlerVar), UserDataVar, purego.NewCallback(UserDataFreeFuncVar)) | 73 | + | cret := xBusOwnName(BusTypeVar, NameVar, FlagsVar, glib.NewCallback(BusAcquiredHandlerVar), glib.NewCallback(NameAcquiredHandlerVar), glib.NewCallback(NameLostHandlerVar), UserDataVar, glib.NewCallback(UserDataFreeFuncVar)) |
| 74 | return cret | 74 | return cret | ||
| 75 | } | 75 | } | ||
| 76 | 76 | ||||
| @@ -78,9 +78,9 @@ var xBusOwnNameOnConnection func(uintptr, string, BusNameOwnerFlags, uintptr, ui | |||||
| 78 | 78 | ||||
| 79 | // Like g_bus_own_name() but takes a #GDBusConnection instead of a | 79 | // Like g_bus_own_name() but takes a #GDBusConnection instead of a | ||
| 80 | // #GBusType. | 80 | // #GBusType. | ||
| 81 | - | func BusOwnNameOnConnection(ConnectionVar *DBusConnection, NameVar string, FlagsVar BusNameOwnerFlags, NameAcquiredHandlerVar BusNameAcquiredCallback, NameLostHandlerVar BusNameLostCallback, UserDataVar uintptr, UserDataFreeFuncVar glib.DestroyNotify) uint { | 81 | + | func BusOwnNameOnConnection(ConnectionVar *DBusConnection, NameVar string, FlagsVar BusNameOwnerFlags, NameAcquiredHandlerVar *BusNameAcquiredCallback, NameLostHandlerVar *BusNameLostCallback, UserDataVar uintptr, UserDataFreeFuncVar *glib.DestroyNotify) uint { |
| 82 | 82 | ||||
| 83 | - | cret := xBusOwnNameOnConnection(ConnectionVar.GoPointer(), NameVar, FlagsVar, purego.NewCallback(NameAcquiredHandlerVar), purego.NewCallback(NameLostHandlerVar), UserDataVar, purego.NewCallback(UserDataFreeFuncVar)) | 83 | + | cret := xBusOwnNameOnConnection(ConnectionVar.GoPointer(), NameVar, FlagsVar, glib.NewCallback(NameAcquiredHandlerVar), glib.NewCallback(NameLostHandlerVar), UserDataVar, glib.NewCallback(UserDataFreeFuncVar)) |
| 84 | return cret | 84 | return cret | ||
| 85 | } | 85 | } | ||
| 86 | 86 | ||||
M v4/gio/gdbusnamewatching.go +4 -4
| @@ -65,9 +65,9 @@ var xBusWatchName func(BusType, string, BusNameWatcherFlags, uintptr, uintptr, u | |||||
| 65 | // Basically, the application should create object proxies in | 65 | // Basically, the application should create object proxies in | ||
| 66 | // @name_appeared_handler and destroy them again (if any) in | 66 | // @name_appeared_handler and destroy them again (if any) in | ||
| 67 | // @name_vanished_handler. | 67 | // @name_vanished_handler. | ||
| 68 | - | func BusWatchName(BusTypeVar BusType, NameVar string, FlagsVar BusNameWatcherFlags, NameAppearedHandlerVar BusNameAppearedCallback, NameVanishedHandlerVar BusNameVanishedCallback, UserDataVar uintptr, UserDataFreeFuncVar glib.DestroyNotify) uint { | 68 | + | func BusWatchName(BusTypeVar BusType, NameVar string, FlagsVar BusNameWatcherFlags, NameAppearedHandlerVar *BusNameAppearedCallback, NameVanishedHandlerVar *BusNameVanishedCallback, UserDataVar uintptr, UserDataFreeFuncVar *glib.DestroyNotify) uint { |
| 69 | 69 | ||||
| 70 | - | cret := xBusWatchName(BusTypeVar, NameVar, FlagsVar, purego.NewCallback(NameAppearedHandlerVar), purego.NewCallback(NameVanishedHandlerVar), UserDataVar, purego.NewCallback(UserDataFreeFuncVar)) | 70 | + | cret := xBusWatchName(BusTypeVar, NameVar, FlagsVar, glib.NewCallback(NameAppearedHandlerVar), glib.NewCallback(NameVanishedHandlerVar), UserDataVar, glib.NewCallback(UserDataFreeFuncVar)) |
| 71 | return cret | 71 | return cret | ||
| 72 | } | 72 | } | ||
| 73 | 73 | ||||
| @@ -75,9 +75,9 @@ var xBusWatchNameOnConnection func(uintptr, string, BusNameWatcherFlags, uintptr | |||||
| 75 | 75 | ||||
| 76 | // Like g_bus_watch_name() but takes a #GDBusConnection instead of a | 76 | // Like g_bus_watch_name() but takes a #GDBusConnection instead of a | ||
| 77 | // #GBusType. | 77 | // #GBusType. | ||
| 78 | - | func BusWatchNameOnConnection(ConnectionVar *DBusConnection, NameVar string, FlagsVar BusNameWatcherFlags, NameAppearedHandlerVar BusNameAppearedCallback, NameVanishedHandlerVar BusNameVanishedCallback, UserDataVar uintptr, UserDataFreeFuncVar glib.DestroyNotify) uint { | 78 | + | func BusWatchNameOnConnection(ConnectionVar *DBusConnection, NameVar string, FlagsVar BusNameWatcherFlags, NameAppearedHandlerVar *BusNameAppearedCallback, NameVanishedHandlerVar *BusNameVanishedCallback, UserDataVar uintptr, UserDataFreeFuncVar *glib.DestroyNotify) uint { |
| 79 | 79 | ||||
| 80 | - | cret := xBusWatchNameOnConnection(ConnectionVar.GoPointer(), NameVar, FlagsVar, purego.NewCallback(NameAppearedHandlerVar), purego.NewCallback(NameVanishedHandlerVar), UserDataVar, purego.NewCallback(UserDataFreeFuncVar)) | 80 | + | cret := xBusWatchNameOnConnection(ConnectionVar.GoPointer(), NameVar, FlagsVar, glib.NewCallback(NameAppearedHandlerVar), glib.NewCallback(NameVanishedHandlerVar), UserDataVar, glib.NewCallback(UserDataFreeFuncVar)) |
| 81 | return cret | 81 | return cret | ||
| 82 | } | 82 | } | ||
| 83 | 83 | ||||
M v4/gio/gdbusobjectmanagerclient.go +32 -16
| @@ -163,11 +163,11 @@ var xNewDBusObjectManagerClientForBusSync func(BusType, DBusObjectManagerClientF | |||||
| 163 | // This is a synchronous failable constructor - the calling thread is | 163 | // This is a synchronous failable constructor - the calling thread is | ||
| 164 | // blocked until a reply is received. See g_dbus_object_manager_client_new_for_bus() | 164 | // blocked until a reply is received. See g_dbus_object_manager_client_new_for_bus() | ||
| 165 | // for the asynchronous version. | 165 | // for the asynchronous version. | ||
| 166 | - | func NewDBusObjectManagerClientForBusSync(BusTypeVar BusType, FlagsVar DBusObjectManagerClientFlags, NameVar string, ObjectPathVar string, GetProxyTypeFuncVar DBusProxyTypeFunc, GetProxyTypeUserDataVar uintptr, GetProxyTypeDestroyNotifyVar glib.DestroyNotify, CancellableVar *Cancellable) (*DBusObjectManagerClient, error) { | 166 | + | func NewDBusObjectManagerClientForBusSync(BusTypeVar BusType, FlagsVar DBusObjectManagerClientFlags, NameVar string, ObjectPathVar string, GetProxyTypeFuncVar *DBusProxyTypeFunc, GetProxyTypeUserDataVar uintptr, GetProxyTypeDestroyNotifyVar *glib.DestroyNotify, CancellableVar *Cancellable) (*DBusObjectManagerClient, error) { |
| 167 | var cls *DBusObjectManagerClient | 167 | var cls *DBusObjectManagerClient | ||
| 168 | var cerr *glib.Error | 168 | var cerr *glib.Error | ||
| 169 | 169 | ||||
| 170 | - | cret := xNewDBusObjectManagerClientForBusSync(BusTypeVar, FlagsVar, NameVar, ObjectPathVar, purego.NewCallback(GetProxyTypeFuncVar), GetProxyTypeUserDataVar, purego.NewCallback(GetProxyTypeDestroyNotifyVar), CancellableVar.GoPointer(), &cerr) | 170 | + | cret := xNewDBusObjectManagerClientForBusSync(BusTypeVar, FlagsVar, NameVar, ObjectPathVar, glib.NewCallback(GetProxyTypeFuncVar), GetProxyTypeUserDataVar, glib.NewCallback(GetProxyTypeDestroyNotifyVar), CancellableVar.GoPointer(), &cerr) |
| 171 | 171 | ||||
| 172 | if cret == 0 { | 172 | if cret == 0 { | ||
| 173 | return nil, cerr | 173 | return nil, cerr | ||
| @@ -188,11 +188,11 @@ var xNewDBusObjectManagerClientSync func(uintptr, DBusObjectManagerClientFlags, | |||||
| 188 | // This is a synchronous failable constructor - the calling thread is | 188 | // This is a synchronous failable constructor - the calling thread is | ||
| 189 | // blocked until a reply is received. See g_dbus_object_manager_client_new() | 189 | // blocked until a reply is received. See g_dbus_object_manager_client_new() | ||
| 190 | // for the asynchronous version. | 190 | // for the asynchronous version. | ||
| 191 | - | func NewDBusObjectManagerClientSync(ConnectionVar *DBusConnection, FlagsVar DBusObjectManagerClientFlags, NameVar string, ObjectPathVar string, GetProxyTypeFuncVar DBusProxyTypeFunc, GetProxyTypeUserDataVar uintptr, GetProxyTypeDestroyNotifyVar glib.DestroyNotify, CancellableVar *Cancellable) (*DBusObjectManagerClient, error) { | 191 | + | func NewDBusObjectManagerClientSync(ConnectionVar *DBusConnection, FlagsVar DBusObjectManagerClientFlags, NameVar string, ObjectPathVar string, GetProxyTypeFuncVar *DBusProxyTypeFunc, GetProxyTypeUserDataVar uintptr, GetProxyTypeDestroyNotifyVar *glib.DestroyNotify, CancellableVar *Cancellable) (*DBusObjectManagerClient, error) { |
| 192 | var cls *DBusObjectManagerClient | 192 | var cls *DBusObjectManagerClient | ||
| 193 | var cerr *glib.Error | 193 | var cerr *glib.Error | ||
| 194 | 194 | ||||
| 195 | - | cret := xNewDBusObjectManagerClientSync(ConnectionVar.GoPointer(), FlagsVar, NameVar, ObjectPathVar, purego.NewCallback(GetProxyTypeFuncVar), GetProxyTypeUserDataVar, purego.NewCallback(GetProxyTypeDestroyNotifyVar), CancellableVar.GoPointer(), &cerr) | 195 | + | cret := xNewDBusObjectManagerClientSync(ConnectionVar.GoPointer(), FlagsVar, NameVar, ObjectPathVar, glib.NewCallback(GetProxyTypeFuncVar), GetProxyTypeUserDataVar, glib.NewCallback(GetProxyTypeDestroyNotifyVar), CancellableVar.GoPointer(), &cerr) |
| 196 | 196 | ||||
| 197 | if cret == 0 { | 197 | if cret == 0 { | ||
| 198 | return nil, cerr | 198 | return nil, cerr | ||
| @@ -273,15 +273,23 @@ func (c *DBusObjectManagerClient) SetGoPointer(ptr uintptr) { | |||||
| 273 | // This signal is emitted in the | 273 | // This signal is emitted in the | ||
| 274 | // [thread-default main context][g-main-context-push-thread-default] | 274 | // [thread-default main context][g-main-context-push-thread-default] | ||
| 275 | // that @manager was constructed in. | 275 | // that @manager was constructed in. | ||
| 276 | - | func (x *DBusObjectManagerClient) ConnectInterfaceProxyPropertiesChanged(cb func(DBusObjectManagerClient, uintptr, uintptr, uintptr, uintptr)) uint32 { | 276 | + | func (x *DBusObjectManagerClient) ConnectInterfaceProxyPropertiesChanged(cb *func(DBusObjectManagerClient, uintptr, uintptr, uintptr, uintptr)) uint32 { |
| 277 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 278 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 279 | + | return gobject.SignalConnect(x.GoPointer(), "interface-proxy-properties-changed", cbRefPtr) | |||
| 280 | + | } | |||
| 281 | + | ||||
| 277 | fcb := func(clsPtr uintptr, ObjectProxyVarp uintptr, InterfaceProxyVarp uintptr, ChangedPropertiesVarp uintptr, InvalidatedPropertiesVarp uintptr) { | 282 | fcb := func(clsPtr uintptr, ObjectProxyVarp uintptr, InterfaceProxyVarp uintptr, ChangedPropertiesVarp uintptr, InvalidatedPropertiesVarp uintptr) { | ||
| 278 | fa := DBusObjectManagerClient{} | 283 | fa := DBusObjectManagerClient{} | ||
| 279 | fa.Ptr = clsPtr | 284 | fa.Ptr = clsPtr | ||
| 285 | + | cbFn := *cb | |||
| 280 | 286 | ||||
| 281 | - | cb(fa, ObjectProxyVarp, InterfaceProxyVarp, ChangedPropertiesVarp, InvalidatedPropertiesVarp) | 287 | + | cbFn(fa, ObjectProxyVarp, InterfaceProxyVarp, ChangedPropertiesVarp, InvalidatedPropertiesVarp) |
| 282 | 288 | ||||
| 283 | } | 289 | } | ||
| 284 | - | return gobject.SignalConnect(x.GoPointer(), "interface-proxy-properties-changed", purego.NewCallback(fcb)) | 290 | + | cbRefPtr := purego.NewCallback(fcb) |
| 291 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 292 | + | return gobject.SignalConnect(x.GoPointer(), "interface-proxy-properties-changed", cbRefPtr) | |||
| 285 | } | 293 | } | ||
| 286 | 294 | ||||
| 287 | // Emitted when a D-Bus signal is received on @interface_proxy. | 295 | // Emitted when a D-Bus signal is received on @interface_proxy. | ||
| @@ -292,15 +300,23 @@ func (x *DBusObjectManagerClient) ConnectInterfaceProxyPropertiesChanged(cb func | |||||
| 292 | // This signal is emitted in the | 300 | // This signal is emitted in the | ||
| 293 | // [thread-default main context][g-main-context-push-thread-default] | 301 | // [thread-default main context][g-main-context-push-thread-default] | ||
| 294 | // that @manager was constructed in. | 302 | // that @manager was constructed in. | ||
| 295 | - | func (x *DBusObjectManagerClient) ConnectInterfaceProxySignal(cb func(DBusObjectManagerClient, uintptr, uintptr, string, string, uintptr)) uint32 { | 303 | + | func (x *DBusObjectManagerClient) ConnectInterfaceProxySignal(cb *func(DBusObjectManagerClient, uintptr, uintptr, string, string, uintptr)) uint32 { |
| 304 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 305 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 306 | + | return gobject.SignalConnect(x.GoPointer(), "interface-proxy-signal", cbRefPtr) | |||
| 307 | + | } | |||
| 308 | + | ||||
| 296 | fcb := func(clsPtr uintptr, ObjectProxyVarp uintptr, InterfaceProxyVarp uintptr, SenderNameVarp string, SignalNameVarp string, ParametersVarp uintptr) { | 309 | fcb := func(clsPtr uintptr, ObjectProxyVarp uintptr, InterfaceProxyVarp uintptr, SenderNameVarp string, SignalNameVarp string, ParametersVarp uintptr) { | ||
| 297 | fa := DBusObjectManagerClient{} | 310 | fa := DBusObjectManagerClient{} | ||
| 298 | fa.Ptr = clsPtr | 311 | fa.Ptr = clsPtr | ||
| 312 | + | cbFn := *cb | |||
| 299 | 313 | ||||
| 300 | - | cb(fa, ObjectProxyVarp, InterfaceProxyVarp, SenderNameVarp, SignalNameVarp, ParametersVarp) | 314 | + | cbFn(fa, ObjectProxyVarp, InterfaceProxyVarp, SenderNameVarp, SignalNameVarp, ParametersVarp) |
| 301 | 315 | ||||
| 302 | } | 316 | } | ||
| 303 | - | return gobject.SignalConnect(x.GoPointer(), "interface-proxy-signal", purego.NewCallback(fcb)) | 317 | + | cbRefPtr := purego.NewCallback(fcb) |
| 318 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 319 | + | return gobject.SignalConnect(x.GoPointer(), "interface-proxy-signal", cbRefPtr) | |||
| 304 | } | 320 | } | ||
| 305 | 321 | ||||
| 306 | // Starts asynchronous initialization of the object implementing the | 322 | // Starts asynchronous initialization of the object implementing the | ||
| @@ -339,9 +355,9 @@ func (x *DBusObjectManagerClient) ConnectInterfaceProxySignal(cb func(DBusObject | |||||
| 339 | // in a thread, so if you want to support asynchronous initialization via | 355 | // in a thread, so if you want to support asynchronous initialization via | ||
| 340 | // threads, just implement the #GAsyncInitable interface without overriding | 356 | // threads, just implement the #GAsyncInitable interface without overriding | ||
| 341 | // any interface methods. | 357 | // any interface methods. | ||
| 342 | - | func (x *DBusObjectManagerClient) InitAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 358 | + | func (x *DBusObjectManagerClient) InitAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 343 | 359 | ||||
| 344 | - | XGAsyncInitableInitAsync(x.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 360 | + | XGAsyncInitableInitAsync(x.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 345 | 361 | ||||
| 346 | } | 362 | } | ||
| 347 | 363 | ||||
| @@ -480,9 +496,9 @@ var xDBusObjectManagerClientNew func(uintptr, DBusObjectManagerClientFlags, stri | |||||
| 480 | // of the thread you are calling this method from. You can | 496 | // of the thread you are calling this method from. You can | ||
| 481 | // then call g_dbus_object_manager_client_new_finish() to get the result. See | 497 | // then call g_dbus_object_manager_client_new_finish() to get the result. See | ||
| 482 | // g_dbus_object_manager_client_new_sync() for the synchronous version. | 498 | // g_dbus_object_manager_client_new_sync() for the synchronous version. | ||
| 483 | - | func DBusObjectManagerClientNew(ConnectionVar *DBusConnection, FlagsVar DBusObjectManagerClientFlags, NameVar string, ObjectPathVar string, GetProxyTypeFuncVar DBusProxyTypeFunc, GetProxyTypeUserDataVar uintptr, GetProxyTypeDestroyNotifyVar glib.DestroyNotify, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 499 | + | func DBusObjectManagerClientNew(ConnectionVar *DBusConnection, FlagsVar DBusObjectManagerClientFlags, NameVar string, ObjectPathVar string, GetProxyTypeFuncVar *DBusProxyTypeFunc, GetProxyTypeUserDataVar uintptr, GetProxyTypeDestroyNotifyVar *glib.DestroyNotify, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 484 | 500 | ||||
| 485 | - | xDBusObjectManagerClientNew(ConnectionVar.GoPointer(), FlagsVar, NameVar, ObjectPathVar, purego.NewCallback(GetProxyTypeFuncVar), GetProxyTypeUserDataVar, purego.NewCallback(GetProxyTypeDestroyNotifyVar), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 501 | + | xDBusObjectManagerClientNew(ConnectionVar.GoPointer(), FlagsVar, NameVar, ObjectPathVar, glib.NewCallback(GetProxyTypeFuncVar), GetProxyTypeUserDataVar, glib.NewCallback(GetProxyTypeDestroyNotifyVar), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 486 | 502 | ||||
| 487 | } | 503 | } | ||
| 488 | 504 | ||||
| @@ -497,9 +513,9 @@ var xDBusObjectManagerClientNewForBus func(BusType, DBusObjectManagerClientFlags | |||||
| 497 | // of the thread you are calling this method from. You can | 513 | // of the thread you are calling this method from. You can | ||
| 498 | // then call g_dbus_object_manager_client_new_for_bus_finish() to get the result. See | 514 | // then call g_dbus_object_manager_client_new_for_bus_finish() to get the result. See | ||
| 499 | // g_dbus_object_manager_client_new_for_bus_sync() for the synchronous version. | 515 | // g_dbus_object_manager_client_new_for_bus_sync() for the synchronous version. | ||
| 500 | - | func DBusObjectManagerClientNewForBus(BusTypeVar BusType, FlagsVar DBusObjectManagerClientFlags, NameVar string, ObjectPathVar string, GetProxyTypeFuncVar DBusProxyTypeFunc, GetProxyTypeUserDataVar uintptr, GetProxyTypeDestroyNotifyVar glib.DestroyNotify, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 516 | + | func DBusObjectManagerClientNewForBus(BusTypeVar BusType, FlagsVar DBusObjectManagerClientFlags, NameVar string, ObjectPathVar string, GetProxyTypeFuncVar *DBusProxyTypeFunc, GetProxyTypeUserDataVar uintptr, GetProxyTypeDestroyNotifyVar *glib.DestroyNotify, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 501 | 517 | ||||
| 502 | - | xDBusObjectManagerClientNewForBus(BusTypeVar, FlagsVar, NameVar, ObjectPathVar, purego.NewCallback(GetProxyTypeFuncVar), GetProxyTypeUserDataVar, purego.NewCallback(GetProxyTypeDestroyNotifyVar), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 518 | + | xDBusObjectManagerClientNewForBus(BusTypeVar, FlagsVar, NameVar, ObjectPathVar, glib.NewCallback(GetProxyTypeFuncVar), GetProxyTypeUserDataVar, glib.NewCallback(GetProxyTypeDestroyNotifyVar), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 503 | 519 | ||||
| 504 | } | 520 | } | ||
| 505 | 521 | ||||
M v4/gio/gdbusobjectskeleton.go +11 -3
| @@ -131,15 +131,23 @@ func (c *DBusObjectSkeleton) SetGoPointer(ptr uintptr) { | |||||
| 131 | // except that it is for the enclosing object. | 131 | // except that it is for the enclosing object. | ||
| 132 | // | 132 | // | ||
| 133 | // The default class handler just returns %TRUE. | 133 | // The default class handler just returns %TRUE. | ||
| 134 | - | func (x *DBusObjectSkeleton) ConnectAuthorizeMethod(cb func(DBusObjectSkeleton, uintptr, uintptr) bool) uint32 { | 134 | + | func (x *DBusObjectSkeleton) ConnectAuthorizeMethod(cb *func(DBusObjectSkeleton, uintptr, uintptr) bool) uint32 { |
| 135 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 136 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 137 | + | return gobject.SignalConnect(x.GoPointer(), "authorize-method", cbRefPtr) | |||
| 138 | + | } | |||
| 139 | + | ||||
| 135 | fcb := func(clsPtr uintptr, InterfaceVarp uintptr, InvocationVarp uintptr) bool { | 140 | fcb := func(clsPtr uintptr, InterfaceVarp uintptr, InvocationVarp uintptr) bool { | ||
| 136 | fa := DBusObjectSkeleton{} | 141 | fa := DBusObjectSkeleton{} | ||
| 137 | fa.Ptr = clsPtr | 142 | fa.Ptr = clsPtr | ||
| 143 | + | cbFn := *cb | |||
| 138 | 144 | ||||
| 139 | - | return cb(fa, InterfaceVarp, InvocationVarp) | 145 | + | return cbFn(fa, InterfaceVarp, InvocationVarp) |
| 140 | 146 | ||||
| 141 | } | 147 | } | ||
| 142 | - | return gobject.SignalConnect(x.GoPointer(), "authorize-method", purego.NewCallback(fcb)) | 148 | + | cbRefPtr := purego.NewCallback(fcb) |
| 149 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 150 | + | return gobject.SignalConnect(x.GoPointer(), "authorize-method", cbRefPtr) | |||
| 143 | } | 151 | } | ||
| 144 | 152 | ||||
| 145 | // Gets the D-Bus interface with name @interface_name associated with | 153 | // Gets the D-Bus interface with name @interface_name associated with | ||
M v4/gio/gdbusproxy.go +32 -16
| @@ -235,9 +235,9 @@ var xDBusProxyCall func(uintptr, string, *glib.Variant, DBusCallFlags, int, uint | |||||
| 235 | // | 235 | // | ||
| 236 | // If @callback is %NULL then the D-Bus method call message will be sent with | 236 | // If @callback is %NULL then the D-Bus method call message will be sent with | ||
| 237 | // the %G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED flag set. | 237 | // the %G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED flag set. | ||
| 238 | - | func (x *DBusProxy) Call(MethodNameVar string, ParametersVar *glib.Variant, FlagsVar DBusCallFlags, TimeoutMsecVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 238 | + | func (x *DBusProxy) Call(MethodNameVar string, ParametersVar *glib.Variant, FlagsVar DBusCallFlags, TimeoutMsecVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 239 | 239 | ||||
| 240 | - | xDBusProxyCall(x.GoPointer(), MethodNameVar, ParametersVar, FlagsVar, TimeoutMsecVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 240 | + | xDBusProxyCall(x.GoPointer(), MethodNameVar, ParametersVar, FlagsVar, TimeoutMsecVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 241 | 241 | ||||
| 242 | } | 242 | } | ||
| 243 | 243 | ||||
| @@ -309,9 +309,9 @@ var xDBusProxyCallWithUnixFdList func(uintptr, string, *glib.Variant, DBusCallFl | |||||
| 309 | // Like g_dbus_proxy_call() but also takes a #GUnixFDList object. | 309 | // Like g_dbus_proxy_call() but also takes a #GUnixFDList object. | ||
| 310 | // | 310 | // | ||
| 311 | // This method is only available on UNIX. | 311 | // This method is only available on UNIX. | ||
| 312 | - | func (x *DBusProxy) CallWithUnixFdList(MethodNameVar string, ParametersVar *glib.Variant, FlagsVar DBusCallFlags, TimeoutMsecVar int, FdListVar *UnixFDList, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 312 | + | func (x *DBusProxy) CallWithUnixFdList(MethodNameVar string, ParametersVar *glib.Variant, FlagsVar DBusCallFlags, TimeoutMsecVar int, FdListVar *UnixFDList, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 313 | 313 | ||||
| 314 | - | xDBusProxyCallWithUnixFdList(x.GoPointer(), MethodNameVar, ParametersVar, FlagsVar, TimeoutMsecVar, FdListVar.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 314 | + | xDBusProxyCallWithUnixFdList(x.GoPointer(), MethodNameVar, ParametersVar, FlagsVar, TimeoutMsecVar, FdListVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 315 | 315 | ||||
| 316 | } | 316 | } | ||
| 317 | 317 | ||||
| @@ -548,15 +548,23 @@ func (c *DBusProxy) SetGoPointer(ptr uintptr) { | |||||
| 548 | // This signal corresponds to the | 548 | // This signal corresponds to the | ||
| 549 | // `PropertiesChanged` D-Bus signal on the | 549 | // `PropertiesChanged` D-Bus signal on the | ||
| 550 | // `org.freedesktop.DBus.Properties` interface. | 550 | // `org.freedesktop.DBus.Properties` interface. | ||
| 551 | - | func (x *DBusProxy) ConnectGPropertiesChanged(cb func(DBusProxy, uintptr, uintptr)) uint32 { | 551 | + | func (x *DBusProxy) ConnectGPropertiesChanged(cb *func(DBusProxy, uintptr, uintptr)) uint32 { |
| 552 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 553 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 554 | + | return gobject.SignalConnect(x.GoPointer(), "g-properties-changed", cbRefPtr) | |||
| 555 | + | } | |||
| 556 | + | ||||
| 552 | fcb := func(clsPtr uintptr, ChangedPropertiesVarp uintptr, InvalidatedPropertiesVarp uintptr) { | 557 | fcb := func(clsPtr uintptr, ChangedPropertiesVarp uintptr, InvalidatedPropertiesVarp uintptr) { | ||
| 553 | fa := DBusProxy{} | 558 | fa := DBusProxy{} | ||
| 554 | fa.Ptr = clsPtr | 559 | fa.Ptr = clsPtr | ||
| 560 | + | cbFn := *cb | |||
| 555 | 561 | ||||
| 556 | - | cb(fa, ChangedPropertiesVarp, InvalidatedPropertiesVarp) | 562 | + | cbFn(fa, ChangedPropertiesVarp, InvalidatedPropertiesVarp) |
| 557 | 563 | ||||
| 558 | } | 564 | } | ||
| 559 | - | return gobject.SignalConnect(x.GoPointer(), "g-properties-changed", purego.NewCallback(fcb)) | 565 | + | cbRefPtr := purego.NewCallback(fcb) |
| 566 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 567 | + | return gobject.SignalConnect(x.GoPointer(), "g-properties-changed", cbRefPtr) | |||
| 560 | } | 568 | } | ||
| 561 | 569 | ||||
| 562 | // Emitted when a signal from the remote object and interface that @proxy is for, has been received. | 570 | // Emitted when a signal from the remote object and interface that @proxy is for, has been received. | ||
| @@ -564,15 +572,23 @@ func (x *DBusProxy) ConnectGPropertiesChanged(cb func(DBusProxy, uintptr, uintpt | |||||
| 564 | // Since 2.72 this signal supports detailed connections. You can connect to | 572 | // Since 2.72 this signal supports detailed connections. You can connect to | ||
| 565 | // the detailed signal `g-signal::x` in order to receive callbacks only when | 573 | // the detailed signal `g-signal::x` in order to receive callbacks only when | ||
| 566 | // signal `x` is received from the remote object. | 574 | // signal `x` is received from the remote object. | ||
| 567 | - | func (x *DBusProxy) ConnectGSignal(cb func(DBusProxy, string, string, uintptr)) uint32 { | 575 | + | func (x *DBusProxy) ConnectGSignal(cb *func(DBusProxy, string, string, uintptr)) uint32 { |
| 576 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 577 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 578 | + | return gobject.SignalConnect(x.GoPointer(), "g-signal", cbRefPtr) | |||
| 579 | + | } | |||
| 580 | + | ||||
| 568 | fcb := func(clsPtr uintptr, SenderNameVarp string, SignalNameVarp string, ParametersVarp uintptr) { | 581 | fcb := func(clsPtr uintptr, SenderNameVarp string, SignalNameVarp string, ParametersVarp uintptr) { | ||
| 569 | fa := DBusProxy{} | 582 | fa := DBusProxy{} | ||
| 570 | fa.Ptr = clsPtr | 583 | fa.Ptr = clsPtr | ||
| 584 | + | cbFn := *cb | |||
| 571 | 585 | ||||
| 572 | - | cb(fa, SenderNameVarp, SignalNameVarp, ParametersVarp) | 586 | + | cbFn(fa, SenderNameVarp, SignalNameVarp, ParametersVarp) |
| 573 | 587 | ||||
| 574 | } | 588 | } | ||
| 575 | - | return gobject.SignalConnect(x.GoPointer(), "g-signal", purego.NewCallback(fcb)) | 589 | + | cbRefPtr := purego.NewCallback(fcb) |
| 590 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 591 | + | return gobject.SignalConnect(x.GoPointer(), "g-signal", cbRefPtr) | |||
| 576 | } | 592 | } | ||
| 577 | 593 | ||||
| 578 | // Starts asynchronous initialization of the object implementing the | 594 | // Starts asynchronous initialization of the object implementing the | ||
| @@ -611,9 +627,9 @@ func (x *DBusProxy) ConnectGSignal(cb func(DBusProxy, string, string, uintptr)) | |||||
| 611 | // in a thread, so if you want to support asynchronous initialization via | 627 | // in a thread, so if you want to support asynchronous initialization via | ||
| 612 | // threads, just implement the #GAsyncInitable interface without overriding | 628 | // threads, just implement the #GAsyncInitable interface without overriding | ||
| 613 | // any interface methods. | 629 | // any interface methods. | ||
| 614 | - | func (x *DBusProxy) InitAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 630 | + | func (x *DBusProxy) InitAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 615 | 631 | ||||
| 616 | - | XGAsyncInitableInitAsync(x.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 632 | + | XGAsyncInitableInitAsync(x.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 617 | 633 | ||||
| 618 | } | 634 | } | ||
| 619 | 635 | ||||
| @@ -778,9 +794,9 @@ var xDBusProxyNew func(uintptr, DBusProxyFlags, *DBusInterfaceInfo, string, stri | |||||
| 778 | // See g_dbus_proxy_new_sync() and for a synchronous version of this constructor. | 794 | // See g_dbus_proxy_new_sync() and for a synchronous version of this constructor. | ||
| 779 | // | 795 | // | ||
| 780 | // #GDBusProxy is used in this [example][gdbus-wellknown-proxy]. | 796 | // #GDBusProxy is used in this [example][gdbus-wellknown-proxy]. | ||
| 781 | - | func DBusProxyNew(ConnectionVar *DBusConnection, FlagsVar DBusProxyFlags, InfoVar *DBusInterfaceInfo, NameVar string, ObjectPathVar string, InterfaceNameVar string, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 797 | + | func DBusProxyNew(ConnectionVar *DBusConnection, FlagsVar DBusProxyFlags, InfoVar *DBusInterfaceInfo, NameVar string, ObjectPathVar string, InterfaceNameVar string, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 782 | 798 | ||||
| 783 | - | xDBusProxyNew(ConnectionVar.GoPointer(), FlagsVar, InfoVar, NameVar, ObjectPathVar, InterfaceNameVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 799 | + | xDBusProxyNew(ConnectionVar.GoPointer(), FlagsVar, InfoVar, NameVar, ObjectPathVar, InterfaceNameVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 784 | 800 | ||||
| 785 | } | 801 | } | ||
| 786 | 802 | ||||
| @@ -789,9 +805,9 @@ var xDBusProxyNewForBus func(BusType, DBusProxyFlags, *DBusInterfaceInfo, string | |||||
| 789 | // Like g_dbus_proxy_new() but takes a #GBusType instead of a #GDBusConnection. | 805 | // Like g_dbus_proxy_new() but takes a #GBusType instead of a #GDBusConnection. | ||
| 790 | // | 806 | // | ||
| 791 | // #GDBusProxy is used in this [example][gdbus-wellknown-proxy]. | 807 | // #GDBusProxy is used in this [example][gdbus-wellknown-proxy]. | ||
| 792 | - | func DBusProxyNewForBus(BusTypeVar BusType, FlagsVar DBusProxyFlags, InfoVar *DBusInterfaceInfo, NameVar string, ObjectPathVar string, InterfaceNameVar string, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 808 | + | func DBusProxyNewForBus(BusTypeVar BusType, FlagsVar DBusProxyFlags, InfoVar *DBusInterfaceInfo, NameVar string, ObjectPathVar string, InterfaceNameVar string, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 793 | 809 | ||||
| 794 | - | xDBusProxyNewForBus(BusTypeVar, FlagsVar, InfoVar, NameVar, ObjectPathVar, InterfaceNameVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 810 | + | xDBusProxyNewForBus(BusTypeVar, FlagsVar, InfoVar, NameVar, ObjectPathVar, InterfaceNameVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 795 | 811 | ||||
| 796 | } | 812 | } | ||
| 797 | 813 | ||||
M v4/gio/gdebugcontrollerdbus.go +11 -3
| @@ -219,15 +219,23 @@ func (c *DebugControllerDBus) SetGoPointer(ptr uintptr) { | |||||
| 219 | // Signal handlers must not modify @invocation, or cause it to return a value. | 219 | // Signal handlers must not modify @invocation, or cause it to return a value. | ||
| 220 | // | 220 | // | ||
| 221 | // The default class handler just returns %TRUE. | 221 | // The default class handler just returns %TRUE. | ||
| 222 | - | func (x *DebugControllerDBus) ConnectAuthorize(cb func(DebugControllerDBus, uintptr) bool) uint32 { | 222 | + | func (x *DebugControllerDBus) ConnectAuthorize(cb *func(DebugControllerDBus, uintptr) bool) uint32 { |
| 223 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 224 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 225 | + | return gobject.SignalConnect(x.GoPointer(), "authorize", cbRefPtr) | |||
| 226 | + | } | |||
| 227 | + | ||||
| 223 | fcb := func(clsPtr uintptr, InvocationVarp uintptr) bool { | 228 | fcb := func(clsPtr uintptr, InvocationVarp uintptr) bool { | ||
| 224 | fa := DebugControllerDBus{} | 229 | fa := DebugControllerDBus{} | ||
| 225 | fa.Ptr = clsPtr | 230 | fa.Ptr = clsPtr | ||
| 231 | + | cbFn := *cb | |||
| 226 | 232 | ||||
| 227 | - | return cb(fa, InvocationVarp) | 233 | + | return cbFn(fa, InvocationVarp) |
| 228 | 234 | ||||
| 229 | } | 235 | } | ||
| 230 | - | return gobject.SignalConnect(x.GoPointer(), "authorize", purego.NewCallback(fcb)) | 236 | + | cbRefPtr := purego.NewCallback(fcb) |
| 237 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 238 | + | return gobject.SignalConnect(x.GoPointer(), "authorize", cbRefPtr) | |||
| 231 | } | 239 | } | ||
| 232 | 240 | ||||
| 233 | // Get the value of #GDebugController:debug-enabled. | 241 | // Get the value of #GDebugController:debug-enabled. | ||
M v4/gio/gdesktopappinfo.go +6 -6
| @@ -352,10 +352,10 @@ var xDesktopAppInfoLaunchUrisAsManager func(uintptr, *glib.List, uintptr, glib.S | |||||
| 352 | // If application launching occurs via some other mechanism (eg: D-Bus | 352 | // If application launching occurs via some other mechanism (eg: D-Bus | ||
| 353 | // activation) then @spawn_flags, @user_setup, @user_setup_data, | 353 | // activation) then @spawn_flags, @user_setup, @user_setup_data, | ||
| 354 | // @pid_callback and @pid_callback_data are ignored. | 354 | // @pid_callback and @pid_callback_data are ignored. | ||
| 355 | - | func (x *DesktopAppInfo) LaunchUrisAsManager(UrisVar *glib.List, LaunchContextVar *AppLaunchContext, SpawnFlagsVar glib.SpawnFlags, UserSetupVar glib.SpawnChildSetupFunc, UserSetupDataVar uintptr, PidCallbackVar DesktopAppLaunchCallback, PidCallbackDataVar uintptr) (bool, error) { | 355 | + | func (x *DesktopAppInfo) LaunchUrisAsManager(UrisVar *glib.List, LaunchContextVar *AppLaunchContext, SpawnFlagsVar glib.SpawnFlags, UserSetupVar *glib.SpawnChildSetupFunc, UserSetupDataVar uintptr, PidCallbackVar *DesktopAppLaunchCallback, PidCallbackDataVar uintptr) (bool, error) { |
| 356 | var cerr *glib.Error | 356 | var cerr *glib.Error | ||
| 357 | 357 | ||||
| 358 | - | cret := xDesktopAppInfoLaunchUrisAsManager(x.GoPointer(), UrisVar, LaunchContextVar.GoPointer(), SpawnFlagsVar, purego.NewCallback(UserSetupVar), UserSetupDataVar, purego.NewCallback(PidCallbackVar), PidCallbackDataVar, &cerr) | 358 | + | cret := xDesktopAppInfoLaunchUrisAsManager(x.GoPointer(), UrisVar, LaunchContextVar.GoPointer(), SpawnFlagsVar, glib.NewCallback(UserSetupVar), UserSetupDataVar, glib.NewCallback(PidCallbackVar), PidCallbackDataVar, &cerr) |
| 359 | if cerr == nil { | 359 | if cerr == nil { | ||
| 360 | return cret, nil | 360 | return cret, nil | ||
| 361 | } | 361 | } | ||
| @@ -371,10 +371,10 @@ var xDesktopAppInfoLaunchUrisAsManagerWithFds func(uintptr, *glib.List, uintptr, | |||||
| 371 | // | 371 | // | ||
| 372 | // If application launching occurs via some non-spawn mechanism (e.g. D-Bus | 372 | // If application launching occurs via some non-spawn mechanism (e.g. D-Bus | ||
| 373 | // activation) then @stdin_fd, @stdout_fd and @stderr_fd are ignored. | 373 | // activation) then @stdin_fd, @stdout_fd and @stderr_fd are ignored. | ||
| 374 | - | func (x *DesktopAppInfo) LaunchUrisAsManagerWithFds(UrisVar *glib.List, LaunchContextVar *AppLaunchContext, SpawnFlagsVar glib.SpawnFlags, UserSetupVar glib.SpawnChildSetupFunc, UserSetupDataVar uintptr, PidCallbackVar DesktopAppLaunchCallback, PidCallbackDataVar uintptr, StdinFdVar int, StdoutFdVar int, StderrFdVar int) (bool, error) { | 374 | + | func (x *DesktopAppInfo) LaunchUrisAsManagerWithFds(UrisVar *glib.List, LaunchContextVar *AppLaunchContext, SpawnFlagsVar glib.SpawnFlags, UserSetupVar *glib.SpawnChildSetupFunc, UserSetupDataVar uintptr, PidCallbackVar *DesktopAppLaunchCallback, PidCallbackDataVar uintptr, StdinFdVar int, StdoutFdVar int, StderrFdVar int) (bool, error) { |
| 375 | var cerr *glib.Error | 375 | var cerr *glib.Error | ||
| 376 | 376 | ||||
| 377 | - | cret := xDesktopAppInfoLaunchUrisAsManagerWithFds(x.GoPointer(), UrisVar, LaunchContextVar.GoPointer(), SpawnFlagsVar, purego.NewCallback(UserSetupVar), UserSetupDataVar, purego.NewCallback(PidCallbackVar), PidCallbackDataVar, StdinFdVar, StdoutFdVar, StderrFdVar, &cerr) | 377 | + | cret := xDesktopAppInfoLaunchUrisAsManagerWithFds(x.GoPointer(), UrisVar, LaunchContextVar.GoPointer(), SpawnFlagsVar, glib.NewCallback(UserSetupVar), UserSetupDataVar, glib.NewCallback(PidCallbackVar), PidCallbackDataVar, StdinFdVar, StdoutFdVar, StderrFdVar, &cerr) |
| 378 | if cerr == nil { | 378 | if cerr == nil { | ||
| 379 | return cret, nil | 379 | return cret, nil | ||
| 380 | } | 380 | } | ||
| @@ -609,9 +609,9 @@ func (x *DesktopAppInfo) LaunchUris(UrisVar *glib.List, ContextVar *AppLaunchCon | |||||
| 609 | // waits for activation in case of D-Bus–activated applications and also provides | 609 | // waits for activation in case of D-Bus–activated applications and also provides | ||
| 610 | // extended error information for sandboxed applications, see notes for | 610 | // extended error information for sandboxed applications, see notes for | ||
| 611 | // g_app_info_launch_default_for_uri_async(). | 611 | // g_app_info_launch_default_for_uri_async(). | ||
| 612 | - | func (x *DesktopAppInfo) LaunchUrisAsync(UrisVar *glib.List, ContextVar *AppLaunchContext, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 612 | + | func (x *DesktopAppInfo) LaunchUrisAsync(UrisVar *glib.List, ContextVar *AppLaunchContext, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 613 | 613 | ||||
| 614 | - | XGAppInfoLaunchUrisAsync(x.GoPointer(), UrisVar, ContextVar.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 614 | + | XGAppInfoLaunchUrisAsync(x.GoPointer(), UrisVar, ContextVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 615 | 615 | ||||
| 616 | } | 616 | } | ||
| 617 | 617 | ||||
M v4/gio/gdrive.go +15 -15
| @@ -52,9 +52,9 @@ type Drive interface { | |||||
| 52 | CanStart() bool | 52 | CanStart() bool | ||
| 53 | CanStartDegraded() bool | 53 | CanStartDegraded() bool | ||
| 54 | CanStop() bool | 54 | CanStop() bool | ||
| 55 | - | Eject(FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 55 | + | Eject(FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 56 | EjectFinish(ResultVar AsyncResult) bool | 56 | EjectFinish(ResultVar AsyncResult) bool | ||
| 57 | - | EjectWithOperation(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 57 | + | EjectWithOperation(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 58 | EjectWithOperationFinish(ResultVar AsyncResult) bool | 58 | EjectWithOperationFinish(ResultVar AsyncResult) bool | ||
| 59 | EnumerateIdentifiers() []string | 59 | EnumerateIdentifiers() []string | ||
| 60 | GetIcon() *IconBase | 60 | GetIcon() *IconBase | ||
| @@ -69,11 +69,11 @@ type Drive interface { | |||||
| 69 | IsMediaCheckAutomatic() bool | 69 | IsMediaCheckAutomatic() bool | ||
| 70 | IsMediaRemovable() bool | 70 | IsMediaRemovable() bool | ||
| 71 | IsRemovable() bool | 71 | IsRemovable() bool | ||
| 72 | - | PollForMedia(CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 72 | + | PollForMedia(CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 73 | PollForMediaFinish(ResultVar AsyncResult) bool | 73 | PollForMediaFinish(ResultVar AsyncResult) bool | ||
| 74 | - | Start(FlagsVar DriveStartFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 74 | + | Start(FlagsVar DriveStartFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 75 | StartFinish(ResultVar AsyncResult) bool | 75 | StartFinish(ResultVar AsyncResult) bool | ||
| 76 | - | Stop(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 76 | + | Stop(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 77 | StopFinish(ResultVar AsyncResult) bool | 77 | StopFinish(ResultVar AsyncResult) bool | ||
| 78 | } | 78 | } | ||
| 79 | type DriveBase struct { | 79 | type DriveBase struct { | ||
| @@ -128,9 +128,9 @@ func (x *DriveBase) CanStop() bool { | |||||
| 128 | // When the operation is finished, @callback will be called. | 128 | // When the operation is finished, @callback will be called. | ||
| 129 | // You can then call g_drive_eject_finish() to obtain the | 129 | // You can then call g_drive_eject_finish() to obtain the | ||
| 130 | // result of the operation. | 130 | // result of the operation. | ||
| 131 | - | func (x *DriveBase) Eject(FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 131 | + | func (x *DriveBase) Eject(FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 132 | 132 | ||||
| 133 | - | XGDriveEject(x.GoPointer(), FlagsVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 133 | + | XGDriveEject(x.GoPointer(), FlagsVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 134 | 134 | ||||
| 135 | } | 135 | } | ||
| 136 | 136 | ||||
| @@ -149,9 +149,9 @@ func (x *DriveBase) EjectFinish(ResultVar AsyncResult) (bool, error) { | |||||
| 149 | // Ejects a drive. This is an asynchronous operation, and is | 149 | // Ejects a drive. This is an asynchronous operation, and is | ||
| 150 | // finished by calling g_drive_eject_with_operation_finish() with the @drive | 150 | // finished by calling g_drive_eject_with_operation_finish() with the @drive | ||
| 151 | // and #GAsyncResult data returned in the @callback. | 151 | // and #GAsyncResult data returned in the @callback. | ||
| 152 | - | func (x *DriveBase) EjectWithOperation(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 152 | + | func (x *DriveBase) EjectWithOperation(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 153 | 153 | ||||
| 154 | - | XGDriveEjectWithOperation(x.GoPointer(), FlagsVar, MountOperationVar.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 154 | + | XGDriveEjectWithOperation(x.GoPointer(), FlagsVar, MountOperationVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 155 | 155 | ||||
| 156 | } | 156 | } | ||
| 157 | 157 | ||||
| @@ -288,9 +288,9 @@ func (x *DriveBase) IsRemovable() bool { | |||||
| 288 | // When the operation is finished, @callback will be called. | 288 | // When the operation is finished, @callback will be called. | ||
| 289 | // You can then call g_drive_poll_for_media_finish() to obtain the | 289 | // You can then call g_drive_poll_for_media_finish() to obtain the | ||
| 290 | // result of the operation. | 290 | // result of the operation. | ||
| 291 | - | func (x *DriveBase) PollForMedia(CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 291 | + | func (x *DriveBase) PollForMedia(CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 292 | 292 | ||||
| 293 | - | XGDrivePollForMedia(x.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 293 | + | XGDrivePollForMedia(x.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 294 | 294 | ||||
| 295 | } | 295 | } | ||
| 296 | 296 | ||||
| @@ -311,9 +311,9 @@ func (x *DriveBase) PollForMediaFinish(ResultVar AsyncResult) (bool, error) { | |||||
| 311 | // When the operation is finished, @callback will be called. | 311 | // When the operation is finished, @callback will be called. | ||
| 312 | // You can then call g_drive_start_finish() to obtain the | 312 | // You can then call g_drive_start_finish() to obtain the | ||
| 313 | // result of the operation. | 313 | // result of the operation. | ||
| 314 | - | func (x *DriveBase) Start(FlagsVar DriveStartFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 314 | + | func (x *DriveBase) Start(FlagsVar DriveStartFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 315 | 315 | ||||
| 316 | - | XGDriveStart(x.GoPointer(), FlagsVar, MountOperationVar.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 316 | + | XGDriveStart(x.GoPointer(), FlagsVar, MountOperationVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 317 | 317 | ||||
| 318 | } | 318 | } | ||
| 319 | 319 | ||||
| @@ -334,9 +334,9 @@ func (x *DriveBase) StartFinish(ResultVar AsyncResult) (bool, error) { | |||||
| 334 | // When the operation is finished, @callback will be called. | 334 | // When the operation is finished, @callback will be called. | ||
| 335 | // You can then call g_drive_stop_finish() to obtain the | 335 | // You can then call g_drive_stop_finish() to obtain the | ||
| 336 | // result of the operation. | 336 | // result of the operation. | ||
| 337 | - | func (x *DriveBase) Stop(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 337 | + | func (x *DriveBase) Stop(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 338 | 338 | ||||
| 339 | - | XGDriveStop(x.GoPointer(), FlagsVar, MountOperationVar.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 339 | + | XGDriveStop(x.GoPointer(), FlagsVar, MountOperationVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 340 | 340 | ||||
| 341 | } | 341 | } | ||
| 342 | 342 | ||||
M v4/gio/gdtlsconnection.go +9 -9
| @@ -42,7 +42,7 @@ type DtlsConnection interface { | |||||
| 42 | GoPointer() uintptr | 42 | GoPointer() uintptr | ||
| 43 | SetGoPointer(uintptr) | 43 | SetGoPointer(uintptr) | ||
| 44 | Close(CancellableVar *Cancellable) bool | 44 | Close(CancellableVar *Cancellable) bool | ||
| 45 | - | CloseAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 45 | + | CloseAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 46 | CloseFinish(ResultVar AsyncResult) bool | 46 | CloseFinish(ResultVar AsyncResult) bool | ||
| 47 | EmitAcceptCertificate(PeerCertVar *TlsCertificate, ErrorsVar TlsCertificateFlags) bool | 47 | EmitAcceptCertificate(PeerCertVar *TlsCertificate, ErrorsVar TlsCertificateFlags) bool | ||
| 48 | GetCertificate() *TlsCertificate | 48 | GetCertificate() *TlsCertificate | ||
| @@ -57,7 +57,7 @@ type DtlsConnection interface { | |||||
| 57 | GetRehandshakeMode() TlsRehandshakeMode | 57 | GetRehandshakeMode() TlsRehandshakeMode | ||
| 58 | GetRequireCloseNotify() bool | 58 | GetRequireCloseNotify() bool | ||
| 59 | Handshake(CancellableVar *Cancellable) bool | 59 | Handshake(CancellableVar *Cancellable) bool | ||
| 60 | - | HandshakeAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 60 | + | HandshakeAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 61 | HandshakeFinish(ResultVar AsyncResult) bool | 61 | HandshakeFinish(ResultVar AsyncResult) bool | ||
| 62 | SetAdvertisedProtocols(ProtocolsVar uintptr) | 62 | SetAdvertisedProtocols(ProtocolsVar uintptr) | ||
| 63 | SetCertificate(CertificateVar *TlsCertificate) | 63 | SetCertificate(CertificateVar *TlsCertificate) | ||
| @@ -66,7 +66,7 @@ type DtlsConnection interface { | |||||
| 66 | SetRehandshakeMode(ModeVar TlsRehandshakeMode) | 66 | SetRehandshakeMode(ModeVar TlsRehandshakeMode) | ||
| 67 | SetRequireCloseNotify(RequireCloseNotifyVar bool) | 67 | SetRequireCloseNotify(RequireCloseNotifyVar bool) | ||
| 68 | Shutdown(ShutdownReadVar bool, ShutdownWriteVar bool, CancellableVar *Cancellable) bool | 68 | Shutdown(ShutdownReadVar bool, ShutdownWriteVar bool, CancellableVar *Cancellable) bool | ||
| 69 | - | ShutdownAsync(ShutdownReadVar bool, ShutdownWriteVar bool, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 69 | + | ShutdownAsync(ShutdownReadVar bool, ShutdownWriteVar bool, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 70 | ShutdownFinish(ResultVar AsyncResult) bool | 70 | ShutdownFinish(ResultVar AsyncResult) bool | ||
| 71 | } | 71 | } | ||
| 72 | type DtlsConnectionBase struct { | 72 | type DtlsConnectionBase struct { | ||
| @@ -113,9 +113,9 @@ func (x *DtlsConnectionBase) Close(CancellableVar *Cancellable) (bool, error) { | |||||
| 113 | 113 | ||||
| 114 | // Asynchronously close the DTLS connection. See g_dtls_connection_close() for | 114 | // Asynchronously close the DTLS connection. See g_dtls_connection_close() for | ||
| 115 | // more information. | 115 | // more information. | ||
| 116 | - | func (x *DtlsConnectionBase) CloseAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 116 | + | func (x *DtlsConnectionBase) CloseAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 117 | 117 | ||||
| 118 | - | XGDtlsConnectionCloseAsync(x.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 118 | + | XGDtlsConnectionCloseAsync(x.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 119 | 119 | ||||
| 120 | } | 120 | } | ||
| 121 | 121 | ||||
| @@ -332,9 +332,9 @@ func (x *DtlsConnectionBase) Handshake(CancellableVar *Cancellable) (bool, error | |||||
| 332 | 332 | ||||
| 333 | // Asynchronously performs a TLS handshake on @conn. See | 333 | // Asynchronously performs a TLS handshake on @conn. See | ||
| 334 | // g_dtls_connection_handshake() for more information. | 334 | // g_dtls_connection_handshake() for more information. | ||
| 335 | - | func (x *DtlsConnectionBase) HandshakeAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 335 | + | func (x *DtlsConnectionBase) HandshakeAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 336 | 336 | ||||
| 337 | - | XGDtlsConnectionHandshakeAsync(x.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 337 | + | XGDtlsConnectionHandshakeAsync(x.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 338 | 338 | ||||
| 339 | } | 339 | } | ||
| 340 | 340 | ||||
| @@ -490,9 +490,9 @@ func (x *DtlsConnectionBase) Shutdown(ShutdownReadVar bool, ShutdownWriteVar boo | |||||
| 490 | 490 | ||||
| 491 | // Asynchronously shut down part or all of the DTLS connection. See | 491 | // Asynchronously shut down part or all of the DTLS connection. See | ||
| 492 | // g_dtls_connection_shutdown() for more information. | 492 | // g_dtls_connection_shutdown() for more information. | ||
| 493 | - | func (x *DtlsConnectionBase) ShutdownAsync(ShutdownReadVar bool, ShutdownWriteVar bool, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 493 | + | func (x *DtlsConnectionBase) ShutdownAsync(ShutdownReadVar bool, ShutdownWriteVar bool, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 494 | 494 | ||||
| 495 | - | XGDtlsConnectionShutdownAsync(x.GoPointer(), ShutdownReadVar, ShutdownWriteVar, IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 495 | + | XGDtlsConnectionShutdownAsync(x.GoPointer(), ShutdownReadVar, ShutdownWriteVar, IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 496 | 496 | ||||
| 497 | } | 497 | } | ||
| 498 | 498 | ||||
M v4/gio/gfile.go +111 -111
| @@ -106,33 +106,33 @@ type File interface { | |||||
| 106 | GoPointer() uintptr | 106 | GoPointer() uintptr | ||
| 107 | SetGoPointer(uintptr) | 107 | SetGoPointer(uintptr) | ||
| 108 | AppendTo(FlagsVar FileCreateFlags, CancellableVar *Cancellable) *FileOutputStream | 108 | AppendTo(FlagsVar FileCreateFlags, CancellableVar *Cancellable) *FileOutputStream | ||
| 109 | - | AppendToAsync(FlagsVar FileCreateFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 109 | + | AppendToAsync(FlagsVar FileCreateFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 110 | AppendToFinish(ResVar AsyncResult) *FileOutputStream | 110 | AppendToFinish(ResVar AsyncResult) *FileOutputStream | ||
| 111 | BuildAttributeListForCopy(FlagsVar FileCopyFlags, CancellableVar *Cancellable) string | 111 | BuildAttributeListForCopy(FlagsVar FileCopyFlags, CancellableVar *Cancellable) string | ||
| 112 | - | Copy(DestinationVar File, FlagsVar FileCopyFlags, CancellableVar *Cancellable, ProgressCallbackVar FileProgressCallback, ProgressCallbackDataVar uintptr) bool | 112 | + | Copy(DestinationVar File, FlagsVar FileCopyFlags, CancellableVar *Cancellable, ProgressCallbackVar *FileProgressCallback, ProgressCallbackDataVar uintptr) bool |
| 113 | - | CopyAsync(DestinationVar File, FlagsVar FileCopyFlags, IoPriorityVar int, CancellableVar *Cancellable, ProgressCallbackVar FileProgressCallback, ProgressCallbackDataVar uintptr, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 113 | + | CopyAsync(DestinationVar File, FlagsVar FileCopyFlags, IoPriorityVar int, CancellableVar *Cancellable, ProgressCallbackVar *FileProgressCallback, ProgressCallbackDataVar uintptr, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 114 | CopyAttributes(DestinationVar File, FlagsVar FileCopyFlags, CancellableVar *Cancellable) bool | 114 | CopyAttributes(DestinationVar File, FlagsVar FileCopyFlags, CancellableVar *Cancellable) bool | ||
| 115 | CopyFinish(ResVar AsyncResult) bool | 115 | CopyFinish(ResVar AsyncResult) bool | ||
| 116 | Create(FlagsVar FileCreateFlags, CancellableVar *Cancellable) *FileOutputStream | 116 | Create(FlagsVar FileCreateFlags, CancellableVar *Cancellable) *FileOutputStream | ||
| 117 | - | CreateAsync(FlagsVar FileCreateFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 117 | + | CreateAsync(FlagsVar FileCreateFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 118 | CreateFinish(ResVar AsyncResult) *FileOutputStream | 118 | CreateFinish(ResVar AsyncResult) *FileOutputStream | ||
| 119 | CreateReadwrite(FlagsVar FileCreateFlags, CancellableVar *Cancellable) *FileIOStream | 119 | CreateReadwrite(FlagsVar FileCreateFlags, CancellableVar *Cancellable) *FileIOStream | ||
| 120 | - | CreateReadwriteAsync(FlagsVar FileCreateFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 120 | + | CreateReadwriteAsync(FlagsVar FileCreateFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 121 | CreateReadwriteFinish(ResVar AsyncResult) *FileIOStream | 121 | CreateReadwriteFinish(ResVar AsyncResult) *FileIOStream | ||
| 122 | Delete(CancellableVar *Cancellable) bool | 122 | Delete(CancellableVar *Cancellable) bool | ||
| 123 | - | DeleteAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 123 | + | DeleteAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 124 | DeleteFinish(ResultVar AsyncResult) bool | 124 | DeleteFinish(ResultVar AsyncResult) bool | ||
| 125 | Dup() *FileBase | 125 | Dup() *FileBase | ||
| 126 | - | EjectMountable(FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 126 | + | EjectMountable(FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 127 | EjectMountableFinish(ResultVar AsyncResult) bool | 127 | EjectMountableFinish(ResultVar AsyncResult) bool | ||
| 128 | - | EjectMountableWithOperation(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 128 | + | EjectMountableWithOperation(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 129 | EjectMountableWithOperationFinish(ResultVar AsyncResult) bool | 129 | EjectMountableWithOperationFinish(ResultVar AsyncResult) bool | ||
| 130 | EnumerateChildren(AttributesVar string, FlagsVar FileQueryInfoFlags, CancellableVar *Cancellable) *FileEnumerator | 130 | EnumerateChildren(AttributesVar string, FlagsVar FileQueryInfoFlags, CancellableVar *Cancellable) *FileEnumerator | ||
| 131 | - | EnumerateChildrenAsync(AttributesVar string, FlagsVar FileQueryInfoFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 131 | + | EnumerateChildrenAsync(AttributesVar string, FlagsVar FileQueryInfoFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 132 | EnumerateChildrenFinish(ResVar AsyncResult) *FileEnumerator | 132 | EnumerateChildrenFinish(ResVar AsyncResult) *FileEnumerator | ||
| 133 | Equal(File2Var File) bool | 133 | Equal(File2Var File) bool | ||
| 134 | FindEnclosingMount(CancellableVar *Cancellable) *MountBase | 134 | FindEnclosingMount(CancellableVar *Cancellable) *MountBase | ||
| 135 | - | FindEnclosingMountAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 135 | + | FindEnclosingMountAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 136 | FindEnclosingMountFinish(ResVar AsyncResult) *MountBase | 136 | FindEnclosingMountFinish(ResVar AsyncResult) *MountBase | ||
| 137 | GetBasename() string | 137 | GetBasename() string | ||
| 138 | GetChild(NameVar string) *FileBase | 138 | GetChild(NameVar string) *FileBase | ||
| @@ -149,62 +149,62 @@ type File interface { | |||||
| 149 | Hash() uint | 149 | Hash() uint | ||
| 150 | IsNative() bool | 150 | IsNative() bool | ||
| 151 | LoadBytes(CancellableVar *Cancellable, EtagOutVar string) *glib.Bytes | 151 | LoadBytes(CancellableVar *Cancellable, EtagOutVar string) *glib.Bytes | ||
| 152 | - | LoadBytesAsync(CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 152 | + | LoadBytesAsync(CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 153 | LoadBytesFinish(ResultVar AsyncResult, EtagOutVar string) *glib.Bytes | 153 | LoadBytesFinish(ResultVar AsyncResult, EtagOutVar string) *glib.Bytes | ||
| 154 | LoadContents(CancellableVar *Cancellable, ContentsVar []string, LengthVar uint, EtagOutVar string) bool | 154 | LoadContents(CancellableVar *Cancellable, ContentsVar []string, LengthVar uint, EtagOutVar string) bool | ||
| 155 | - | LoadContentsAsync(CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 155 | + | LoadContentsAsync(CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 156 | LoadContentsFinish(ResVar AsyncResult, ContentsVar []string, LengthVar uint, EtagOutVar string) bool | 156 | LoadContentsFinish(ResVar AsyncResult, ContentsVar []string, LengthVar uint, EtagOutVar string) bool | ||
| 157 | - | LoadPartialContentsAsync(CancellableVar *Cancellable, ReadMoreCallbackVar FileReadMoreCallback, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 157 | + | LoadPartialContentsAsync(CancellableVar *Cancellable, ReadMoreCallbackVar *FileReadMoreCallback, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 158 | LoadPartialContentsFinish(ResVar AsyncResult, ContentsVar []string, LengthVar uint, EtagOutVar string) bool | 158 | LoadPartialContentsFinish(ResVar AsyncResult, ContentsVar []string, LengthVar uint, EtagOutVar string) bool | ||
| 159 | MakeDirectory(CancellableVar *Cancellable) bool | 159 | MakeDirectory(CancellableVar *Cancellable) bool | ||
| 160 | - | MakeDirectoryAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 160 | + | MakeDirectoryAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 161 | MakeDirectoryFinish(ResultVar AsyncResult) bool | 161 | MakeDirectoryFinish(ResultVar AsyncResult) bool | ||
| 162 | MakeDirectoryWithParents(CancellableVar *Cancellable) bool | 162 | MakeDirectoryWithParents(CancellableVar *Cancellable) bool | ||
| 163 | MakeSymbolicLink(SymlinkValueVar string, CancellableVar *Cancellable) bool | 163 | MakeSymbolicLink(SymlinkValueVar string, CancellableVar *Cancellable) bool | ||
| 164 | - | MeasureDiskUsage(FlagsVar FileMeasureFlags, CancellableVar *Cancellable, ProgressCallbackVar FileMeasureProgressCallback, ProgressDataVar uintptr, DiskUsageVar uint64, NumDirsVar uint64, NumFilesVar uint64) bool | 164 | + | MeasureDiskUsage(FlagsVar FileMeasureFlags, CancellableVar *Cancellable, ProgressCallbackVar *FileMeasureProgressCallback, ProgressDataVar uintptr, DiskUsageVar uint64, NumDirsVar uint64, NumFilesVar uint64) bool |
| 165 | - | MeasureDiskUsageAsync(FlagsVar FileMeasureFlags, IoPriorityVar int, CancellableVar *Cancellable, ProgressCallbackVar FileMeasureProgressCallback, ProgressDataVar uintptr, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 165 | + | MeasureDiskUsageAsync(FlagsVar FileMeasureFlags, IoPriorityVar int, CancellableVar *Cancellable, ProgressCallbackVar *FileMeasureProgressCallback, ProgressDataVar uintptr, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 166 | MeasureDiskUsageFinish(ResultVar AsyncResult, DiskUsageVar uint64, NumDirsVar uint64, NumFilesVar uint64) bool | 166 | MeasureDiskUsageFinish(ResultVar AsyncResult, DiskUsageVar uint64, NumDirsVar uint64, NumFilesVar uint64) bool | ||
| 167 | Monitor(FlagsVar FileMonitorFlags, CancellableVar *Cancellable) *FileMonitor | 167 | Monitor(FlagsVar FileMonitorFlags, CancellableVar *Cancellable) *FileMonitor | ||
| 168 | MonitorDirectory(FlagsVar FileMonitorFlags, CancellableVar *Cancellable) *FileMonitor | 168 | MonitorDirectory(FlagsVar FileMonitorFlags, CancellableVar *Cancellable) *FileMonitor | ||
| 169 | MonitorFile(FlagsVar FileMonitorFlags, CancellableVar *Cancellable) *FileMonitor | 169 | MonitorFile(FlagsVar FileMonitorFlags, CancellableVar *Cancellable) *FileMonitor | ||
| 170 | - | MountEnclosingVolume(FlagsVar MountMountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 170 | + | MountEnclosingVolume(FlagsVar MountMountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 171 | MountEnclosingVolumeFinish(ResultVar AsyncResult) bool | 171 | MountEnclosingVolumeFinish(ResultVar AsyncResult) bool | ||
| 172 | - | MountMountable(FlagsVar MountMountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 172 | + | MountMountable(FlagsVar MountMountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 173 | MountMountableFinish(ResultVar AsyncResult) *FileBase | 173 | MountMountableFinish(ResultVar AsyncResult) *FileBase | ||
| 174 | - | Move(DestinationVar File, FlagsVar FileCopyFlags, CancellableVar *Cancellable, ProgressCallbackVar FileProgressCallback, ProgressCallbackDataVar uintptr) bool | 174 | + | Move(DestinationVar File, FlagsVar FileCopyFlags, CancellableVar *Cancellable, ProgressCallbackVar *FileProgressCallback, ProgressCallbackDataVar uintptr) bool |
| 175 | - | MoveAsync(DestinationVar File, FlagsVar FileCopyFlags, IoPriorityVar int, CancellableVar *Cancellable, ProgressCallbackVar FileProgressCallback, ProgressCallbackDataVar uintptr, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 175 | + | MoveAsync(DestinationVar File, FlagsVar FileCopyFlags, IoPriorityVar int, CancellableVar *Cancellable, ProgressCallbackVar *FileProgressCallback, ProgressCallbackDataVar uintptr, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 176 | MoveFinish(ResultVar AsyncResult) bool | 176 | MoveFinish(ResultVar AsyncResult) bool | ||
| 177 | OpenReadwrite(CancellableVar *Cancellable) *FileIOStream | 177 | OpenReadwrite(CancellableVar *Cancellable) *FileIOStream | ||
| 178 | - | OpenReadwriteAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 178 | + | OpenReadwriteAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 179 | OpenReadwriteFinish(ResVar AsyncResult) *FileIOStream | 179 | OpenReadwriteFinish(ResVar AsyncResult) *FileIOStream | ||
| 180 | PeekPath() string | 180 | PeekPath() string | ||
| 181 | - | PollMountable(CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 181 | + | PollMountable(CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 182 | PollMountableFinish(ResultVar AsyncResult) bool | 182 | PollMountableFinish(ResultVar AsyncResult) bool | ||
| 183 | QueryDefaultHandler(CancellableVar *Cancellable) *AppInfoBase | 183 | QueryDefaultHandler(CancellableVar *Cancellable) *AppInfoBase | ||
| 184 | - | QueryDefaultHandlerAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 184 | + | QueryDefaultHandlerAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 185 | QueryDefaultHandlerFinish(ResultVar AsyncResult) *AppInfoBase | 185 | QueryDefaultHandlerFinish(ResultVar AsyncResult) *AppInfoBase | ||
| 186 | QueryExists(CancellableVar *Cancellable) bool | 186 | QueryExists(CancellableVar *Cancellable) bool | ||
| 187 | QueryFileType(FlagsVar FileQueryInfoFlags, CancellableVar *Cancellable) FileType | 187 | QueryFileType(FlagsVar FileQueryInfoFlags, CancellableVar *Cancellable) FileType | ||
| 188 | QueryFilesystemInfo(AttributesVar string, CancellableVar *Cancellable) *FileInfo | 188 | QueryFilesystemInfo(AttributesVar string, CancellableVar *Cancellable) *FileInfo | ||
| 189 | - | QueryFilesystemInfoAsync(AttributesVar string, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 189 | + | QueryFilesystemInfoAsync(AttributesVar string, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 190 | QueryFilesystemInfoFinish(ResVar AsyncResult) *FileInfo | 190 | QueryFilesystemInfoFinish(ResVar AsyncResult) *FileInfo | ||
| 191 | QueryInfo(AttributesVar string, FlagsVar FileQueryInfoFlags, CancellableVar *Cancellable) *FileInfo | 191 | QueryInfo(AttributesVar string, FlagsVar FileQueryInfoFlags, CancellableVar *Cancellable) *FileInfo | ||
| 192 | - | QueryInfoAsync(AttributesVar string, FlagsVar FileQueryInfoFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 192 | + | QueryInfoAsync(AttributesVar string, FlagsVar FileQueryInfoFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 193 | QueryInfoFinish(ResVar AsyncResult) *FileInfo | 193 | QueryInfoFinish(ResVar AsyncResult) *FileInfo | ||
| 194 | QuerySettableAttributes(CancellableVar *Cancellable) *FileAttributeInfoList | 194 | QuerySettableAttributes(CancellableVar *Cancellable) *FileAttributeInfoList | ||
| 195 | QueryWritableNamespaces(CancellableVar *Cancellable) *FileAttributeInfoList | 195 | QueryWritableNamespaces(CancellableVar *Cancellable) *FileAttributeInfoList | ||
| 196 | Read(CancellableVar *Cancellable) *FileInputStream | 196 | Read(CancellableVar *Cancellable) *FileInputStream | ||
| 197 | - | ReadAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 197 | + | ReadAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 198 | ReadFinish(ResVar AsyncResult) *FileInputStream | 198 | ReadFinish(ResVar AsyncResult) *FileInputStream | ||
| 199 | Replace(EtagVar string, MakeBackupVar bool, FlagsVar FileCreateFlags, CancellableVar *Cancellable) *FileOutputStream | 199 | Replace(EtagVar string, MakeBackupVar bool, FlagsVar FileCreateFlags, CancellableVar *Cancellable) *FileOutputStream | ||
| 200 | - | ReplaceAsync(EtagVar string, MakeBackupVar bool, FlagsVar FileCreateFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 200 | + | ReplaceAsync(EtagVar string, MakeBackupVar bool, FlagsVar FileCreateFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 201 | ReplaceContents(ContentsVar string, LengthVar uint, EtagVar string, MakeBackupVar bool, FlagsVar FileCreateFlags, NewEtagVar string, CancellableVar *Cancellable) bool | 201 | ReplaceContents(ContentsVar string, LengthVar uint, EtagVar string, MakeBackupVar bool, FlagsVar FileCreateFlags, NewEtagVar string, CancellableVar *Cancellable) bool | ||
| 202 | - | ReplaceContentsAsync(ContentsVar string, LengthVar uint, EtagVar string, MakeBackupVar bool, FlagsVar FileCreateFlags, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 202 | + | ReplaceContentsAsync(ContentsVar string, LengthVar uint, EtagVar string, MakeBackupVar bool, FlagsVar FileCreateFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 203 | - | ReplaceContentsBytesAsync(ContentsVar *glib.Bytes, EtagVar string, MakeBackupVar bool, FlagsVar FileCreateFlags, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 203 | + | ReplaceContentsBytesAsync(ContentsVar *glib.Bytes, EtagVar string, MakeBackupVar bool, FlagsVar FileCreateFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 204 | ReplaceContentsFinish(ResVar AsyncResult, NewEtagVar string) bool | 204 | ReplaceContentsFinish(ResVar AsyncResult, NewEtagVar string) bool | ||
| 205 | ReplaceFinish(ResVar AsyncResult) *FileOutputStream | 205 | ReplaceFinish(ResVar AsyncResult) *FileOutputStream | ||
| 206 | ReplaceReadwrite(EtagVar string, MakeBackupVar bool, FlagsVar FileCreateFlags, CancellableVar *Cancellable) *FileIOStream | 206 | ReplaceReadwrite(EtagVar string, MakeBackupVar bool, FlagsVar FileCreateFlags, CancellableVar *Cancellable) *FileIOStream | ||
| 207 | - | ReplaceReadwriteAsync(EtagVar string, MakeBackupVar bool, FlagsVar FileCreateFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 207 | + | ReplaceReadwriteAsync(EtagVar string, MakeBackupVar bool, FlagsVar FileCreateFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 208 | ReplaceReadwriteFinish(ResVar AsyncResult) *FileIOStream | 208 | ReplaceReadwriteFinish(ResVar AsyncResult) *FileIOStream | ||
| 209 | ResolveRelativePath(RelativePathVar string) *FileBase | 209 | ResolveRelativePath(RelativePathVar string) *FileBase | ||
| 210 | SetAttribute(AttributeVar string, TypeVar FileAttributeType, ValuePVar uintptr, FlagsVar FileQueryInfoFlags, CancellableVar *Cancellable) bool | 210 | SetAttribute(AttributeVar string, TypeVar FileAttributeType, ValuePVar uintptr, FlagsVar FileQueryInfoFlags, CancellableVar *Cancellable) bool | ||
| @@ -214,23 +214,23 @@ type File interface { | |||||
| 214 | SetAttributeString(AttributeVar string, ValueVar string, FlagsVar FileQueryInfoFlags, CancellableVar *Cancellable) bool | 214 | SetAttributeString(AttributeVar string, ValueVar string, FlagsVar FileQueryInfoFlags, CancellableVar *Cancellable) bool | ||
| 215 | SetAttributeUint32(AttributeVar string, ValueVar uint32, FlagsVar FileQueryInfoFlags, CancellableVar *Cancellable) bool | 215 | SetAttributeUint32(AttributeVar string, ValueVar uint32, FlagsVar FileQueryInfoFlags, CancellableVar *Cancellable) bool | ||
| 216 | SetAttributeUint64(AttributeVar string, ValueVar uint64, FlagsVar FileQueryInfoFlags, CancellableVar *Cancellable) bool | 216 | SetAttributeUint64(AttributeVar string, ValueVar uint64, FlagsVar FileQueryInfoFlags, CancellableVar *Cancellable) bool | ||
| 217 | - | SetAttributesAsync(InfoVar *FileInfo, FlagsVar FileQueryInfoFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 217 | + | SetAttributesAsync(InfoVar *FileInfo, FlagsVar FileQueryInfoFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 218 | SetAttributesFinish(ResultVar AsyncResult, InfoVar **FileInfo) bool | 218 | SetAttributesFinish(ResultVar AsyncResult, InfoVar **FileInfo) bool | ||
| 219 | SetAttributesFromInfo(InfoVar *FileInfo, FlagsVar FileQueryInfoFlags, CancellableVar *Cancellable) bool | 219 | SetAttributesFromInfo(InfoVar *FileInfo, FlagsVar FileQueryInfoFlags, CancellableVar *Cancellable) bool | ||
| 220 | SetDisplayName(DisplayNameVar string, CancellableVar *Cancellable) *FileBase | 220 | SetDisplayName(DisplayNameVar string, CancellableVar *Cancellable) *FileBase | ||
| 221 | - | SetDisplayNameAsync(DisplayNameVar string, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 221 | + | SetDisplayNameAsync(DisplayNameVar string, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 222 | SetDisplayNameFinish(ResVar AsyncResult) *FileBase | 222 | SetDisplayNameFinish(ResVar AsyncResult) *FileBase | ||
| 223 | - | StartMountable(FlagsVar DriveStartFlags, StartOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 223 | + | StartMountable(FlagsVar DriveStartFlags, StartOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 224 | StartMountableFinish(ResultVar AsyncResult) bool | 224 | StartMountableFinish(ResultVar AsyncResult) bool | ||
| 225 | - | StopMountable(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 225 | + | StopMountable(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 226 | StopMountableFinish(ResultVar AsyncResult) bool | 226 | StopMountableFinish(ResultVar AsyncResult) bool | ||
| 227 | SupportsThreadContexts() bool | 227 | SupportsThreadContexts() bool | ||
| 228 | Trash(CancellableVar *Cancellable) bool | 228 | Trash(CancellableVar *Cancellable) bool | ||
| 229 | - | TrashAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 229 | + | TrashAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 230 | TrashFinish(ResultVar AsyncResult) bool | 230 | TrashFinish(ResultVar AsyncResult) bool | ||
| 231 | - | UnmountMountable(FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 231 | + | UnmountMountable(FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 232 | UnmountMountableFinish(ResultVar AsyncResult) bool | 232 | UnmountMountableFinish(ResultVar AsyncResult) bool | ||
| 233 | - | UnmountMountableWithOperation(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 233 | + | UnmountMountableWithOperation(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 234 | UnmountMountableWithOperationFinish(ResultVar AsyncResult) bool | 234 | UnmountMountableWithOperationFinish(ResultVar AsyncResult) bool | ||
| 235 | } | 235 | } | ||
| 236 | type FileBase struct { | 236 | type FileBase struct { | ||
| @@ -288,9 +288,9 @@ func (x *FileBase) AppendTo(FlagsVar FileCreateFlags, CancellableVar *Cancellabl | |||||
| 288 | // When the operation is finished, @callback will be called. | 288 | // When the operation is finished, @callback will be called. | ||
| 289 | // You can then call g_file_append_to_finish() to get the result | 289 | // You can then call g_file_append_to_finish() to get the result | ||
| 290 | // of the operation. | 290 | // of the operation. | ||
| 291 | - | func (x *FileBase) AppendToAsync(FlagsVar FileCreateFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 291 | + | func (x *FileBase) AppendToAsync(FlagsVar FileCreateFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 292 | 292 | ||||
| 293 | - | XGFileAppendToAsync(x.GoPointer(), FlagsVar, IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 293 | + | XGFileAppendToAsync(x.GoPointer(), FlagsVar, IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 294 | 294 | ||||
| 295 | } | 295 | } | ||
| 296 | 296 | ||||
| @@ -374,10 +374,10 @@ func (x *FileBase) BuildAttributeListForCopy(FlagsVar FileCopyFlags, Cancellable | |||||
| 374 | // | 374 | // | ||
| 375 | // If you are interested in copying the #GFile object itself (not the on-disk | 375 | // If you are interested in copying the #GFile object itself (not the on-disk | ||
| 376 | // file), see g_file_dup(). | 376 | // file), see g_file_dup(). | ||
| 377 | - | func (x *FileBase) Copy(DestinationVar File, FlagsVar FileCopyFlags, CancellableVar *Cancellable, ProgressCallbackVar FileProgressCallback, ProgressCallbackDataVar uintptr) (bool, error) { | 377 | + | func (x *FileBase) Copy(DestinationVar File, FlagsVar FileCopyFlags, CancellableVar *Cancellable, ProgressCallbackVar *FileProgressCallback, ProgressCallbackDataVar uintptr) (bool, error) { |
| 378 | var cerr *glib.Error | 378 | var cerr *glib.Error | ||
| 379 | 379 | ||||
| 380 | - | cret := XGFileCopy(x.GoPointer(), DestinationVar.GoPointer(), FlagsVar, CancellableVar.GoPointer(), purego.NewCallback(ProgressCallbackVar), ProgressCallbackDataVar, &cerr) | 380 | + | cret := XGFileCopy(x.GoPointer(), DestinationVar.GoPointer(), FlagsVar, CancellableVar.GoPointer(), glib.NewCallback(ProgressCallbackVar), ProgressCallbackDataVar, &cerr) |
| 381 | if cerr == nil { | 381 | if cerr == nil { | ||
| 382 | return cret, nil | 382 | return cret, nil | ||
| 383 | } | 383 | } | ||
| @@ -395,9 +395,9 @@ func (x *FileBase) Copy(DestinationVar File, FlagsVar FileCopyFlags, Cancellable | |||||
| 395 | // | 395 | // | ||
| 396 | // When the operation is finished, @callback will be called. You can then call | 396 | // When the operation is finished, @callback will be called. You can then call | ||
| 397 | // g_file_copy_finish() to get the result of the operation. | 397 | // g_file_copy_finish() to get the result of the operation. | ||
| 398 | - | func (x *FileBase) CopyAsync(DestinationVar File, FlagsVar FileCopyFlags, IoPriorityVar int, CancellableVar *Cancellable, ProgressCallbackVar FileProgressCallback, ProgressCallbackDataVar uintptr, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 398 | + | func (x *FileBase) CopyAsync(DestinationVar File, FlagsVar FileCopyFlags, IoPriorityVar int, CancellableVar *Cancellable, ProgressCallbackVar *FileProgressCallback, ProgressCallbackDataVar uintptr, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 399 | 399 | ||||
| 400 | - | XGFileCopyAsync(x.GoPointer(), DestinationVar.GoPointer(), FlagsVar, IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(ProgressCallbackVar), ProgressCallbackDataVar, purego.NewCallback(CallbackVar), UserDataVar) | 400 | + | XGFileCopyAsync(x.GoPointer(), DestinationVar.GoPointer(), FlagsVar, IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(ProgressCallbackVar), ProgressCallbackDataVar, glib.NewCallback(CallbackVar), UserDataVar) |
| 401 | 401 | ||||
| 402 | } | 402 | } | ||
| 403 | 403 | ||||
| @@ -478,9 +478,9 @@ func (x *FileBase) Create(FlagsVar FileCreateFlags, CancellableVar *Cancellable) | |||||
| 478 | // When the operation is finished, @callback will be called. | 478 | // When the operation is finished, @callback will be called. | ||
| 479 | // You can then call g_file_create_finish() to get the result | 479 | // You can then call g_file_create_finish() to get the result | ||
| 480 | // of the operation. | 480 | // of the operation. | ||
| 481 | - | func (x *FileBase) CreateAsync(FlagsVar FileCreateFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 481 | + | func (x *FileBase) CreateAsync(FlagsVar FileCreateFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 482 | 482 | ||||
| 483 | - | XGFileCreateAsync(x.GoPointer(), FlagsVar, IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 483 | + | XGFileCreateAsync(x.GoPointer(), FlagsVar, IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 484 | 484 | ||||
| 485 | } | 485 | } | ||
| 486 | 486 | ||||
| @@ -554,9 +554,9 @@ func (x *FileBase) CreateReadwrite(FlagsVar FileCreateFlags, CancellableVar *Can | |||||
| 554 | // When the operation is finished, @callback will be called. | 554 | // When the operation is finished, @callback will be called. | ||
| 555 | // You can then call g_file_create_readwrite_finish() to get | 555 | // You can then call g_file_create_readwrite_finish() to get | ||
| 556 | // the result of the operation. | 556 | // the result of the operation. | ||
| 557 | - | func (x *FileBase) CreateReadwriteAsync(FlagsVar FileCreateFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 557 | + | func (x *FileBase) CreateReadwriteAsync(FlagsVar FileCreateFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 558 | 558 | ||||
| 559 | - | XGFileCreateReadwriteAsync(x.GoPointer(), FlagsVar, IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 559 | + | XGFileCreateReadwriteAsync(x.GoPointer(), FlagsVar, IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 560 | 560 | ||||
| 561 | } | 561 | } | ||
| 562 | 562 | ||||
| @@ -617,9 +617,9 @@ func (x *FileBase) Delete(CancellableVar *Cancellable) (bool, error) { | |||||
| 617 | // Asynchronously delete a file. If the @file is a directory, it will | 617 | // Asynchronously delete a file. If the @file is a directory, it will | ||
| 618 | // only be deleted if it is empty. This has the same semantics as | 618 | // only be deleted if it is empty. This has the same semantics as | ||
| 619 | // g_unlink(). | 619 | // g_unlink(). | ||
| 620 | - | func (x *FileBase) DeleteAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 620 | + | func (x *FileBase) DeleteAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 621 | 621 | ||||
| 622 | - | XGFileDeleteAsync(x.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 622 | + | XGFileDeleteAsync(x.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 623 | 623 | ||||
| 624 | } | 624 | } | ||
| 625 | 625 | ||||
| @@ -666,9 +666,9 @@ func (x *FileBase) Dup() *FileBase { | |||||
| 666 | // If @cancellable is not %NULL, then the operation can be cancelled by | 666 | // If @cancellable is not %NULL, then the operation can be cancelled by | ||
| 667 | // triggering the cancellable object from another thread. If the operation | 667 | // triggering the cancellable object from another thread. If the operation | ||
| 668 | // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. | 668 | // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. | ||
| 669 | - | func (x *FileBase) EjectMountable(FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 669 | + | func (x *FileBase) EjectMountable(FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 670 | 670 | ||||
| 671 | - | XGFileEjectMountable(x.GoPointer(), FlagsVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 671 | + | XGFileEjectMountable(x.GoPointer(), FlagsVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 672 | 672 | ||||
| 673 | } | 673 | } | ||
| 674 | 674 | ||||
| @@ -693,9 +693,9 @@ func (x *FileBase) EjectMountableFinish(ResultVar AsyncResult) (bool, error) { | |||||
| 693 | // If @cancellable is not %NULL, then the operation can be cancelled by | 693 | // If @cancellable is not %NULL, then the operation can be cancelled by | ||
| 694 | // triggering the cancellable object from another thread. If the operation | 694 | // triggering the cancellable object from another thread. If the operation | ||
| 695 | // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. | 695 | // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. | ||
| 696 | - | func (x *FileBase) EjectMountableWithOperation(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 696 | + | func (x *FileBase) EjectMountableWithOperation(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 697 | 697 | ||||
| 698 | - | XGFileEjectMountableWithOperation(x.GoPointer(), FlagsVar, MountOperationVar.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 698 | + | XGFileEjectMountableWithOperation(x.GoPointer(), FlagsVar, MountOperationVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 699 | 699 | ||||
| 700 | } | 700 | } | ||
| 701 | 701 | ||||
| @@ -765,9 +765,9 @@ func (x *FileBase) EnumerateChildren(AttributesVar string, FlagsVar FileQueryInf | |||||
| 765 | // When the operation is finished, @callback will be called. You can | 765 | // When the operation is finished, @callback will be called. You can | ||
| 766 | // then call g_file_enumerate_children_finish() to get the result of | 766 | // then call g_file_enumerate_children_finish() to get the result of | ||
| 767 | // the operation. | 767 | // the operation. | ||
| 768 | - | func (x *FileBase) EnumerateChildrenAsync(AttributesVar string, FlagsVar FileQueryInfoFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 768 | + | func (x *FileBase) EnumerateChildrenAsync(AttributesVar string, FlagsVar FileQueryInfoFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 769 | 769 | ||||
| 770 | - | XGFileEnumerateChildrenAsync(x.GoPointer(), AttributesVar, FlagsVar, IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 770 | + | XGFileEnumerateChildrenAsync(x.GoPointer(), AttributesVar, FlagsVar, IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 771 | 771 | ||||
| 772 | } | 772 | } | ||
| 773 | 773 | ||||
| @@ -839,9 +839,9 @@ func (x *FileBase) FindEnclosingMount(CancellableVar *Cancellable) (*MountBase, | |||||
| 839 | // When the operation is finished, @callback will be called. | 839 | // When the operation is finished, @callback will be called. | ||
| 840 | // You can then call g_file_find_enclosing_mount_finish() to | 840 | // You can then call g_file_find_enclosing_mount_finish() to | ||
| 841 | // get the result of the operation. | 841 | // get the result of the operation. | ||
| 842 | - | func (x *FileBase) FindEnclosingMountAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 842 | + | func (x *FileBase) FindEnclosingMountAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 843 | 843 | ||||
| 844 | - | XGFileFindEnclosingMountAsync(x.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 844 | + | XGFileFindEnclosingMountAsync(x.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 845 | 845 | ||||
| 846 | } | 846 | } | ||
| 847 | 847 | ||||
| @@ -1111,9 +1111,9 @@ func (x *FileBase) LoadBytes(CancellableVar *Cancellable, EtagOutVar string) (*g | |||||
| 1111 | // asynchronous operation. | 1111 | // asynchronous operation. | ||
| 1112 | // | 1112 | // | ||
| 1113 | // See g_file_load_bytes() for more information. | 1113 | // See g_file_load_bytes() for more information. | ||
| 1114 | - | func (x *FileBase) LoadBytesAsync(CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 1114 | + | func (x *FileBase) LoadBytesAsync(CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 1115 | 1115 | ||||
| 1116 | - | XGFileLoadBytesAsync(x.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 1116 | + | XGFileLoadBytesAsync(x.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 1117 | 1117 | ||||
| 1118 | } | 1118 | } | ||
| 1119 | 1119 | ||||
| @@ -1169,9 +1169,9 @@ func (x *FileBase) LoadContents(CancellableVar *Cancellable, ContentsVar []strin | |||||
| 1169 | // If @cancellable is not %NULL, then the operation can be cancelled by | 1169 | // If @cancellable is not %NULL, then the operation can be cancelled by | ||
| 1170 | // triggering the cancellable object from another thread. If the operation | 1170 | // triggering the cancellable object from another thread. If the operation | ||
| 1171 | // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. | 1171 | // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. | ||
| 1172 | - | func (x *FileBase) LoadContentsAsync(CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 1172 | + | func (x *FileBase) LoadContentsAsync(CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 1173 | 1173 | ||||
| 1174 | - | XGFileLoadContentsAsync(x.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 1174 | + | XGFileLoadContentsAsync(x.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 1175 | 1175 | ||||
| 1176 | } | 1176 | } | ||
| 1177 | 1177 | ||||
| @@ -1202,9 +1202,9 @@ func (x *FileBase) LoadContentsFinish(ResVar AsyncResult, ContentsVar []string, | |||||
| 1202 | // If @cancellable is not %NULL, then the operation can be cancelled by | 1202 | // If @cancellable is not %NULL, then the operation can be cancelled by | ||
| 1203 | // triggering the cancellable object from another thread. If the operation | 1203 | // triggering the cancellable object from another thread. If the operation | ||
| 1204 | // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. | 1204 | // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. | ||
| 1205 | - | func (x *FileBase) LoadPartialContentsAsync(CancellableVar *Cancellable, ReadMoreCallbackVar FileReadMoreCallback, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 1205 | + | func (x *FileBase) LoadPartialContentsAsync(CancellableVar *Cancellable, ReadMoreCallbackVar *FileReadMoreCallback, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 1206 | 1206 | ||||
| 1207 | - | XGFileLoadPartialContentsAsync(x.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(ReadMoreCallbackVar), purego.NewCallback(CallbackVar), UserDataVar) | 1207 | + | XGFileLoadPartialContentsAsync(x.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(ReadMoreCallbackVar), glib.NewCallback(CallbackVar), UserDataVar) |
| 1208 | 1208 | ||||
| 1209 | } | 1209 | } | ||
| 1210 | 1210 | ||||
| @@ -1250,9 +1250,9 @@ func (x *FileBase) MakeDirectory(CancellableVar *Cancellable) (bool, error) { | |||||
| 1250 | } | 1250 | } | ||
| 1251 | 1251 | ||||
| 1252 | // Asynchronously creates a directory. | 1252 | // Asynchronously creates a directory. | ||
| 1253 | - | func (x *FileBase) MakeDirectoryAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 1253 | + | func (x *FileBase) MakeDirectoryAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 1254 | 1254 | ||||
| 1255 | - | XGFileMakeDirectoryAsync(x.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 1255 | + | XGFileMakeDirectoryAsync(x.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 1256 | 1256 | ||||
| 1257 | } | 1257 | } | ||
| 1258 | 1258 | ||||
| @@ -1328,10 +1328,10 @@ func (x *FileBase) MakeSymbolicLink(SymlinkValueVar string, CancellableVar *Canc | |||||
| 1328 | // periodic progress updates while scanning. See the documentation for | 1328 | // periodic progress updates while scanning. See the documentation for | ||
| 1329 | // #GFileMeasureProgressCallback for information about when and how the | 1329 | // #GFileMeasureProgressCallback for information about when and how the | ||
| 1330 | // callback will be invoked. | 1330 | // callback will be invoked. | ||
| 1331 | - | func (x *FileBase) MeasureDiskUsage(FlagsVar FileMeasureFlags, CancellableVar *Cancellable, ProgressCallbackVar FileMeasureProgressCallback, ProgressDataVar uintptr, DiskUsageVar uint64, NumDirsVar uint64, NumFilesVar uint64) (bool, error) { | 1331 | + | func (x *FileBase) MeasureDiskUsage(FlagsVar FileMeasureFlags, CancellableVar *Cancellable, ProgressCallbackVar *FileMeasureProgressCallback, ProgressDataVar uintptr, DiskUsageVar uint64, NumDirsVar uint64, NumFilesVar uint64) (bool, error) { |
| 1332 | var cerr *glib.Error | 1332 | var cerr *glib.Error | ||
| 1333 | 1333 | ||||
| 1334 | - | cret := XGFileMeasureDiskUsage(x.GoPointer(), FlagsVar, CancellableVar.GoPointer(), purego.NewCallback(ProgressCallbackVar), ProgressDataVar, DiskUsageVar, NumDirsVar, NumFilesVar, &cerr) | 1334 | + | cret := XGFileMeasureDiskUsage(x.GoPointer(), FlagsVar, CancellableVar.GoPointer(), glib.NewCallback(ProgressCallbackVar), ProgressDataVar, DiskUsageVar, NumDirsVar, NumFilesVar, &cerr) |
| 1335 | if cerr == nil { | 1335 | if cerr == nil { | ||
| 1336 | return cret, nil | 1336 | return cret, nil | ||
| 1337 | } | 1337 | } | ||
| @@ -1343,9 +1343,9 @@ func (x *FileBase) MeasureDiskUsage(FlagsVar FileMeasureFlags, CancellableVar *C | |||||
| 1343 | // | 1343 | // | ||
| 1344 | // This is the asynchronous version of g_file_measure_disk_usage(). See | 1344 | // This is the asynchronous version of g_file_measure_disk_usage(). See | ||
| 1345 | // there for more information. | 1345 | // there for more information. | ||
| 1346 | - | func (x *FileBase) MeasureDiskUsageAsync(FlagsVar FileMeasureFlags, IoPriorityVar int, CancellableVar *Cancellable, ProgressCallbackVar FileMeasureProgressCallback, ProgressDataVar uintptr, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 1346 | + | func (x *FileBase) MeasureDiskUsageAsync(FlagsVar FileMeasureFlags, IoPriorityVar int, CancellableVar *Cancellable, ProgressCallbackVar *FileMeasureProgressCallback, ProgressDataVar uintptr, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 1347 | 1347 | ||||
| 1348 | - | XGFileMeasureDiskUsageAsync(x.GoPointer(), FlagsVar, IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(ProgressCallbackVar), ProgressDataVar, purego.NewCallback(CallbackVar), UserDataVar) | 1348 | + | XGFileMeasureDiskUsageAsync(x.GoPointer(), FlagsVar, IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(ProgressCallbackVar), ProgressDataVar, glib.NewCallback(CallbackVar), UserDataVar) |
| 1349 | 1349 | ||||
| 1350 | } | 1350 | } | ||
| 1351 | 1351 | ||||
| @@ -1459,9 +1459,9 @@ func (x *FileBase) MonitorFile(FlagsVar FileMonitorFlags, CancellableVar *Cancel | |||||
| 1459 | // If @cancellable is not %NULL, then the operation can be cancelled by | 1459 | // If @cancellable is not %NULL, then the operation can be cancelled by | ||
| 1460 | // triggering the cancellable object from another thread. If the operation | 1460 | // triggering the cancellable object from another thread. If the operation | ||
| 1461 | // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. | 1461 | // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned. | ||
| 1462 | - | func (x *FileBase) MountEnclosingVolume(FlagsVar MountMountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 1462 | + | func (x *FileBase) MountEnclosingVolume(FlagsVar MountMountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 1463 | 1463 | ||||
| 1464 | - | XGFileMountEnclosingVolume(x.GoPointer(), FlagsVar, MountOperationVar.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 1464 | + | XGFileMountEnclosingVolume(x.GoPointer(), FlagsVar, MountOperationVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 1465 | 1465 | ||||
| 1466 | } | 1466 | } | ||
| 1467 | 1467 | ||||
| @@ -1488,9 +1488,9 @@ func (x *FileBase) MountEnclosingVolumeFinish(ResultVar AsyncResult) (bool, erro | |||||
| 1488 | // When the operation is finished, @callback will be called. | 1488 | // When the operation is finished, @callback will be called. | ||
| 1489 | // You can then call g_file_mount_mountable_finish() to get | 1489 | // You can then call g_file_mount_mountable_finish() to get | ||
| 1490 | // the result of the operation. | 1490 | // the result of the operation. | ||
| 1491 | - | func (x *FileBase) MountMountable(FlagsVar MountMountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 1491 | + | func (x *FileBase) MountMountable(FlagsVar MountMountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 1492 | 1492 | ||||
| 1493 | - | XGFileMountMountable(x.GoPointer(), FlagsVar, MountOperationVar.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 1493 | + | XGFileMountMountable(x.GoPointer(), FlagsVar, MountOperationVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 1494 | 1494 | ||||
| 1495 | } | 1495 | } | ||
| 1496 | 1496 | ||||
| @@ -1549,10 +1549,10 @@ func (x *FileBase) MountMountableFinish(ResultVar AsyncResult) (*FileBase, error | |||||
| 1549 | // %G_FILE_COPY_OVERWRITE is specified and the target is a file, then | 1549 | // %G_FILE_COPY_OVERWRITE is specified and the target is a file, then | ||
| 1550 | // the %G_IO_ERROR_WOULD_RECURSE error may be returned (if the native | 1550 | // the %G_IO_ERROR_WOULD_RECURSE error may be returned (if the native | ||
| 1551 | // move operation isn't available). | 1551 | // move operation isn't available). | ||
| 1552 | - | func (x *FileBase) Move(DestinationVar File, FlagsVar FileCopyFlags, CancellableVar *Cancellable, ProgressCallbackVar FileProgressCallback, ProgressCallbackDataVar uintptr) (bool, error) { | 1552 | + | func (x *FileBase) Move(DestinationVar File, FlagsVar FileCopyFlags, CancellableVar *Cancellable, ProgressCallbackVar *FileProgressCallback, ProgressCallbackDataVar uintptr) (bool, error) { |
| 1553 | var cerr *glib.Error | 1553 | var cerr *glib.Error | ||
| 1554 | 1554 | ||||
| 1555 | - | cret := XGFileMove(x.GoPointer(), DestinationVar.GoPointer(), FlagsVar, CancellableVar.GoPointer(), purego.NewCallback(ProgressCallbackVar), ProgressCallbackDataVar, &cerr) | 1555 | + | cret := XGFileMove(x.GoPointer(), DestinationVar.GoPointer(), FlagsVar, CancellableVar.GoPointer(), glib.NewCallback(ProgressCallbackVar), ProgressCallbackDataVar, &cerr) |
| 1556 | if cerr == nil { | 1556 | if cerr == nil { | ||
| 1557 | return cret, nil | 1557 | return cret, nil | ||
| 1558 | } | 1558 | } | ||
| @@ -1569,9 +1569,9 @@ func (x *FileBase) Move(DestinationVar File, FlagsVar FileCopyFlags, Cancellable | |||||
| 1569 | // | 1569 | // | ||
| 1570 | // When the operation is finished, @callback will be called. You can then call | 1570 | // When the operation is finished, @callback will be called. You can then call | ||
| 1571 | // g_file_move_finish() to get the result of the operation. | 1571 | // g_file_move_finish() to get the result of the operation. | ||
| 1572 | - | func (x *FileBase) MoveAsync(DestinationVar File, FlagsVar FileCopyFlags, IoPriorityVar int, CancellableVar *Cancellable, ProgressCallbackVar FileProgressCallback, ProgressCallbackDataVar uintptr, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 1572 | + | func (x *FileBase) MoveAsync(DestinationVar File, FlagsVar FileCopyFlags, IoPriorityVar int, CancellableVar *Cancellable, ProgressCallbackVar *FileProgressCallback, ProgressCallbackDataVar uintptr, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 1573 | 1573 | ||||
| 1574 | - | XGFileMoveAsync(x.GoPointer(), DestinationVar.GoPointer(), FlagsVar, IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(ProgressCallbackVar), ProgressCallbackDataVar, purego.NewCallback(CallbackVar), UserDataVar) | 1574 | + | XGFileMoveAsync(x.GoPointer(), DestinationVar.GoPointer(), FlagsVar, IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(ProgressCallbackVar), ProgressCallbackDataVar, glib.NewCallback(CallbackVar), UserDataVar) |
| 1575 | 1575 | ||||
| 1576 | } | 1576 | } | ||
| 1577 | 1577 | ||||
| @@ -1630,9 +1630,9 @@ func (x *FileBase) OpenReadwrite(CancellableVar *Cancellable) (*FileIOStream, er | |||||
| 1630 | // When the operation is finished, @callback will be called. | 1630 | // When the operation is finished, @callback will be called. | ||
| 1631 | // You can then call g_file_open_readwrite_finish() to get | 1631 | // You can then call g_file_open_readwrite_finish() to get | ||
| 1632 | // the result of the operation. | 1632 | // the result of the operation. | ||
| 1633 | - | func (x *FileBase) OpenReadwriteAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 1633 | + | func (x *FileBase) OpenReadwriteAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 1634 | 1634 | ||||
| 1635 | - | XGFileOpenReadwriteAsync(x.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 1635 | + | XGFileOpenReadwriteAsync(x.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 1636 | 1636 | ||||
| 1637 | } | 1637 | } | ||
| 1638 | 1638 | ||||
| @@ -1678,9 +1678,9 @@ func (x *FileBase) PeekPath() string { | |||||
| 1678 | // When the operation is finished, @callback will be called. | 1678 | // When the operation is finished, @callback will be called. | ||
| 1679 | // You can then call g_file_mount_mountable_finish() to get | 1679 | // You can then call g_file_mount_mountable_finish() to get | ||
| 1680 | // the result of the operation. | 1680 | // the result of the operation. | ||
| 1681 | - | func (x *FileBase) PollMountable(CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 1681 | + | func (x *FileBase) PollMountable(CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 1682 | 1682 | ||||
| 1683 | - | XGFilePollMountable(x.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 1683 | + | XGFilePollMountable(x.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 1684 | 1684 | ||||
| 1685 | } | 1685 | } | ||
| 1686 | 1686 | ||||
| @@ -1724,9 +1724,9 @@ func (x *FileBase) QueryDefaultHandler(CancellableVar *Cancellable) (*AppInfoBas | |||||
| 1724 | } | 1724 | } | ||
| 1725 | 1725 | ||||
| 1726 | // Async version of g_file_query_default_handler(). | 1726 | // Async version of g_file_query_default_handler(). | ||
| 1727 | - | func (x *FileBase) QueryDefaultHandlerAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 1727 | + | func (x *FileBase) QueryDefaultHandlerAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 1728 | 1728 | ||||
| 1729 | - | XGFileQueryDefaultHandlerAsync(x.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 1729 | + | XGFileQueryDefaultHandlerAsync(x.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 1730 | 1730 | ||||
| 1731 | } | 1731 | } | ||
| 1732 | 1732 | ||||
| @@ -1842,9 +1842,9 @@ func (x *FileBase) QueryFilesystemInfo(AttributesVar string, CancellableVar *Can | |||||
| 1842 | // When the operation is finished, @callback will be called. You can | 1842 | // When the operation is finished, @callback will be called. You can | ||
| 1843 | // then call g_file_query_info_finish() to get the result of the | 1843 | // then call g_file_query_info_finish() to get the result of the | ||
| 1844 | // operation. | 1844 | // operation. | ||
| 1845 | - | func (x *FileBase) QueryFilesystemInfoAsync(AttributesVar string, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 1845 | + | func (x *FileBase) QueryFilesystemInfoAsync(AttributesVar string, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 1846 | 1846 | ||||
| 1847 | - | XGFileQueryFilesystemInfoAsync(x.GoPointer(), AttributesVar, IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 1847 | + | XGFileQueryFilesystemInfoAsync(x.GoPointer(), AttributesVar, IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 1848 | 1848 | ||||
| 1849 | } | 1849 | } | ||
| 1850 | 1850 | ||||
| @@ -1925,9 +1925,9 @@ func (x *FileBase) QueryInfo(AttributesVar string, FlagsVar FileQueryInfoFlags, | |||||
| 1925 | // | 1925 | // | ||
| 1926 | // When the operation is finished, @callback will be called. You can | 1926 | // When the operation is finished, @callback will be called. You can | ||
| 1927 | // then call g_file_query_info_finish() to get the result of the operation. | 1927 | // then call g_file_query_info_finish() to get the result of the operation. | ||
| 1928 | - | func (x *FileBase) QueryInfoAsync(AttributesVar string, FlagsVar FileQueryInfoFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 1928 | + | func (x *FileBase) QueryInfoAsync(AttributesVar string, FlagsVar FileQueryInfoFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 1929 | 1929 | ||||
| 1930 | - | XGFileQueryInfoAsync(x.GoPointer(), AttributesVar, FlagsVar, IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 1930 | + | XGFileQueryInfoAsync(x.GoPointer(), AttributesVar, FlagsVar, IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 1931 | 1931 | ||||
| 1932 | } | 1932 | } | ||
| 1933 | 1933 | ||||
| @@ -2027,9 +2027,9 @@ func (x *FileBase) Read(CancellableVar *Cancellable) (*FileInputStream, error) { | |||||
| 2027 | // When the operation is finished, @callback will be called. | 2027 | // When the operation is finished, @callback will be called. | ||
| 2028 | // You can then call g_file_read_finish() to get the result | 2028 | // You can then call g_file_read_finish() to get the result | ||
| 2029 | // of the operation. | 2029 | // of the operation. | ||
| 2030 | - | func (x *FileBase) ReadAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 2030 | + | func (x *FileBase) ReadAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 2031 | 2031 | ||||
| 2032 | - | XGFileReadAsync(x.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 2032 | + | XGFileReadAsync(x.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 2033 | 2033 | ||||
| 2034 | } | 2034 | } | ||
| 2035 | 2035 | ||||
| @@ -2121,9 +2121,9 @@ func (x *FileBase) Replace(EtagVar string, MakeBackupVar bool, FlagsVar FileCrea | |||||
| 2121 | // When the operation is finished, @callback will be called. | 2121 | // When the operation is finished, @callback will be called. | ||
| 2122 | // You can then call g_file_replace_finish() to get the result | 2122 | // You can then call g_file_replace_finish() to get the result | ||
| 2123 | // of the operation. | 2123 | // of the operation. | ||
| 2124 | - | func (x *FileBase) ReplaceAsync(EtagVar string, MakeBackupVar bool, FlagsVar FileCreateFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 2124 | + | func (x *FileBase) ReplaceAsync(EtagVar string, MakeBackupVar bool, FlagsVar FileCreateFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 2125 | 2125 | ||||
| 2126 | - | XGFileReplaceAsync(x.GoPointer(), EtagVar, MakeBackupVar, FlagsVar, IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 2126 | + | XGFileReplaceAsync(x.GoPointer(), EtagVar, MakeBackupVar, FlagsVar, IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 2127 | 2127 | ||||
| 2128 | } | 2128 | } | ||
| 2129 | 2129 | ||||
| @@ -2173,9 +2173,9 @@ func (x *FileBase) ReplaceContents(ContentsVar string, LengthVar uint, EtagVar s | |||||
| 2173 | // until @callback is called. See g_file_replace_contents_bytes_async() | 2173 | // until @callback is called. See g_file_replace_contents_bytes_async() | ||
| 2174 | // for a #GBytes version that will automatically hold a reference to the | 2174 | // for a #GBytes version that will automatically hold a reference to the | ||
| 2175 | // contents (without copying) for the duration of the call. | 2175 | // contents (without copying) for the duration of the call. | ||
| 2176 | - | func (x *FileBase) ReplaceContentsAsync(ContentsVar string, LengthVar uint, EtagVar string, MakeBackupVar bool, FlagsVar FileCreateFlags, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 2176 | + | func (x *FileBase) ReplaceContentsAsync(ContentsVar string, LengthVar uint, EtagVar string, MakeBackupVar bool, FlagsVar FileCreateFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 2177 | 2177 | ||||
| 2178 | - | XGFileReplaceContentsAsync(x.GoPointer(), ContentsVar, LengthVar, EtagVar, MakeBackupVar, FlagsVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 2178 | + | XGFileReplaceContentsAsync(x.GoPointer(), ContentsVar, LengthVar, EtagVar, MakeBackupVar, FlagsVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 2179 | 2179 | ||||
| 2180 | } | 2180 | } | ||
| 2181 | 2181 | ||||
| @@ -2187,9 +2187,9 @@ func (x *FileBase) ReplaceContentsAsync(ContentsVar string, LengthVar uint, Etag | |||||
| 2187 | // When this operation has completed, @callback will be called with | 2187 | // When this operation has completed, @callback will be called with | ||
| 2188 | // @user_user data, and the operation can be finalized with | 2188 | // @user_user data, and the operation can be finalized with | ||
| 2189 | // g_file_replace_contents_finish(). | 2189 | // g_file_replace_contents_finish(). | ||
| 2190 | - | func (x *FileBase) ReplaceContentsBytesAsync(ContentsVar *glib.Bytes, EtagVar string, MakeBackupVar bool, FlagsVar FileCreateFlags, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 2190 | + | func (x *FileBase) ReplaceContentsBytesAsync(ContentsVar *glib.Bytes, EtagVar string, MakeBackupVar bool, FlagsVar FileCreateFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 2191 | 2191 | ||||
| 2192 | - | XGFileReplaceContentsBytesAsync(x.GoPointer(), ContentsVar, EtagVar, MakeBackupVar, FlagsVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 2192 | + | XGFileReplaceContentsBytesAsync(x.GoPointer(), ContentsVar, EtagVar, MakeBackupVar, FlagsVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 2193 | 2193 | ||||
| 2194 | } | 2194 | } | ||
| 2195 | 2195 | ||||
| @@ -2265,9 +2265,9 @@ func (x *FileBase) ReplaceReadwrite(EtagVar string, MakeBackupVar bool, FlagsVar | |||||
| 2265 | // When the operation is finished, @callback will be called. | 2265 | // When the operation is finished, @callback will be called. | ||
| 2266 | // You can then call g_file_replace_readwrite_finish() to get | 2266 | // You can then call g_file_replace_readwrite_finish() to get | ||
| 2267 | // the result of the operation. | 2267 | // the result of the operation. | ||
| 2268 | - | func (x *FileBase) ReplaceReadwriteAsync(EtagVar string, MakeBackupVar bool, FlagsVar FileCreateFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 2268 | + | func (x *FileBase) ReplaceReadwriteAsync(EtagVar string, MakeBackupVar bool, FlagsVar FileCreateFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 2269 | 2269 | ||||
| 2270 | - | XGFileReplaceReadwriteAsync(x.GoPointer(), EtagVar, MakeBackupVar, FlagsVar, IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 2270 | + | XGFileReplaceReadwriteAsync(x.GoPointer(), EtagVar, MakeBackupVar, FlagsVar, IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 2271 | 2271 | ||||
| 2272 | } | 2272 | } | ||
| 2273 | 2273 | ||||
| @@ -2440,9 +2440,9 @@ func (x *FileBase) SetAttributeUint64(AttributeVar string, ValueVar uint64, Flag | |||||
| 2440 | // When the operation is finished, @callback will be called. | 2440 | // When the operation is finished, @callback will be called. | ||
| 2441 | // You can then call g_file_set_attributes_finish() to get | 2441 | // You can then call g_file_set_attributes_finish() to get | ||
| 2442 | // the result of the operation. | 2442 | // the result of the operation. | ||
| 2443 | - | func (x *FileBase) SetAttributesAsync(InfoVar *FileInfo, FlagsVar FileQueryInfoFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 2443 | + | func (x *FileBase) SetAttributesAsync(InfoVar *FileInfo, FlagsVar FileQueryInfoFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 2444 | 2444 | ||||
| 2445 | - | XGFileSetAttributesAsync(x.GoPointer(), InfoVar.GoPointer(), FlagsVar, IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 2445 | + | XGFileSetAttributesAsync(x.GoPointer(), InfoVar.GoPointer(), FlagsVar, IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 2446 | 2446 | ||||
| 2447 | } | 2447 | } | ||
| 2448 | 2448 | ||||
| @@ -2522,9 +2522,9 @@ func (x *FileBase) SetDisplayName(DisplayNameVar string, CancellableVar *Cancell | |||||
| 2522 | // When the operation is finished, @callback will be called. | 2522 | // When the operation is finished, @callback will be called. | ||
| 2523 | // You can then call g_file_set_display_name_finish() to get | 2523 | // You can then call g_file_set_display_name_finish() to get | ||
| 2524 | // the result of the operation. | 2524 | // the result of the operation. | ||
| 2525 | - | func (x *FileBase) SetDisplayNameAsync(DisplayNameVar string, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 2525 | + | func (x *FileBase) SetDisplayNameAsync(DisplayNameVar string, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 2526 | 2526 | ||||
| 2527 | - | XGFileSetDisplayNameAsync(x.GoPointer(), DisplayNameVar, IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 2527 | + | XGFileSetDisplayNameAsync(x.GoPointer(), DisplayNameVar, IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 2528 | 2528 | ||||
| 2529 | } | 2529 | } | ||
| 2530 | 2530 | ||||
| @@ -2559,9 +2559,9 @@ func (x *FileBase) SetDisplayNameFinish(ResVar AsyncResult) (*FileBase, error) { | |||||
| 2559 | // When the operation is finished, @callback will be called. | 2559 | // When the operation is finished, @callback will be called. | ||
| 2560 | // You can then call g_file_mount_mountable_finish() to get | 2560 | // You can then call g_file_mount_mountable_finish() to get | ||
| 2561 | // the result of the operation. | 2561 | // the result of the operation. | ||
| 2562 | - | func (x *FileBase) StartMountable(FlagsVar DriveStartFlags, StartOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 2562 | + | func (x *FileBase) StartMountable(FlagsVar DriveStartFlags, StartOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 2563 | 2563 | ||||
| 2564 | - | XGFileStartMountable(x.GoPointer(), FlagsVar, StartOperationVar.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 2564 | + | XGFileStartMountable(x.GoPointer(), FlagsVar, StartOperationVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 2565 | 2565 | ||||
| 2566 | } | 2566 | } | ||
| 2567 | 2567 | ||||
| @@ -2589,9 +2589,9 @@ func (x *FileBase) StartMountableFinish(ResultVar AsyncResult) (bool, error) { | |||||
| 2589 | // When the operation is finished, @callback will be called. | 2589 | // When the operation is finished, @callback will be called. | ||
| 2590 | // You can then call g_file_stop_mountable_finish() to get | 2590 | // You can then call g_file_stop_mountable_finish() to get | ||
| 2591 | // the result of the operation. | 2591 | // the result of the operation. | ||
| 2592 | - | func (x *FileBase) StopMountable(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 2592 | + | func (x *FileBase) StopMountable(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 2593 | 2593 | ||||
| 2594 | - | XGFileStopMountable(x.GoPointer(), FlagsVar, MountOperationVar.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 2594 | + | XGFileStopMountable(x.GoPointer(), FlagsVar, MountOperationVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 2595 | 2595 | ||||
| 2596 | } | 2596 | } | ||
| 2597 | 2597 | ||||
| @@ -2642,9 +2642,9 @@ func (x *FileBase) Trash(CancellableVar *Cancellable) (bool, error) { | |||||
| 2642 | } | 2642 | } | ||
| 2643 | 2643 | ||||
| 2644 | // Asynchronously sends @file to the Trash location, if possible. | 2644 | // Asynchronously sends @file to the Trash location, if possible. | ||
| 2645 | - | func (x *FileBase) TrashAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 2645 | + | func (x *FileBase) TrashAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 2646 | 2646 | ||||
| 2647 | - | XGFileTrashAsync(x.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 2647 | + | XGFileTrashAsync(x.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 2648 | 2648 | ||||
| 2649 | } | 2649 | } | ||
| 2650 | 2650 | ||||
| @@ -2670,9 +2670,9 @@ func (x *FileBase) TrashFinish(ResultVar AsyncResult) (bool, error) { | |||||
| 2670 | // When the operation is finished, @callback will be called. | 2670 | // When the operation is finished, @callback will be called. | ||
| 2671 | // You can then call g_file_unmount_mountable_finish() to get | 2671 | // You can then call g_file_unmount_mountable_finish() to get | ||
| 2672 | // the result of the operation. | 2672 | // the result of the operation. | ||
| 2673 | - | func (x *FileBase) UnmountMountable(FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 2673 | + | func (x *FileBase) UnmountMountable(FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 2674 | 2674 | ||||
| 2675 | - | XGFileUnmountMountable(x.GoPointer(), FlagsVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 2675 | + | XGFileUnmountMountable(x.GoPointer(), FlagsVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 2676 | 2676 | ||||
| 2677 | } | 2677 | } | ||
| 2678 | 2678 | ||||
| @@ -2700,9 +2700,9 @@ func (x *FileBase) UnmountMountableFinish(ResultVar AsyncResult) (bool, error) { | |||||
| 2700 | // When the operation is finished, @callback will be called. | 2700 | // When the operation is finished, @callback will be called. | ||
| 2701 | // You can then call g_file_unmount_mountable_finish() to get | 2701 | // You can then call g_file_unmount_mountable_finish() to get | ||
| 2702 | // the result of the operation. | 2702 | // the result of the operation. | ||
| 2703 | - | func (x *FileBase) UnmountMountableWithOperation(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 2703 | + | func (x *FileBase) UnmountMountableWithOperation(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 2704 | 2704 | ||||
| 2705 | - | XGFileUnmountMountableWithOperation(x.GoPointer(), FlagsVar, MountOperationVar.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 2705 | + | XGFileUnmountMountableWithOperation(x.GoPointer(), FlagsVar, MountOperationVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 2706 | 2706 | ||||
| 2707 | } | 2707 | } | ||
| 2708 | 2708 | ||||
M v4/gio/gfileenumerator.go +4 -4
| @@ -88,9 +88,9 @@ var xFileEnumeratorCloseAsync func(uintptr, int, uintptr, uintptr, uintptr) | |||||
| 88 | // triggering the cancellable object from another thread. If the operation | 88 | // triggering the cancellable object from another thread. If the operation | ||
| 89 | // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned in | 89 | // was cancelled, the error %G_IO_ERROR_CANCELLED will be returned in | ||
| 90 | // g_file_enumerator_close_finish(). | 90 | // g_file_enumerator_close_finish(). | ||
| 91 | - | func (x *FileEnumerator) CloseAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 91 | + | func (x *FileEnumerator) CloseAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 92 | 92 | ||||
| 93 | - | xFileEnumeratorCloseAsync(x.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 93 | + | xFileEnumeratorCloseAsync(x.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 94 | 94 | ||||
| 95 | } | 95 | } | ||
| 96 | 96 | ||||
| @@ -288,9 +288,9 @@ var xFileEnumeratorNextFilesAsync func(uintptr, int, int, uintptr, uintptr, uint | |||||
| 288 | // Any outstanding i/o request with higher priority (lower numerical value) will | 288 | // Any outstanding i/o request with higher priority (lower numerical value) will | ||
| 289 | // be executed before an outstanding request with lower priority. Default | 289 | // be executed before an outstanding request with lower priority. Default | ||
| 290 | // priority is %G_PRIORITY_DEFAULT. | 290 | // priority is %G_PRIORITY_DEFAULT. | ||
| 291 | - | func (x *FileEnumerator) NextFilesAsync(NumFilesVar int, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 291 | + | func (x *FileEnumerator) NextFilesAsync(NumFilesVar int, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 292 | 292 | ||||
| 293 | - | xFileEnumeratorNextFilesAsync(x.GoPointer(), NumFilesVar, IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 293 | + | xFileEnumeratorNextFilesAsync(x.GoPointer(), NumFilesVar, IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 294 | 294 | ||||
| 295 | } | 295 | } | ||
| 296 | 296 | ||||
M v4/gio/gfileicon.go +2 -2
| @@ -133,9 +133,9 @@ func (x *FileIcon) Load(SizeVar int, TypeVar string, CancellableVar *Cancellable | |||||
| 133 | // Loads an icon asynchronously. To finish this function, see | 133 | // Loads an icon asynchronously. To finish this function, see | ||
| 134 | // g_loadable_icon_load_finish(). For the synchronous, blocking | 134 | // g_loadable_icon_load_finish(). For the synchronous, blocking | ||
| 135 | // version of this function, see g_loadable_icon_load(). | 135 | // version of this function, see g_loadable_icon_load(). | ||
| 136 | - | func (x *FileIcon) LoadAsync(SizeVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 136 | + | func (x *FileIcon) LoadAsync(SizeVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 137 | 137 | ||||
| 138 | - | XGLoadableIconLoadAsync(x.GoPointer(), SizeVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 138 | + | XGLoadableIconLoadAsync(x.GoPointer(), SizeVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 139 | 139 | ||||
| 140 | } | 140 | } | ||
| 141 | 141 | ||||
M v4/gio/gfileinputstream.go +2 -2
| @@ -81,9 +81,9 @@ var xFileInputStreamQueryInfoAsync func(uintptr, string, int, uintptr, uintptr, | |||||
| 81 | // If @cancellable is not %NULL, then the operation can be cancelled by | 81 | // If @cancellable is not %NULL, then the operation can be cancelled by | ||
| 82 | // triggering the cancellable object from another thread. If the operation | 82 | // triggering the cancellable object from another thread. If the operation | ||
| 83 | // was cancelled, the error %G_IO_ERROR_CANCELLED will be set | 83 | // was cancelled, the error %G_IO_ERROR_CANCELLED will be set | ||
| 84 | - | func (x *FileInputStream) QueryInfoAsync(AttributesVar string, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 84 | + | func (x *FileInputStream) QueryInfoAsync(AttributesVar string, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 85 | 85 | ||||
| 86 | - | xFileInputStreamQueryInfoAsync(x.GoPointer(), AttributesVar, IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 86 | + | xFileInputStreamQueryInfoAsync(x.GoPointer(), AttributesVar, IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 87 | 87 | ||||
| 88 | } | 88 | } | ||
| 89 | 89 | ||||
M v4/gio/gfileiostream.go +2 -2
| @@ -110,9 +110,9 @@ var xFileIOStreamQueryInfoAsync func(uintptr, string, int, uintptr, uintptr, uin | |||||
| 110 | // | 110 | // | ||
| 111 | // For the synchronous version of this function, see | 111 | // For the synchronous version of this function, see | ||
| 112 | // g_file_io_stream_query_info(). | 112 | // g_file_io_stream_query_info(). | ||
| 113 | - | func (x *FileIOStream) QueryInfoAsync(AttributesVar string, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 113 | + | func (x *FileIOStream) QueryInfoAsync(AttributesVar string, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 114 | 114 | ||||
| 115 | - | xFileIOStreamQueryInfoAsync(x.GoPointer(), AttributesVar, IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 115 | + | xFileIOStreamQueryInfoAsync(x.GoPointer(), AttributesVar, IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 116 | 116 | ||||
| 117 | } | 117 | } | ||
| 118 | 118 | ||||
M v4/gio/gfilemonitor.go +12 -3
| @@ -6,6 +6,7 @@ import ( | |||||
| 6 | 6 | ||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 9 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 10 | ) | 11 | ) | ||
| 11 | 12 | ||||
| @@ -127,15 +128,23 @@ func (c *FileMonitor) SetGoPointer(ptr uintptr) { | |||||
| 127 | // old path, and @other_file will be set to a #GFile containing the new path. | 128 | // old path, and @other_file will be set to a #GFile containing the new path. | ||
| 128 | // | 129 | // | ||
| 129 | // In all the other cases, @other_file will be set to #NULL. | 130 | // In all the other cases, @other_file will be set to #NULL. | ||
| 130 | - | func (x *FileMonitor) ConnectChanged(cb func(FileMonitor, uintptr, uintptr, FileMonitorEvent)) uint32 { | 131 | + | func (x *FileMonitor) ConnectChanged(cb *func(FileMonitor, uintptr, uintptr, FileMonitorEvent)) uint32 { |
| 132 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 133 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 134 | + | return gobject.SignalConnect(x.GoPointer(), "changed", cbRefPtr) | |||
| 135 | + | } | |||
| 136 | + | ||||
| 131 | fcb := func(clsPtr uintptr, FileVarp uintptr, OtherFileVarp uintptr, EventTypeVarp FileMonitorEvent) { | 137 | fcb := func(clsPtr uintptr, FileVarp uintptr, OtherFileVarp uintptr, EventTypeVarp FileMonitorEvent) { | ||
| 132 | fa := FileMonitor{} | 138 | fa := FileMonitor{} | ||
| 133 | fa.Ptr = clsPtr | 139 | fa.Ptr = clsPtr | ||
| 140 | + | cbFn := *cb | |||
| 134 | 141 | ||||
| 135 | - | cb(fa, FileVarp, OtherFileVarp, EventTypeVarp) | 142 | + | cbFn(fa, FileVarp, OtherFileVarp, EventTypeVarp) |
| 136 | 143 | ||||
| 137 | } | 144 | } | ||
| 138 | - | return gobject.SignalConnect(x.GoPointer(), "changed", purego.NewCallback(fcb)) | 145 | + | cbRefPtr := purego.NewCallback(fcb) |
| 146 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 147 | + | return gobject.SignalConnect(x.GoPointer(), "changed", cbRefPtr) | |||
| 139 | } | 148 | } | ||
| 140 | 149 | ||||
| 141 | func init() { | 150 | func init() { | ||
M v4/gio/gfilenamecompleter.go +12 -3
| @@ -6,6 +6,7 @@ import ( | |||||
| 6 | 6 | ||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 9 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 10 | ) | 11 | ) | ||
| 11 | 12 | ||||
| @@ -83,15 +84,23 @@ func (c *FilenameCompleter) SetGoPointer(ptr uintptr) { | |||||
| 83 | } | 84 | } | ||
| 84 | 85 | ||||
| 85 | // Emitted when the file name completion information comes available. | 86 | // Emitted when the file name completion information comes available. | ||
| 86 | - | func (x *FilenameCompleter) ConnectGotCompletionData(cb func(FilenameCompleter)) uint32 { | 87 | + | func (x *FilenameCompleter) ConnectGotCompletionData(cb *func(FilenameCompleter)) uint32 { |
| 88 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 89 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 90 | + | return gobject.SignalConnect(x.GoPointer(), "got-completion-data", cbRefPtr) | |||
| 91 | + | } | |||
| 92 | + | ||||
| 87 | fcb := func(clsPtr uintptr) { | 93 | fcb := func(clsPtr uintptr) { | ||
| 88 | fa := FilenameCompleter{} | 94 | fa := FilenameCompleter{} | ||
| 89 | fa.Ptr = clsPtr | 95 | fa.Ptr = clsPtr | ||
| 96 | + | cbFn := *cb | |||
| 90 | 97 | ||||
| 91 | - | cb(fa) | 98 | + | cbFn(fa) |
| 92 | 99 | ||||
| 93 | } | 100 | } | ||
| 94 | - | return gobject.SignalConnect(x.GoPointer(), "got-completion-data", purego.NewCallback(fcb)) | 101 | + | cbRefPtr := purego.NewCallback(fcb) |
| 102 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 103 | + | return gobject.SignalConnect(x.GoPointer(), "got-completion-data", cbRefPtr) | |||
| 95 | } | 104 | } | ||
| 96 | 105 | ||||
| 97 | func init() { | 106 | func init() { | ||
M v4/gio/gfileoutputstream.go +2 -2
| @@ -104,9 +104,9 @@ var xFileOutputStreamQueryInfoAsync func(uintptr, string, int, uintptr, uintptr, | |||||
| 104 | // | 104 | // | ||
| 105 | // For the synchronous version of this function, see | 105 | // For the synchronous version of this function, see | ||
| 106 | // g_file_output_stream_query_info(). | 106 | // g_file_output_stream_query_info(). | ||
| 107 | - | func (x *FileOutputStream) QueryInfoAsync(AttributesVar string, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 107 | + | func (x *FileOutputStream) QueryInfoAsync(AttributesVar string, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 108 | 108 | ||||
| 109 | - | xFileOutputStreamQueryInfoAsync(x.GoPointer(), AttributesVar, IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 109 | + | xFileOutputStreamQueryInfoAsync(x.GoPointer(), AttributesVar, IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 110 | 110 | ||||
| 111 | } | 111 | } | ||
| 112 | 112 | ||||
M v4/gio/ginputstream.go +10 -10
| @@ -103,9 +103,9 @@ var xInputStreamCloseAsync func(uintptr, int, uintptr, uintptr, uintptr) | |||||
| 103 | // The asynchronous methods have a default fallback that uses threads to implement | 103 | // The asynchronous methods have a default fallback that uses threads to implement | ||
| 104 | // asynchronicity, so they are optional for inheriting classes. However, if you | 104 | // asynchronicity, so they are optional for inheriting classes. However, if you | ||
| 105 | // override one you must override all. | 105 | // override one you must override all. | ||
| 106 | - | func (x *InputStream) CloseAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 106 | + | func (x *InputStream) CloseAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 107 | 107 | ||||
| 108 | - | xInputStreamCloseAsync(x.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 108 | + | xInputStreamCloseAsync(x.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 109 | 109 | ||||
| 110 | } | 110 | } | ||
| 111 | 111 | ||||
| @@ -219,9 +219,9 @@ var xInputStreamReadAllAsync func(uintptr, uintptr, uint, int, uintptr, uintptr, | |||||
| 219 | // Any outstanding I/O request with higher priority (lower numerical | 219 | // Any outstanding I/O request with higher priority (lower numerical | ||
| 220 | // value) will be executed before an outstanding request with lower | 220 | // value) will be executed before an outstanding request with lower | ||
| 221 | // priority. Default priority is %G_PRIORITY_DEFAULT. | 221 | // priority. Default priority is %G_PRIORITY_DEFAULT. | ||
| 222 | - | func (x *InputStream) ReadAllAsync(BufferVar uintptr, CountVar uint, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 222 | + | func (x *InputStream) ReadAllAsync(BufferVar uintptr, CountVar uint, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 223 | 223 | ||||
| 224 | - | xInputStreamReadAllAsync(x.GoPointer(), BufferVar, CountVar, IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 224 | + | xInputStreamReadAllAsync(x.GoPointer(), BufferVar, CountVar, IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 225 | 225 | ||||
| 226 | } | 226 | } | ||
| 227 | 227 | ||||
| @@ -272,9 +272,9 @@ var xInputStreamReadAsync func(uintptr, uintptr, uint, int, uintptr, uintptr, ui | |||||
| 272 | // The asynchronous methods have a default fallback that uses threads to implement | 272 | // The asynchronous methods have a default fallback that uses threads to implement | ||
| 273 | // asynchronicity, so they are optional for inheriting classes. However, if you | 273 | // asynchronicity, so they are optional for inheriting classes. However, if you | ||
| 274 | // override one you must override all. | 274 | // override one you must override all. | ||
| 275 | - | func (x *InputStream) ReadAsync(BufferVar uintptr, CountVar uint, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 275 | + | func (x *InputStream) ReadAsync(BufferVar uintptr, CountVar uint, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 276 | 276 | ||||
| 277 | - | xInputStreamReadAsync(x.GoPointer(), BufferVar, CountVar, IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 277 | + | xInputStreamReadAsync(x.GoPointer(), BufferVar, CountVar, IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 278 | 278 | ||||
| 279 | } | 279 | } | ||
| 280 | 280 | ||||
| @@ -336,9 +336,9 @@ var xInputStreamReadBytesAsync func(uintptr, uint, int, uintptr, uintptr, uintpt | |||||
| 336 | // Any outstanding I/O request with higher priority (lower numerical | 336 | // Any outstanding I/O request with higher priority (lower numerical | ||
| 337 | // value) will be executed before an outstanding request with lower | 337 | // value) will be executed before an outstanding request with lower | ||
| 338 | // priority. Default priority is %G_PRIORITY_DEFAULT. | 338 | // priority. Default priority is %G_PRIORITY_DEFAULT. | ||
| 339 | - | func (x *InputStream) ReadBytesAsync(CountVar uint, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 339 | + | func (x *InputStream) ReadBytesAsync(CountVar uint, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 340 | 340 | ||||
| 341 | - | xInputStreamReadBytesAsync(x.GoPointer(), CountVar, IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 341 | + | xInputStreamReadBytesAsync(x.GoPointer(), CountVar, IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 342 | 342 | ||||
| 343 | } | 343 | } | ||
| 344 | 344 | ||||
| @@ -438,9 +438,9 @@ var xInputStreamSkipAsync func(uintptr, uint, int, uintptr, uintptr, uintptr) | |||||
| 438 | // The asynchronous methods have a default fallback that uses threads to | 438 | // The asynchronous methods have a default fallback that uses threads to | ||
| 439 | // implement asynchronicity, so they are optional for inheriting classes. | 439 | // implement asynchronicity, so they are optional for inheriting classes. | ||
| 440 | // However, if you override one, you must override all. | 440 | // However, if you override one, you must override all. | ||
| 441 | - | func (x *InputStream) SkipAsync(CountVar uint, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 441 | + | func (x *InputStream) SkipAsync(CountVar uint, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 442 | 442 | ||||
| 443 | - | xInputStreamSkipAsync(x.GoPointer(), CountVar, IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 443 | + | xInputStreamSkipAsync(x.GoPointer(), CountVar, IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 444 | 444 | ||||
| 445 | } | 445 | } | ||
| 446 | 446 | ||||
M v4/gio/gio-2.0.go +115 -57
| @@ -2,6 +2,8 @@ | |||||
| 2 | package gio | 2 | package gio | ||
| 3 | 3 | ||||
| 4 | import ( | 4 | import ( | ||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 5 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 6 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 7 | "github.com/jwijenbergh/puregotk/v4/glib" | 9 | "github.com/jwijenbergh/puregotk/v4/glib" | ||
| @@ -90,15 +92,23 @@ func (c *AppInfoMonitor) SetGoPointer(ptr uintptr) { | |||||
| 90 | 92 | ||||
| 91 | // Signal emitted when the app info database for changes (ie: newly installed | 93 | // Signal emitted when the app info database for changes (ie: newly installed | ||
| 92 | // or removed applications). | 94 | // or removed applications). | ||
| 93 | - | func (x *AppInfoMonitor) ConnectChanged(cb func(AppInfoMonitor)) uint32 { | 95 | + | func (x *AppInfoMonitor) ConnectChanged(cb *func(AppInfoMonitor)) uint32 { |
| 96 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 97 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 98 | + | return gobject.SignalConnect(x.GoPointer(), "changed", cbRefPtr) | |||
| 99 | + | } | |||
| 100 | + | ||||
| 94 | fcb := func(clsPtr uintptr) { | 101 | fcb := func(clsPtr uintptr) { | ||
| 95 | fa := AppInfoMonitor{} | 102 | fa := AppInfoMonitor{} | ||
| 96 | fa.Ptr = clsPtr | 103 | fa.Ptr = clsPtr | ||
| 104 | + | cbFn := *cb | |||
| 97 | 105 | ||||
| 98 | - | cb(fa) | 106 | + | cbFn(fa) |
| 99 | 107 | ||||
| 100 | } | 108 | } | ||
| 101 | - | return gobject.SignalConnect(x.GoPointer(), "changed", purego.NewCallback(fcb)) | 109 | + | cbRefPtr := purego.NewCallback(fcb) |
| 110 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 111 | + | return gobject.SignalConnect(x.GoPointer(), "changed", cbRefPtr) | |||
| 102 | } | 112 | } | ||
| 103 | 113 | ||||
| 104 | var xAppInfoMonitorGet func() uintptr | 114 | var xAppInfoMonitorGet func() uintptr | ||
| @@ -236,9 +246,9 @@ func (x *BytesIcon) Load(SizeVar int, TypeVar string, CancellableVar *Cancellabl | |||||
| 236 | // Loads an icon asynchronously. To finish this function, see | 246 | // Loads an icon asynchronously. To finish this function, see | ||
| 237 | // g_loadable_icon_load_finish(). For the synchronous, blocking | 247 | // g_loadable_icon_load_finish(). For the synchronous, blocking | ||
| 238 | // version of this function, see g_loadable_icon_load(). | 248 | // version of this function, see g_loadable_icon_load(). | ||
| 239 | - | func (x *BytesIcon) LoadAsync(SizeVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 249 | + | func (x *BytesIcon) LoadAsync(SizeVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 240 | 250 | ||||
| 241 | - | XGLoadableIconLoadAsync(x.GoPointer(), SizeVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 251 | + | XGLoadableIconLoadAsync(x.GoPointer(), SizeVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 242 | 252 | ||||
| 243 | } | 253 | } | ||
| 244 | 254 | ||||
| @@ -692,28 +702,44 @@ func (c *DBusAuthObserver) SetGoPointer(ptr uintptr) { | |||||
| 692 | } | 702 | } | ||
| 693 | 703 | ||||
| 694 | // Emitted to check if @mechanism is allowed to be used. | 704 | // Emitted to check if @mechanism is allowed to be used. | ||
| 695 | - | func (x *DBusAuthObserver) ConnectAllowMechanism(cb func(DBusAuthObserver, string) bool) uint32 { | 705 | + | func (x *DBusAuthObserver) ConnectAllowMechanism(cb *func(DBusAuthObserver, string) bool) uint32 { |
| 706 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 707 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 708 | + | return gobject.SignalConnect(x.GoPointer(), "allow-mechanism", cbRefPtr) | |||
| 709 | + | } | |||
| 710 | + | ||||
| 696 | fcb := func(clsPtr uintptr, MechanismVarp string) bool { | 711 | fcb := func(clsPtr uintptr, MechanismVarp string) bool { | ||
| 697 | fa := DBusAuthObserver{} | 712 | fa := DBusAuthObserver{} | ||
| 698 | fa.Ptr = clsPtr | 713 | fa.Ptr = clsPtr | ||
| 714 | + | cbFn := *cb | |||
| 699 | 715 | ||||
| 700 | - | return cb(fa, MechanismVarp) | 716 | + | return cbFn(fa, MechanismVarp) |
| 701 | 717 | ||||
| 702 | } | 718 | } | ||
| 703 | - | return gobject.SignalConnect(x.GoPointer(), "allow-mechanism", purego.NewCallback(fcb)) | 719 | + | cbRefPtr := purego.NewCallback(fcb) |
| 720 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 721 | + | return gobject.SignalConnect(x.GoPointer(), "allow-mechanism", cbRefPtr) | |||
| 704 | } | 722 | } | ||
| 705 | 723 | ||||
| 706 | // Emitted to check if a peer that is successfully authenticated | 724 | // Emitted to check if a peer that is successfully authenticated | ||
| 707 | // is authorized. | 725 | // is authorized. | ||
| 708 | - | func (x *DBusAuthObserver) ConnectAuthorizeAuthenticatedPeer(cb func(DBusAuthObserver, uintptr, uintptr) bool) uint32 { | 726 | + | func (x *DBusAuthObserver) ConnectAuthorizeAuthenticatedPeer(cb *func(DBusAuthObserver, uintptr, uintptr) bool) uint32 { |
| 727 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 728 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 729 | + | return gobject.SignalConnect(x.GoPointer(), "authorize-authenticated-peer", cbRefPtr) | |||
| 730 | + | } | |||
| 731 | + | ||||
| 709 | fcb := func(clsPtr uintptr, StreamVarp uintptr, CredentialsVarp uintptr) bool { | 732 | fcb := func(clsPtr uintptr, StreamVarp uintptr, CredentialsVarp uintptr) bool { | ||
| 710 | fa := DBusAuthObserver{} | 733 | fa := DBusAuthObserver{} | ||
| 711 | fa.Ptr = clsPtr | 734 | fa.Ptr = clsPtr | ||
| 735 | + | cbFn := *cb | |||
| 712 | 736 | ||||
| 713 | - | return cb(fa, StreamVarp, CredentialsVarp) | 737 | + | return cbFn(fa, StreamVarp, CredentialsVarp) |
| 714 | 738 | ||||
| 715 | } | 739 | } | ||
| 716 | - | return gobject.SignalConnect(x.GoPointer(), "authorize-authenticated-peer", purego.NewCallback(fcb)) | 740 | + | cbRefPtr := purego.NewCallback(fcb) |
| 741 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 742 | + | return gobject.SignalConnect(x.GoPointer(), "authorize-authenticated-peer", cbRefPtr) | |||
| 717 | } | 743 | } | ||
| 718 | 744 | ||||
| 719 | // The #GDBusConnection type is used for D-Bus connections to remote | 745 | // The #GDBusConnection type is used for D-Bus connections to remote | ||
| @@ -918,9 +944,9 @@ var xDBusConnectionAddFilter func(uintptr, uintptr, uintptr, uintptr) uint | |||||
| 918 | // needed. (It is not guaranteed to be called synchronously when the | 944 | // needed. (It is not guaranteed to be called synchronously when the | ||
| 919 | // filter is removed, and may be called after @connection has been | 945 | // filter is removed, and may be called after @connection has been | ||
| 920 | // destroyed.) | 946 | // destroyed.) | ||
| 921 | - | func (x *DBusConnection) AddFilter(FilterFunctionVar DBusMessageFilterFunction, UserDataVar uintptr, UserDataFreeFuncVar glib.DestroyNotify) uint { | 947 | + | func (x *DBusConnection) AddFilter(FilterFunctionVar *DBusMessageFilterFunction, UserDataVar uintptr, UserDataFreeFuncVar *glib.DestroyNotify) uint { |
| 922 | 948 | ||||
| 923 | - | cret := xDBusConnectionAddFilter(x.GoPointer(), purego.NewCallback(FilterFunctionVar), UserDataVar, purego.NewCallback(UserDataFreeFuncVar)) | 949 | + | cret := xDBusConnectionAddFilter(x.GoPointer(), glib.NewCallback(FilterFunctionVar), UserDataVar, glib.NewCallback(UserDataFreeFuncVar)) |
| 924 | return cret | 950 | return cret | ||
| 925 | } | 951 | } | ||
| 926 | 952 | ||||
| @@ -973,9 +999,9 @@ var xDBusConnectionCall func(uintptr, string, string, string, string, *glib.Vari | |||||
| 973 | // | 999 | // | ||
| 974 | // If @callback is %NULL then the D-Bus method call message will be sent with | 1000 | // If @callback is %NULL then the D-Bus method call message will be sent with | ||
| 975 | // the %G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED flag set. | 1001 | // the %G_DBUS_MESSAGE_FLAGS_NO_REPLY_EXPECTED flag set. | ||
| 976 | - | func (x *DBusConnection) Call(BusNameVar string, ObjectPathVar string, InterfaceNameVar string, MethodNameVar string, ParametersVar *glib.Variant, ReplyTypeVar *glib.VariantType, FlagsVar DBusCallFlags, TimeoutMsecVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 1002 | + | func (x *DBusConnection) Call(BusNameVar string, ObjectPathVar string, InterfaceNameVar string, MethodNameVar string, ParametersVar *glib.Variant, ReplyTypeVar *glib.VariantType, FlagsVar DBusCallFlags, TimeoutMsecVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 977 | 1003 | ||||
| 978 | - | xDBusConnectionCall(x.GoPointer(), BusNameVar, ObjectPathVar, InterfaceNameVar, MethodNameVar, ParametersVar, ReplyTypeVar, FlagsVar, TimeoutMsecVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 1004 | + | xDBusConnectionCall(x.GoPointer(), BusNameVar, ObjectPathVar, InterfaceNameVar, MethodNameVar, ParametersVar, ReplyTypeVar, FlagsVar, TimeoutMsecVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 979 | 1005 | ||||
| 980 | } | 1006 | } | ||
| 981 | 1007 | ||||
| @@ -1061,9 +1087,9 @@ var xDBusConnectionCallWithUnixFdList func(uintptr, string, string, string, stri | |||||
| 1061 | // value of type %G_VARIANT_TYPE_HANDLE in the body of the message. | 1087 | // value of type %G_VARIANT_TYPE_HANDLE in the body of the message. | ||
| 1062 | // | 1088 | // | ||
| 1063 | // This method is only available on UNIX. | 1089 | // This method is only available on UNIX. | ||
| 1064 | - | func (x *DBusConnection) CallWithUnixFdList(BusNameVar string, ObjectPathVar string, InterfaceNameVar string, MethodNameVar string, ParametersVar *glib.Variant, ReplyTypeVar *glib.VariantType, FlagsVar DBusCallFlags, TimeoutMsecVar int, FdListVar *UnixFDList, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 1090 | + | func (x *DBusConnection) CallWithUnixFdList(BusNameVar string, ObjectPathVar string, InterfaceNameVar string, MethodNameVar string, ParametersVar *glib.Variant, ReplyTypeVar *glib.VariantType, FlagsVar DBusCallFlags, TimeoutMsecVar int, FdListVar *UnixFDList, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 1065 | 1091 | ||||
| 1066 | - | xDBusConnectionCallWithUnixFdList(x.GoPointer(), BusNameVar, ObjectPathVar, InterfaceNameVar, MethodNameVar, ParametersVar, ReplyTypeVar, FlagsVar, TimeoutMsecVar, FdListVar.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 1092 | + | xDBusConnectionCallWithUnixFdList(x.GoPointer(), BusNameVar, ObjectPathVar, InterfaceNameVar, MethodNameVar, ParametersVar, ReplyTypeVar, FlagsVar, TimeoutMsecVar, FdListVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 1067 | 1093 | ||||
| 1068 | } | 1094 | } | ||
| 1069 | 1095 | ||||
| @@ -1136,9 +1162,9 @@ var xDBusConnectionClose func(uintptr, uintptr, uintptr, uintptr) | |||||
| 1136 | // then call g_dbus_connection_close_finish() to get the result of the | 1162 | // then call g_dbus_connection_close_finish() to get the result of the | ||
| 1137 | // operation. See g_dbus_connection_close_sync() for the synchronous | 1163 | // operation. See g_dbus_connection_close_sync() for the synchronous | ||
| 1138 | // version. | 1164 | // version. | ||
| 1139 | - | func (x *DBusConnection) Close(CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 1165 | + | func (x *DBusConnection) Close(CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 1140 | 1166 | ||||
| 1141 | - | xDBusConnectionClose(x.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 1167 | + | xDBusConnectionClose(x.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 1142 | 1168 | ||||
| 1143 | } | 1169 | } | ||
| 1144 | 1170 | ||||
| @@ -1268,9 +1294,9 @@ var xDBusConnectionFlush func(uintptr, uintptr, uintptr, uintptr) | |||||
| 1268 | // then call g_dbus_connection_flush_finish() to get the result of the | 1294 | // then call g_dbus_connection_flush_finish() to get the result of the | ||
| 1269 | // operation. See g_dbus_connection_flush_sync() for the synchronous | 1295 | // operation. See g_dbus_connection_flush_sync() for the synchronous | ||
| 1270 | // version. | 1296 | // version. | ||
| 1271 | - | func (x *DBusConnection) Flush(CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 1297 | + | func (x *DBusConnection) Flush(CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 1272 | 1298 | ||||
| 1273 | - | xDBusConnectionFlush(x.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 1299 | + | xDBusConnectionFlush(x.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 1274 | 1300 | ||||
| 1275 | } | 1301 | } | ||
| 1276 | 1302 | ||||
| @@ -1463,10 +1489,10 @@ var xDBusConnectionRegisterObject func(uintptr, string, *DBusInterfaceInfo, *DBu | |||||
| 1463 | // as the object is exported. Also note that @vtable will be copied. | 1489 | // as the object is exported. Also note that @vtable will be copied. | ||
| 1464 | // | 1490 | // | ||
| 1465 | // See this [server][gdbus-server] for an example of how to use this method. | 1491 | // See this [server][gdbus-server] for an example of how to use this method. | ||
| 1466 | - | func (x *DBusConnection) RegisterObject(ObjectPathVar string, InterfaceInfoVar *DBusInterfaceInfo, VtableVar *DBusInterfaceVTable, UserDataVar uintptr, UserDataFreeFuncVar glib.DestroyNotify) (uint, error) { | 1492 | + | func (x *DBusConnection) RegisterObject(ObjectPathVar string, InterfaceInfoVar *DBusInterfaceInfo, VtableVar *DBusInterfaceVTable, UserDataVar uintptr, UserDataFreeFuncVar *glib.DestroyNotify) (uint, error) { |
| 1467 | var cerr *glib.Error | 1493 | var cerr *glib.Error | ||
| 1468 | 1494 | ||||
| 1469 | - | cret := xDBusConnectionRegisterObject(x.GoPointer(), ObjectPathVar, InterfaceInfoVar, VtableVar, UserDataVar, purego.NewCallback(UserDataFreeFuncVar), &cerr) | 1495 | + | cret := xDBusConnectionRegisterObject(x.GoPointer(), ObjectPathVar, InterfaceInfoVar, VtableVar, UserDataVar, glib.NewCallback(UserDataFreeFuncVar), &cerr) |
| 1470 | if cerr == nil { | 1496 | if cerr == nil { | ||
| 1471 | return cret, nil | 1497 | return cret, nil | ||
| 1472 | } | 1498 | } | ||
| @@ -1525,10 +1551,10 @@ var xDBusConnectionRegisterSubtree func(uintptr, string, *DBusSubtreeVTable, DBu | |||||
| 1525 | // | 1551 | // | ||
| 1526 | // See this [server][gdbus-subtree-server] for an example of how to use | 1552 | // See this [server][gdbus-subtree-server] for an example of how to use | ||
| 1527 | // this method. | 1553 | // this method. | ||
| 1528 | - | func (x *DBusConnection) RegisterSubtree(ObjectPathVar string, VtableVar *DBusSubtreeVTable, FlagsVar DBusSubtreeFlags, UserDataVar uintptr, UserDataFreeFuncVar glib.DestroyNotify) (uint, error) { | 1554 | + | func (x *DBusConnection) RegisterSubtree(ObjectPathVar string, VtableVar *DBusSubtreeVTable, FlagsVar DBusSubtreeFlags, UserDataVar uintptr, UserDataFreeFuncVar *glib.DestroyNotify) (uint, error) { |
| 1529 | var cerr *glib.Error | 1555 | var cerr *glib.Error | ||
| 1530 | 1556 | ||||
| 1531 | - | cret := xDBusConnectionRegisterSubtree(x.GoPointer(), ObjectPathVar, VtableVar, FlagsVar, UserDataVar, purego.NewCallback(UserDataFreeFuncVar), &cerr) | 1557 | + | cret := xDBusConnectionRegisterSubtree(x.GoPointer(), ObjectPathVar, VtableVar, FlagsVar, UserDataVar, glib.NewCallback(UserDataFreeFuncVar), &cerr) |
| 1532 | if cerr == nil { | 1558 | if cerr == nil { | ||
| 1533 | return cret, nil | 1559 | return cret, nil | ||
| 1534 | } | 1560 | } | ||
| @@ -1617,9 +1643,9 @@ var xDBusConnectionSendMessageWithReply func(uintptr, uintptr, DBusSendMessageFl | |||||
| 1617 | // See this [server][gdbus-server] and [client][gdbus-unix-fd-client] | 1643 | // See this [server][gdbus-server] and [client][gdbus-unix-fd-client] | ||
| 1618 | // for an example of how to use this low-level API to send and receive | 1644 | // for an example of how to use this low-level API to send and receive | ||
| 1619 | // UNIX file descriptors. | 1645 | // UNIX file descriptors. | ||
| 1620 | - | func (x *DBusConnection) SendMessageWithReply(MessageVar *DBusMessage, FlagsVar DBusSendMessageFlags, TimeoutMsecVar int, OutSerialVar uint32, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 1646 | + | func (x *DBusConnection) SendMessageWithReply(MessageVar *DBusMessage, FlagsVar DBusSendMessageFlags, TimeoutMsecVar int, OutSerialVar uint32, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 1621 | 1647 | ||||
| 1622 | - | xDBusConnectionSendMessageWithReply(x.GoPointer(), MessageVar.GoPointer(), FlagsVar, TimeoutMsecVar, OutSerialVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 1648 | + | xDBusConnectionSendMessageWithReply(x.GoPointer(), MessageVar.GoPointer(), FlagsVar, TimeoutMsecVar, OutSerialVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 1623 | 1649 | ||||
| 1624 | } | 1650 | } | ||
| 1625 | 1651 | ||||
| @@ -1772,9 +1798,9 @@ var xDBusConnectionSignalSubscribe func(uintptr, string, string, string, string, | |||||
| 1772 | // to never be zero. | 1798 | // to never be zero. | ||
| 1773 | // | 1799 | // | ||
| 1774 | // This function can never fail. | 1800 | // This function can never fail. | ||
| 1775 | - | func (x *DBusConnection) SignalSubscribe(SenderVar string, InterfaceNameVar string, MemberVar string, ObjectPathVar string, Arg0Var string, FlagsVar DBusSignalFlags, CallbackVar DBusSignalCallback, UserDataVar uintptr, UserDataFreeFuncVar glib.DestroyNotify) uint { | 1801 | + | func (x *DBusConnection) SignalSubscribe(SenderVar string, InterfaceNameVar string, MemberVar string, ObjectPathVar string, Arg0Var string, FlagsVar DBusSignalFlags, CallbackVar *DBusSignalCallback, UserDataVar uintptr, UserDataFreeFuncVar *glib.DestroyNotify) uint { |
| 1776 | 1802 | ||||
| 1777 | - | cret := xDBusConnectionSignalSubscribe(x.GoPointer(), SenderVar, InterfaceNameVar, MemberVar, ObjectPathVar, Arg0Var, FlagsVar, purego.NewCallback(CallbackVar), UserDataVar, purego.NewCallback(UserDataFreeFuncVar)) | 1803 | + | cret := xDBusConnectionSignalSubscribe(x.GoPointer(), SenderVar, InterfaceNameVar, MemberVar, ObjectPathVar, Arg0Var, FlagsVar, glib.NewCallback(CallbackVar), UserDataVar, glib.NewCallback(UserDataFreeFuncVar)) |
| 1778 | return cret | 1804 | return cret | ||
| 1779 | } | 1805 | } | ||
| 1780 | 1806 | ||||
| @@ -1880,15 +1906,23 @@ func (c *DBusConnection) SetGoPointer(ptr uintptr) { | |||||
| 1880 | // Upon receiving this signal, you should give up your reference to | 1906 | // Upon receiving this signal, you should give up your reference to | ||
| 1881 | // @connection. You are guaranteed that this signal is emitted only | 1907 | // @connection. You are guaranteed that this signal is emitted only | ||
| 1882 | // once. | 1908 | // once. | ||
| 1883 | - | func (x *DBusConnection) ConnectClosed(cb func(DBusConnection, bool, uintptr)) uint32 { | 1909 | + | func (x *DBusConnection) ConnectClosed(cb *func(DBusConnection, bool, uintptr)) uint32 { |
| 1910 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1911 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1912 | + | return gobject.SignalConnect(x.GoPointer(), "closed", cbRefPtr) | |||
| 1913 | + | } | |||
| 1914 | + | ||||
| 1884 | fcb := func(clsPtr uintptr, RemotePeerVanishedVarp bool, ErrorVarp uintptr) { | 1915 | fcb := func(clsPtr uintptr, RemotePeerVanishedVarp bool, ErrorVarp uintptr) { | ||
| 1885 | fa := DBusConnection{} | 1916 | fa := DBusConnection{} | ||
| 1886 | fa.Ptr = clsPtr | 1917 | fa.Ptr = clsPtr | ||
| 1918 | + | cbFn := *cb | |||
| 1887 | 1919 | ||||
| 1888 | - | cb(fa, RemotePeerVanishedVarp, ErrorVarp) | 1920 | + | cbFn(fa, RemotePeerVanishedVarp, ErrorVarp) |
| 1889 | 1921 | ||||
| 1890 | } | 1922 | } | ||
| 1891 | - | return gobject.SignalConnect(x.GoPointer(), "closed", purego.NewCallback(fcb)) | 1923 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1924 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1925 | + | return gobject.SignalConnect(x.GoPointer(), "closed", cbRefPtr) | |||
| 1892 | } | 1926 | } | ||
| 1893 | 1927 | ||||
| 1894 | // Starts asynchronous initialization of the object implementing the | 1928 | // Starts asynchronous initialization of the object implementing the | ||
| @@ -1927,9 +1961,9 @@ func (x *DBusConnection) ConnectClosed(cb func(DBusConnection, bool, uintptr)) u | |||||
| 1927 | // in a thread, so if you want to support asynchronous initialization via | 1961 | // in a thread, so if you want to support asynchronous initialization via | ||
| 1928 | // threads, just implement the #GAsyncInitable interface without overriding | 1962 | // threads, just implement the #GAsyncInitable interface without overriding | ||
| 1929 | // any interface methods. | 1963 | // any interface methods. | ||
| 1930 | - | func (x *DBusConnection) InitAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 1964 | + | func (x *DBusConnection) InitAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 1931 | 1965 | ||||
| 1932 | - | XGAsyncInitableInitAsync(x.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 1966 | + | XGAsyncInitableInitAsync(x.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 1933 | 1967 | ||||
| 1934 | } | 1968 | } | ||
| 1935 | 1969 | ||||
| @@ -2037,9 +2071,9 @@ var xDBusConnectionNew func(uintptr, string, DBusConnectionFlags, uintptr, uintp | |||||
| 2037 | // This is an asynchronous failable constructor. See | 2071 | // This is an asynchronous failable constructor. See | ||
| 2038 | // g_dbus_connection_new_sync() for the synchronous | 2072 | // g_dbus_connection_new_sync() for the synchronous | ||
| 2039 | // version. | 2073 | // version. | ||
| 2040 | - | func DBusConnectionNew(StreamVar *IOStream, GuidVar string, FlagsVar DBusConnectionFlags, ObserverVar *DBusAuthObserver, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 2074 | + | func DBusConnectionNew(StreamVar *IOStream, GuidVar string, FlagsVar DBusConnectionFlags, ObserverVar *DBusAuthObserver, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 2041 | 2075 | ||||
| 2042 | - | xDBusConnectionNew(StreamVar.GoPointer(), GuidVar, FlagsVar, ObserverVar.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 2076 | + | xDBusConnectionNew(StreamVar.GoPointer(), GuidVar, FlagsVar, ObserverVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 2043 | 2077 | ||||
| 2044 | } | 2078 | } | ||
| 2045 | 2079 | ||||
| @@ -2067,9 +2101,9 @@ var xDBusConnectionNewForAddress func(string, DBusConnectionFlags, uintptr, uint | |||||
| 2067 | // This is an asynchronous failable constructor. See | 2101 | // This is an asynchronous failable constructor. See | ||
| 2068 | // g_dbus_connection_new_for_address_sync() for the synchronous | 2102 | // g_dbus_connection_new_for_address_sync() for the synchronous | ||
| 2069 | // version. | 2103 | // version. | ||
| 2070 | - | func DBusConnectionNewForAddress(AddressVar string, FlagsVar DBusConnectionFlags, ObserverVar *DBusAuthObserver, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 2104 | + | func DBusConnectionNewForAddress(AddressVar string, FlagsVar DBusConnectionFlags, ObserverVar *DBusAuthObserver, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 2071 | 2105 | ||||
| 2072 | - | xDBusConnectionNewForAddress(AddressVar, FlagsVar, ObserverVar.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 2106 | + | xDBusConnectionNewForAddress(AddressVar, FlagsVar, ObserverVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 2073 | 2107 | ||||
| 2074 | } | 2108 | } | ||
| 2075 | 2109 | ||||
| @@ -3230,15 +3264,23 @@ func (c *DBusServer) SetGoPointer(ptr uintptr) { | |||||
| 3230 | // before incoming messages on @connection are processed. This means | 3264 | // before incoming messages on @connection are processed. This means | ||
| 3231 | // that it's suitable to call g_dbus_connection_register_object() or | 3265 | // that it's suitable to call g_dbus_connection_register_object() or | ||
| 3232 | // similar from the signal handler. | 3266 | // similar from the signal handler. | ||
| 3233 | - | func (x *DBusServer) ConnectNewConnection(cb func(DBusServer, uintptr) bool) uint32 { | 3267 | + | func (x *DBusServer) ConnectNewConnection(cb *func(DBusServer, uintptr) bool) uint32 { |
| 3268 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 3269 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 3270 | + | return gobject.SignalConnect(x.GoPointer(), "new-connection", cbRefPtr) | |||
| 3271 | + | } | |||
| 3272 | + | ||||
| 3234 | fcb := func(clsPtr uintptr, ConnectionVarp uintptr) bool { | 3273 | fcb := func(clsPtr uintptr, ConnectionVarp uintptr) bool { | ||
| 3235 | fa := DBusServer{} | 3274 | fa := DBusServer{} | ||
| 3236 | fa.Ptr = clsPtr | 3275 | fa.Ptr = clsPtr | ||
| 3276 | + | cbFn := *cb | |||
| 3237 | 3277 | ||||
| 3238 | - | return cb(fa, ConnectionVarp) | 3278 | + | return cbFn(fa, ConnectionVarp) |
| 3239 | 3279 | ||||
| 3240 | } | 3280 | } | ||
| 3241 | - | return gobject.SignalConnect(x.GoPointer(), "new-connection", purego.NewCallback(fcb)) | 3281 | + | cbRefPtr := purego.NewCallback(fcb) |
| 3282 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 3283 | + | return gobject.SignalConnect(x.GoPointer(), "new-connection", cbRefPtr) | |||
| 3242 | } | 3284 | } | ||
| 3243 | 3285 | ||||
| 3244 | // Initializes the object implementing the interface. | 3286 | // Initializes the object implementing the interface. | ||
| @@ -4525,15 +4567,23 @@ func (c *SimpleAction) SetGoPointer(ptr uintptr) { | |||||
| 4525 | // type, the default is to forward them directly to | 4567 | // type, the default is to forward them directly to | ||
| 4526 | // #GSimpleAction::change-state. This should allow almost all users | 4568 | // #GSimpleAction::change-state. This should allow almost all users | ||
| 4527 | // of #GSimpleAction to connect only one handler or the other. | 4569 | // of #GSimpleAction to connect only one handler or the other. | ||
| 4528 | - | func (x *SimpleAction) ConnectActivate(cb func(SimpleAction, uintptr)) uint32 { | 4570 | + | func (x *SimpleAction) ConnectActivate(cb *func(SimpleAction, uintptr)) uint32 { |
| 4571 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 4572 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 4573 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 4574 | + | } | |||
| 4575 | + | ||||
| 4529 | fcb := func(clsPtr uintptr, ParameterVarp uintptr) { | 4576 | fcb := func(clsPtr uintptr, ParameterVarp uintptr) { | ||
| 4530 | fa := SimpleAction{} | 4577 | fa := SimpleAction{} | ||
| 4531 | fa.Ptr = clsPtr | 4578 | fa.Ptr = clsPtr | ||
| 4579 | + | cbFn := *cb | |||
| 4532 | 4580 | ||||
| 4533 | - | cb(fa, ParameterVarp) | 4581 | + | cbFn(fa, ParameterVarp) |
| 4534 | 4582 | ||||
| 4535 | } | 4583 | } | ||
| 4536 | - | return gobject.SignalConnect(x.GoPointer(), "activate", purego.NewCallback(fcb)) | 4584 | + | cbRefPtr := purego.NewCallback(fcb) |
| 4585 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 4586 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 4537 | } | 4587 | } | ||
| 4538 | 4588 | ||||
| 4539 | // Indicates that the action just received a request to change its | 4589 | // Indicates that the action just received a request to change its | ||
| @@ -4572,15 +4622,23 @@ func (x *SimpleAction) ConnectActivate(cb func(SimpleAction, uintptr)) uint32 { | |||||
| 4572 | // | 4622 | // | ||
| 4573 | // The handler need not set the state to the requested value. | 4623 | // The handler need not set the state to the requested value. | ||
| 4574 | // It could set it to any value at all, or take some other action. | 4624 | // It could set it to any value at all, or take some other action. | ||
| 4575 | - | func (x *SimpleAction) ConnectChangeState(cb func(SimpleAction, uintptr)) uint32 { | 4625 | + | func (x *SimpleAction) ConnectChangeState(cb *func(SimpleAction, uintptr)) uint32 { |
| 4626 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 4627 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 4628 | + | return gobject.SignalConnect(x.GoPointer(), "change-state", cbRefPtr) | |||
| 4629 | + | } | |||
| 4630 | + | ||||
| 4576 | fcb := func(clsPtr uintptr, ValueVarp uintptr) { | 4631 | fcb := func(clsPtr uintptr, ValueVarp uintptr) { | ||
| 4577 | fa := SimpleAction{} | 4632 | fa := SimpleAction{} | ||
| 4578 | fa.Ptr = clsPtr | 4633 | fa.Ptr = clsPtr | ||
| 4634 | + | cbFn := *cb | |||
| 4579 | 4635 | ||||
| 4580 | - | cb(fa, ValueVarp) | 4636 | + | cbFn(fa, ValueVarp) |
| 4581 | 4637 | ||||
| 4582 | } | 4638 | } | ||
| 4583 | - | return gobject.SignalConnect(x.GoPointer(), "change-state", purego.NewCallback(fcb)) | 4639 | + | cbRefPtr := purego.NewCallback(fcb) |
| 4640 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 4641 | + | return gobject.SignalConnect(x.GoPointer(), "change-state", cbRefPtr) | |||
| 4584 | } | 4642 | } | ||
| 4585 | 4643 | ||||
| 4586 | // Activates the action. | 4644 | // Activates the action. | ||
| @@ -4952,9 +5010,9 @@ var xSubprocessCommunicateAsync func(uintptr, *glib.Bytes, uintptr, uintptr, uin | |||||
| 4952 | 5010 | ||||
| 4953 | // Asynchronous version of g_subprocess_communicate(). Complete | 5011 | // Asynchronous version of g_subprocess_communicate(). Complete | ||
| 4954 | // invocation with g_subprocess_communicate_finish(). | 5012 | // invocation with g_subprocess_communicate_finish(). | ||
| 4955 | - | func (x *Subprocess) CommunicateAsync(StdinBufVar *glib.Bytes, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 5013 | + | func (x *Subprocess) CommunicateAsync(StdinBufVar *glib.Bytes, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 4956 | 5014 | ||||
| 4957 | - | xSubprocessCommunicateAsync(x.GoPointer(), StdinBufVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 5015 | + | xSubprocessCommunicateAsync(x.GoPointer(), StdinBufVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 4958 | 5016 | ||||
| 4959 | } | 5017 | } | ||
| 4960 | 5018 | ||||
| @@ -4994,9 +5052,9 @@ var xSubprocessCommunicateUtf8Async func(uintptr, string, uintptr, uintptr, uint | |||||
| 4994 | 5052 | ||||
| 4995 | // Asynchronous version of g_subprocess_communicate_utf8(). Complete | 5053 | // Asynchronous version of g_subprocess_communicate_utf8(). Complete | ||
| 4996 | // invocation with g_subprocess_communicate_utf8_finish(). | 5054 | // invocation with g_subprocess_communicate_utf8_finish(). | ||
| 4997 | - | func (x *Subprocess) CommunicateUtf8Async(StdinBufVar string, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 5055 | + | func (x *Subprocess) CommunicateUtf8Async(StdinBufVar string, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 4998 | 5056 | ||||
| 4999 | - | xSubprocessCommunicateUtf8Async(x.GoPointer(), StdinBufVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 5057 | + | xSubprocessCommunicateUtf8Async(x.GoPointer(), StdinBufVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 5000 | 5058 | ||||
| 5001 | } | 5059 | } | ||
| 5002 | 5060 | ||||
| @@ -5240,9 +5298,9 @@ var xSubprocessWaitAsync func(uintptr, uintptr, uintptr, uintptr) | |||||
| 5240 | // Wait for the subprocess to terminate. | 5298 | // Wait for the subprocess to terminate. | ||
| 5241 | // | 5299 | // | ||
| 5242 | // This is the asynchronous version of g_subprocess_wait(). | 5300 | // This is the asynchronous version of g_subprocess_wait(). | ||
| 5243 | - | func (x *Subprocess) WaitAsync(CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 5301 | + | func (x *Subprocess) WaitAsync(CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 5244 | 5302 | ||||
| 5245 | - | xSubprocessWaitAsync(x.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 5303 | + | xSubprocessWaitAsync(x.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 5246 | 5304 | ||||
| 5247 | } | 5305 | } | ||
| 5248 | 5306 | ||||
| @@ -5265,9 +5323,9 @@ var xSubprocessWaitCheckAsync func(uintptr, uintptr, uintptr, uintptr) | |||||
| 5265 | // Combines g_subprocess_wait_async() with g_spawn_check_wait_status(). | 5323 | // Combines g_subprocess_wait_async() with g_spawn_check_wait_status(). | ||
| 5266 | // | 5324 | // | ||
| 5267 | // This is the asynchronous version of g_subprocess_wait_check(). | 5325 | // This is the asynchronous version of g_subprocess_wait_check(). | ||
| 5268 | - | func (x *Subprocess) WaitCheckAsync(CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 5326 | + | func (x *Subprocess) WaitCheckAsync(CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 5269 | 5327 | ||||
| 5270 | - | xSubprocessWaitCheckAsync(x.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 5328 | + | xSubprocessWaitCheckAsync(x.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 5271 | 5329 | ||||
| 5272 | } | 5330 | } | ||
| 5273 | 5331 | ||||
| @@ -5442,9 +5500,9 @@ var xSubprocessLauncherSetChildSetup func(uintptr, uintptr, uintptr, uintptr) | |||||
| 5442 | // %NULL can be given as @child_setup to disable the functionality. | 5500 | // %NULL can be given as @child_setup to disable the functionality. | ||
| 5443 | // | 5501 | // | ||
| 5444 | // Child setup functions are only available on UNIX. | 5502 | // Child setup functions are only available on UNIX. | ||
| 5445 | - | func (x *SubprocessLauncher) SetChildSetup(ChildSetupVar glib.SpawnChildSetupFunc, UserDataVar uintptr, DestroyNotifyVar glib.DestroyNotify) { | 5503 | + | func (x *SubprocessLauncher) SetChildSetup(ChildSetupVar *glib.SpawnChildSetupFunc, UserDataVar uintptr, DestroyNotifyVar *glib.DestroyNotify) { |
| 5446 | 5504 | ||||
| 5447 | - | xSubprocessLauncherSetChildSetup(x.GoPointer(), purego.NewCallback(ChildSetupVar), UserDataVar, purego.NewCallback(DestroyNotifyVar)) | 5505 | + | xSubprocessLauncherSetChildSetup(x.GoPointer(), glib.NewCallback(ChildSetupVar), UserDataVar, glib.NewCallback(DestroyNotifyVar)) |
| 5448 | 5506 | ||||
| 5449 | } | 5507 | } | ||
| 5450 | 5508 | ||||
M v4/gio/gioscheduler.go +2 -2
| @@ -29,9 +29,9 @@ var xIoSchedulerPushJob func(uintptr, uintptr, uintptr, int, uintptr) | |||||
| 29 | // If @cancellable is not %NULL, it can be used to cancel the I/O job | 29 | // If @cancellable is not %NULL, it can be used to cancel the I/O job | ||
| 30 | // by calling g_cancellable_cancel() or by calling | 30 | // by calling g_cancellable_cancel() or by calling | ||
| 31 | // g_io_scheduler_cancel_all_jobs(). | 31 | // g_io_scheduler_cancel_all_jobs(). | ||
| 32 | - | func IoSchedulerPushJob(JobFuncVar IOSchedulerJobFunc, UserDataVar uintptr, NotifyVar glib.DestroyNotify, IoPriorityVar int, CancellableVar *Cancellable) { | 32 | + | func IoSchedulerPushJob(JobFuncVar *IOSchedulerJobFunc, UserDataVar uintptr, NotifyVar *glib.DestroyNotify, IoPriorityVar int, CancellableVar *Cancellable) { |
| 33 | 33 | ||||
| 34 | - | xIoSchedulerPushJob(purego.NewCallback(JobFuncVar), UserDataVar, purego.NewCallback(NotifyVar), IoPriorityVar, CancellableVar.GoPointer()) | 34 | + | xIoSchedulerPushJob(glib.NewCallback(JobFuncVar), UserDataVar, glib.NewCallback(NotifyVar), IoPriorityVar, CancellableVar.GoPointer()) |
| 35 | 35 | ||||
| 36 | } | 36 | } | ||
| 37 | 37 | ||||
M v4/gio/giostream.go +4 -4
| @@ -148,9 +148,9 @@ var xIOStreamCloseAsync func(uintptr, int, uintptr, uintptr, uintptr) | |||||
| 148 | // The asynchronous methods have a default fallback that uses threads | 148 | // The asynchronous methods have a default fallback that uses threads | ||
| 149 | // to implement asynchronicity, so they are optional for inheriting | 149 | // to implement asynchronicity, so they are optional for inheriting | ||
| 150 | // classes. However, if you override one you must override all. | 150 | // classes. However, if you override one you must override all. | ||
| 151 | - | func (x *IOStream) CloseAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 151 | + | func (x *IOStream) CloseAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 152 | 152 | ||||
| 153 | - | xIOStreamCloseAsync(x.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 153 | + | xIOStreamCloseAsync(x.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 154 | 154 | ||||
| 155 | } | 155 | } | ||
| 156 | 156 | ||||
| @@ -247,9 +247,9 @@ var xIOStreamSpliceAsync func(uintptr, uintptr, IOStreamSpliceFlags, int, uintpt | |||||
| 247 | // When the operation is finished @callback will be called. | 247 | // When the operation is finished @callback will be called. | ||
| 248 | // You can then call g_io_stream_splice_finish() to get the | 248 | // You can then call g_io_stream_splice_finish() to get the | ||
| 249 | // result of the operation. | 249 | // result of the operation. | ||
| 250 | - | func (x *IOStream) SpliceAsync(Stream2Var *IOStream, FlagsVar IOStreamSpliceFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 250 | + | func (x *IOStream) SpliceAsync(Stream2Var *IOStream, FlagsVar IOStreamSpliceFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 251 | 251 | ||||
| 252 | - | xIOStreamSpliceAsync(x.GoPointer(), Stream2Var.GoPointer(), FlagsVar, IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 252 | + | xIOStreamSpliceAsync(x.GoPointer(), Stream2Var.GoPointer(), FlagsVar, IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 253 | 253 | ||||
| 254 | } | 254 | } | ||
| 255 | 255 | ||||
M v4/gio/giotypes.go +4 -4
| @@ -335,9 +335,9 @@ var xIOSchedulerJobSendToMainloop func(uintptr, uintptr, uintptr, uintptr) bool | |||||
| 335 | // Used from an I/O job to send a callback to be run in the thread | 335 | // Used from an I/O job to send a callback to be run in the thread | ||
| 336 | // that the job was started from, waiting for the result (and thus | 336 | // that the job was started from, waiting for the result (and thus | ||
| 337 | // blocking the I/O job). | 337 | // blocking the I/O job). | ||
| 338 | - | func (x *IOSchedulerJob) SendToMainloop(FuncVar glib.SourceFunc, UserDataVar uintptr, NotifyVar glib.DestroyNotify) bool { | 338 | + | func (x *IOSchedulerJob) SendToMainloop(FuncVar *glib.SourceFunc, UserDataVar uintptr, NotifyVar *glib.DestroyNotify) bool { |
| 339 | 339 | ||||
| 340 | - | cret := xIOSchedulerJobSendToMainloop(x.GoPointer(), purego.NewCallback(FuncVar), UserDataVar, purego.NewCallback(NotifyVar)) | 340 | + | cret := xIOSchedulerJobSendToMainloop(x.GoPointer(), glib.NewCallback(FuncVar), UserDataVar, glib.NewCallback(NotifyVar)) |
| 341 | return cret | 341 | return cret | ||
| 342 | } | 342 | } | ||
| 343 | 343 | ||||
| @@ -352,9 +352,9 @@ var xIOSchedulerJobSendToMainloopAsync func(uintptr, uintptr, uintptr, uintptr) | |||||
| 352 | // on to this function you have to ensure that it is not freed before | 352 | // on to this function you have to ensure that it is not freed before | ||
| 353 | // @func is called, either by passing %NULL as @notify to | 353 | // @func is called, either by passing %NULL as @notify to | ||
| 354 | // g_io_scheduler_push_job() or by using refcounting for @user_data. | 354 | // g_io_scheduler_push_job() or by using refcounting for @user_data. | ||
| 355 | - | func (x *IOSchedulerJob) SendToMainloopAsync(FuncVar glib.SourceFunc, UserDataVar uintptr, NotifyVar glib.DestroyNotify) { | 355 | + | func (x *IOSchedulerJob) SendToMainloopAsync(FuncVar *glib.SourceFunc, UserDataVar uintptr, NotifyVar *glib.DestroyNotify) { |
| 356 | 356 | ||||
| 357 | - | xIOSchedulerJobSendToMainloopAsync(x.GoPointer(), purego.NewCallback(FuncVar), UserDataVar, purego.NewCallback(NotifyVar)) | 357 | + | xIOSchedulerJobSendToMainloopAsync(x.GoPointer(), glib.NewCallback(FuncVar), UserDataVar, glib.NewCallback(NotifyVar)) |
| 358 | 358 | ||||
| 359 | } | 359 | } | ||
| 360 | 360 | ||||
M v4/gio/gliststore.go +6 -6
| @@ -84,9 +84,9 @@ var xListStoreFindWithEqualFunc func(uintptr, uintptr, uintptr, uint) bool | |||||
| 84 | // comparing them with @compare_func until the first occurrence of @item which | 84 | // comparing them with @compare_func until the first occurrence of @item which | ||
| 85 | // matches. If @item was not found, then @position will not be set, and this | 85 | // matches. If @item was not found, then @position will not be set, and this | ||
| 86 | // method will return %FALSE. | 86 | // method will return %FALSE. | ||
| 87 | - | func (x *ListStore) FindWithEqualFunc(ItemVar *gobject.Object, EqualFuncVar glib.EqualFunc, PositionVar uint) bool { | 87 | + | func (x *ListStore) FindWithEqualFunc(ItemVar *gobject.Object, EqualFuncVar *glib.EqualFunc, PositionVar uint) bool { |
| 88 | 88 | ||||
| 89 | - | cret := xListStoreFindWithEqualFunc(x.GoPointer(), ItemVar.GoPointer(), purego.NewCallback(EqualFuncVar), PositionVar) | 89 | + | cret := xListStoreFindWithEqualFunc(x.GoPointer(), ItemVar.GoPointer(), glib.NewCallback(EqualFuncVar), PositionVar) |
| 90 | return cret | 90 | return cret | ||
| 91 | } | 91 | } | ||
| 92 | 92 | ||||
| @@ -116,9 +116,9 @@ var xListStoreInsertSorted func(uintptr, uintptr, uintptr, uintptr) uint | |||||
| 116 | // inserting items by way of this function. | 116 | // inserting items by way of this function. | ||
| 117 | // | 117 | // | ||
| 118 | // This function takes a ref on @item. | 118 | // This function takes a ref on @item. | ||
| 119 | - | func (x *ListStore) InsertSorted(ItemVar *gobject.Object, CompareFuncVar glib.CompareDataFunc, UserDataVar uintptr) uint { | 119 | + | func (x *ListStore) InsertSorted(ItemVar *gobject.Object, CompareFuncVar *glib.CompareDataFunc, UserDataVar uintptr) uint { |
| 120 | 120 | ||||
| 121 | - | cret := xListStoreInsertSorted(x.GoPointer(), ItemVar.GoPointer(), purego.NewCallback(CompareFuncVar), UserDataVar) | 121 | + | cret := xListStoreInsertSorted(x.GoPointer(), ItemVar.GoPointer(), glib.NewCallback(CompareFuncVar), UserDataVar) |
| 122 | return cret | 122 | return cret | ||
| 123 | } | 123 | } | ||
| 124 | 124 | ||||
| @@ -147,9 +147,9 @@ func (x *ListStore) RemoveAll() { | |||||
| 147 | var xListStoreSort func(uintptr, uintptr, uintptr) | 147 | var xListStoreSort func(uintptr, uintptr, uintptr) | ||
| 148 | 148 | ||||
| 149 | // Sort the items in @store according to @compare_func. | 149 | // Sort the items in @store according to @compare_func. | ||
| 150 | - | func (x *ListStore) Sort(CompareFuncVar glib.CompareDataFunc, UserDataVar uintptr) { | 150 | + | func (x *ListStore) Sort(CompareFuncVar *glib.CompareDataFunc, UserDataVar uintptr) { |
| 151 | 151 | ||||
| 152 | - | xListStoreSort(x.GoPointer(), purego.NewCallback(CompareFuncVar), UserDataVar) | 152 | + | xListStoreSort(x.GoPointer(), glib.NewCallback(CompareFuncVar), UserDataVar) |
| 153 | 153 | ||||
| 154 | } | 154 | } | ||
| 155 | 155 | ||||
M v4/gio/gloadableicon.go +3 -3
| @@ -24,7 +24,7 @@ type LoadableIcon interface { | |||||
| 24 | GoPointer() uintptr | 24 | GoPointer() uintptr | ||
| 25 | SetGoPointer(uintptr) | 25 | SetGoPointer(uintptr) | ||
| 26 | Load(SizeVar int, TypeVar string, CancellableVar *Cancellable) *InputStream | 26 | Load(SizeVar int, TypeVar string, CancellableVar *Cancellable) *InputStream | ||
| 27 | - | LoadAsync(SizeVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 27 | + | LoadAsync(SizeVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 28 | LoadFinish(ResVar AsyncResult, TypeVar string) *InputStream | 28 | LoadFinish(ResVar AsyncResult, TypeVar string) *InputStream | ||
| 29 | } | 29 | } | ||
| 30 | type LoadableIconBase struct { | 30 | type LoadableIconBase struct { | ||
| @@ -62,9 +62,9 @@ func (x *LoadableIconBase) Load(SizeVar int, TypeVar string, CancellableVar *Can | |||||
| 62 | // Loads an icon asynchronously. To finish this function, see | 62 | // Loads an icon asynchronously. To finish this function, see | ||
| 63 | // g_loadable_icon_load_finish(). For the synchronous, blocking | 63 | // g_loadable_icon_load_finish(). For the synchronous, blocking | ||
| 64 | // version of this function, see g_loadable_icon_load(). | 64 | // version of this function, see g_loadable_icon_load(). | ||
| 65 | - | func (x *LoadableIconBase) LoadAsync(SizeVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 65 | + | func (x *LoadableIconBase) LoadAsync(SizeVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 66 | 66 | ||||
| 67 | - | XGLoadableIconLoadAsync(x.GoPointer(), SizeVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 67 | + | XGLoadableIconLoadAsync(x.GoPointer(), SizeVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 68 | 68 | ||||
| 69 | } | 69 | } | ||
| 70 | 70 | ||||
M v4/gio/gmemoryinputstream.go +4 -4
| @@ -74,10 +74,10 @@ func NewMemoryInputStreamFromBytes(BytesVar *glib.Bytes) *MemoryInputStream { | |||||
| 74 | var xNewMemoryInputStreamFromData func(uintptr, int, uintptr) uintptr | 74 | var xNewMemoryInputStreamFromData func(uintptr, int, uintptr) uintptr | ||
| 75 | 75 | ||||
| 76 | // Creates a new #GMemoryInputStream with data in memory of a given size. | 76 | // Creates a new #GMemoryInputStream with data in memory of a given size. | ||
| 77 | - | func NewMemoryInputStreamFromData(DataVar uintptr, LenVar int, DestroyVar glib.DestroyNotify) *MemoryInputStream { | 77 | + | func NewMemoryInputStreamFromData(DataVar uintptr, LenVar int, DestroyVar *glib.DestroyNotify) *MemoryInputStream { |
| 78 | var cls *MemoryInputStream | 78 | var cls *MemoryInputStream | ||
| 79 | 79 | ||||
| 80 | - | cret := xNewMemoryInputStreamFromData(DataVar, LenVar, purego.NewCallback(DestroyVar)) | 80 | + | cret := xNewMemoryInputStreamFromData(DataVar, LenVar, glib.NewCallback(DestroyVar)) |
| 81 | 81 | ||||
| 82 | if cret == 0 { | 82 | if cret == 0 { | ||
| 83 | return nil | 83 | return nil | ||
| @@ -99,9 +99,9 @@ func (x *MemoryInputStream) AddBytes(BytesVar *glib.Bytes) { | |||||
| 99 | var xMemoryInputStreamAddData func(uintptr, uintptr, int, uintptr) | 99 | var xMemoryInputStreamAddData func(uintptr, uintptr, int, uintptr) | ||
| 100 | 100 | ||||
| 101 | // Appends @data to data that can be read from the input stream | 101 | // Appends @data to data that can be read from the input stream | ||
| 102 | - | func (x *MemoryInputStream) AddData(DataVar uintptr, LenVar int, DestroyVar glib.DestroyNotify) { | 102 | + | func (x *MemoryInputStream) AddData(DataVar uintptr, LenVar int, DestroyVar *glib.DestroyNotify) { |
| 103 | 103 | ||||
| 104 | - | xMemoryInputStreamAddData(x.GoPointer(), DataVar, LenVar, purego.NewCallback(DestroyVar)) | 104 | + | xMemoryInputStreamAddData(x.GoPointer(), DataVar, LenVar, glib.NewCallback(DestroyVar)) |
| 105 | 105 | ||||
| 106 | } | 106 | } | ||
| 107 | 107 | ||||
M v4/gio/gmemoryoutputstream.go +2 -2
| @@ -88,10 +88,10 @@ var xNewMemoryOutputStream func(uintptr, uint, uintptr, uintptr) uintptr | |||||
| 88 | // data = malloc (200); | 88 | // data = malloc (200); | ||
| 89 | // stream3 = g_memory_output_stream_new (data, 200, NULL, free); | 89 | // stream3 = g_memory_output_stream_new (data, 200, NULL, free); | ||
| 90 | // ]| | 90 | // ]| | ||
| 91 | - | func NewMemoryOutputStream(DataVar uintptr, SizeVar uint, ReallocFunctionVar ReallocFunc, DestroyFunctionVar glib.DestroyNotify) *MemoryOutputStream { | 91 | + | func NewMemoryOutputStream(DataVar uintptr, SizeVar uint, ReallocFunctionVar *ReallocFunc, DestroyFunctionVar *glib.DestroyNotify) *MemoryOutputStream { |
| 92 | var cls *MemoryOutputStream | 92 | var cls *MemoryOutputStream | ||
| 93 | 93 | ||||
| 94 | - | cret := xNewMemoryOutputStream(DataVar, SizeVar, purego.NewCallback(ReallocFunctionVar), purego.NewCallback(DestroyFunctionVar)) | 94 | + | cret := xNewMemoryOutputStream(DataVar, SizeVar, glib.NewCallback(ReallocFunctionVar), glib.NewCallback(DestroyFunctionVar)) |
| 95 | 95 | ||||
| 96 | if cret == 0 { | 96 | if cret == 0 { | ||
| 97 | return nil | 97 | return nil | ||
M v4/gio/gmenumodel.go +11 -3
| @@ -559,15 +559,23 @@ func (c *MenuModel) SetGoPointer(ptr uintptr) { | |||||
| 559 | // Signal handlers may query the model (particularly the added items) | 559 | // Signal handlers may query the model (particularly the added items) | ||
| 560 | // and expect to see the results of the modification that is being | 560 | // and expect to see the results of the modification that is being | ||
| 561 | // reported. The signal is emitted after the modification. | 561 | // reported. The signal is emitted after the modification. | ||
| 562 | - | func (x *MenuModel) ConnectItemsChanged(cb func(MenuModel, int, int, int)) uint32 { | 562 | + | func (x *MenuModel) ConnectItemsChanged(cb *func(MenuModel, int, int, int)) uint32 { |
| 563 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 564 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 565 | + | return gobject.SignalConnect(x.GoPointer(), "items-changed", cbRefPtr) | |||
| 566 | + | } | |||
| 567 | + | ||||
| 563 | fcb := func(clsPtr uintptr, PositionVarp int, RemovedVarp int, AddedVarp int) { | 568 | fcb := func(clsPtr uintptr, PositionVarp int, RemovedVarp int, AddedVarp int) { | ||
| 564 | fa := MenuModel{} | 569 | fa := MenuModel{} | ||
| 565 | fa.Ptr = clsPtr | 570 | fa.Ptr = clsPtr | ||
| 571 | + | cbFn := *cb | |||
| 566 | 572 | ||||
| 567 | - | cb(fa, PositionVarp, RemovedVarp, AddedVarp) | 573 | + | cbFn(fa, PositionVarp, RemovedVarp, AddedVarp) |
| 568 | 574 | ||||
| 569 | } | 575 | } | ||
| 570 | - | return gobject.SignalConnect(x.GoPointer(), "items-changed", purego.NewCallback(fcb)) | 576 | + | cbRefPtr := purego.NewCallback(fcb) |
| 577 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 578 | + | return gobject.SignalConnect(x.GoPointer(), "items-changed", cbRefPtr) | |||
| 571 | } | 579 | } | ||
| 572 | 580 | ||||
| 573 | func init() { | 581 | func init() { | ||
M v4/gio/gmount.go +18 -18
| @@ -42,9 +42,9 @@ type Mount interface { | |||||
| 42 | SetGoPointer(uintptr) | 42 | SetGoPointer(uintptr) | ||
| 43 | CanEject() bool | 43 | CanEject() bool | ||
| 44 | CanUnmount() bool | 44 | CanUnmount() bool | ||
| 45 | - | Eject(FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 45 | + | Eject(FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 46 | EjectFinish(ResultVar AsyncResult) bool | 46 | EjectFinish(ResultVar AsyncResult) bool | ||
| 47 | - | EjectWithOperation(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 47 | + | EjectWithOperation(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 48 | EjectWithOperationFinish(ResultVar AsyncResult) bool | 48 | EjectWithOperationFinish(ResultVar AsyncResult) bool | ||
| 49 | GetDefaultLocation() *FileBase | 49 | GetDefaultLocation() *FileBase | ||
| 50 | GetDrive() *DriveBase | 50 | GetDrive() *DriveBase | ||
| @@ -55,16 +55,16 @@ type Mount interface { | |||||
| 55 | GetSymbolicIcon() *IconBase | 55 | GetSymbolicIcon() *IconBase | ||
| 56 | GetUuid() string | 56 | GetUuid() string | ||
| 57 | GetVolume() *VolumeBase | 57 | GetVolume() *VolumeBase | ||
| 58 | - | GuessContentType(ForceRescanVar bool, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 58 | + | GuessContentType(ForceRescanVar bool, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 59 | GuessContentTypeFinish(ResultVar AsyncResult) uintptr | 59 | GuessContentTypeFinish(ResultVar AsyncResult) uintptr | ||
| 60 | GuessContentTypeSync(ForceRescanVar bool, CancellableVar *Cancellable) uintptr | 60 | GuessContentTypeSync(ForceRescanVar bool, CancellableVar *Cancellable) uintptr | ||
| 61 | IsShadowed() bool | 61 | IsShadowed() bool | ||
| 62 | - | Remount(FlagsVar MountMountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 62 | + | Remount(FlagsVar MountMountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 63 | RemountFinish(ResultVar AsyncResult) bool | 63 | RemountFinish(ResultVar AsyncResult) bool | ||
| 64 | Shadow() | 64 | Shadow() | ||
| 65 | - | Unmount(FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 65 | + | Unmount(FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 66 | UnmountFinish(ResultVar AsyncResult) bool | 66 | UnmountFinish(ResultVar AsyncResult) bool | ||
| 67 | - | UnmountWithOperation(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 67 | + | UnmountWithOperation(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 68 | UnmountWithOperationFinish(ResultVar AsyncResult) bool | 68 | UnmountWithOperationFinish(ResultVar AsyncResult) bool | ||
| 69 | Unshadow() | 69 | Unshadow() | ||
| 70 | } | 70 | } | ||
| @@ -97,9 +97,9 @@ func (x *MountBase) CanUnmount() bool { | |||||
| 97 | // Ejects a mount. This is an asynchronous operation, and is | 97 | // Ejects a mount. This is an asynchronous operation, and is | ||
| 98 | // finished by calling g_mount_eject_finish() with the @mount | 98 | // finished by calling g_mount_eject_finish() with the @mount | ||
| 99 | // and #GAsyncResult data returned in the @callback. | 99 | // and #GAsyncResult data returned in the @callback. | ||
| 100 | - | func (x *MountBase) Eject(FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 100 | + | func (x *MountBase) Eject(FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 101 | 101 | ||||
| 102 | - | XGMountEject(x.GoPointer(), FlagsVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 102 | + | XGMountEject(x.GoPointer(), FlagsVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 103 | 103 | ||||
| 104 | } | 104 | } | ||
| 105 | 105 | ||||
| @@ -119,9 +119,9 @@ func (x *MountBase) EjectFinish(ResultVar AsyncResult) (bool, error) { | |||||
| 119 | // Ejects a mount. This is an asynchronous operation, and is | 119 | // Ejects a mount. This is an asynchronous operation, and is | ||
| 120 | // finished by calling g_mount_eject_with_operation_finish() with the @mount | 120 | // finished by calling g_mount_eject_with_operation_finish() with the @mount | ||
| 121 | // and #GAsyncResult data returned in the @callback. | 121 | // and #GAsyncResult data returned in the @callback. | ||
| 122 | - | func (x *MountBase) EjectWithOperation(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 122 | + | func (x *MountBase) EjectWithOperation(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 123 | 123 | ||||
| 124 | - | XGMountEjectWithOperation(x.GoPointer(), FlagsVar, MountOperationVar.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 124 | + | XGMountEjectWithOperation(x.GoPointer(), FlagsVar, MountOperationVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 125 | 125 | ||||
| 126 | } | 126 | } | ||
| 127 | 127 | ||||
| @@ -262,9 +262,9 @@ func (x *MountBase) GetVolume() *VolumeBase { | |||||
| 262 | // g_mount_guess_content_type_sync() for the synchronous version), and | 262 | // g_mount_guess_content_type_sync() for the synchronous version), and | ||
| 263 | // is finished by calling g_mount_guess_content_type_finish() with the | 263 | // is finished by calling g_mount_guess_content_type_finish() with the | ||
| 264 | // @mount and #GAsyncResult data returned in the @callback. | 264 | // @mount and #GAsyncResult data returned in the @callback. | ||
| 265 | - | func (x *MountBase) GuessContentType(ForceRescanVar bool, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 265 | + | func (x *MountBase) GuessContentType(ForceRescanVar bool, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 266 | 266 | ||||
| 267 | - | XGMountGuessContentType(x.GoPointer(), ForceRescanVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 267 | + | XGMountGuessContentType(x.GoPointer(), ForceRescanVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 268 | 268 | ||||
| 269 | } | 269 | } | ||
| 270 | 270 | ||||
| @@ -342,9 +342,9 @@ func (x *MountBase) IsShadowed() bool { | |||||
| 342 | // take affect. While this is semantically equivalent with unmounting | 342 | // take affect. While this is semantically equivalent with unmounting | ||
| 343 | // and then remounting not all backends might need to actually be | 343 | // and then remounting not all backends might need to actually be | ||
| 344 | // unmounted. | 344 | // unmounted. | ||
| 345 | - | func (x *MountBase) Remount(FlagsVar MountMountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 345 | + | func (x *MountBase) Remount(FlagsVar MountMountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 346 | 346 | ||||
| 347 | - | XGMountRemount(x.GoPointer(), FlagsVar, MountOperationVar.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 347 | + | XGMountRemount(x.GoPointer(), FlagsVar, MountOperationVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 348 | 348 | ||||
| 349 | } | 349 | } | ||
| 350 | 350 | ||||
| @@ -374,9 +374,9 @@ func (x *MountBase) Shadow() { | |||||
| 374 | // Unmounts a mount. This is an asynchronous operation, and is | 374 | // Unmounts a mount. This is an asynchronous operation, and is | ||
| 375 | // finished by calling g_mount_unmount_finish() with the @mount | 375 | // finished by calling g_mount_unmount_finish() with the @mount | ||
| 376 | // and #GAsyncResult data returned in the @callback. | 376 | // and #GAsyncResult data returned in the @callback. | ||
| 377 | - | func (x *MountBase) Unmount(FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 377 | + | func (x *MountBase) Unmount(FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 378 | 378 | ||||
| 379 | - | XGMountUnmount(x.GoPointer(), FlagsVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 379 | + | XGMountUnmount(x.GoPointer(), FlagsVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 380 | 380 | ||||
| 381 | } | 381 | } | ||
| 382 | 382 | ||||
| @@ -396,9 +396,9 @@ func (x *MountBase) UnmountFinish(ResultVar AsyncResult) (bool, error) { | |||||
| 396 | // Unmounts a mount. This is an asynchronous operation, and is | 396 | // Unmounts a mount. This is an asynchronous operation, and is | ||
| 397 | // finished by calling g_mount_unmount_with_operation_finish() with the @mount | 397 | // finished by calling g_mount_unmount_with_operation_finish() with the @mount | ||
| 398 | // and #GAsyncResult data returned in the @callback. | 398 | // and #GAsyncResult data returned in the @callback. | ||
| 399 | - | func (x *MountBase) UnmountWithOperation(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 399 | + | func (x *MountBase) UnmountWithOperation(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 400 | 400 | ||||
| 401 | - | XGMountUnmountWithOperation(x.GoPointer(), FlagsVar, MountOperationVar.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 401 | + | XGMountUnmountWithOperation(x.GoPointer(), FlagsVar, MountOperationVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 402 | 402 | ||||
| 403 | } | 403 | } | ||
| 404 | 404 | ||||
M v4/gio/gmountoperation.go +67 -18
| @@ -6,6 +6,7 @@ import ( | |||||
| 6 | 6 | ||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 9 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 10 | ) | 11 | ) | ||
| 11 | 12 | ||||
| @@ -258,15 +259,23 @@ func (c *MountOperation) SetGoPointer(ptr uintptr) { | |||||
| 258 | // | 259 | // | ||
| 259 | // Implementations of GMountOperation should handle this signal | 260 | // Implementations of GMountOperation should handle this signal | ||
| 260 | // by dismissing open password dialogs. | 261 | // by dismissing open password dialogs. | ||
| 261 | - | func (x *MountOperation) ConnectAborted(cb func(MountOperation)) uint32 { | 262 | + | func (x *MountOperation) ConnectAborted(cb *func(MountOperation)) uint32 { |
| 263 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 264 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 265 | + | return gobject.SignalConnect(x.GoPointer(), "aborted", cbRefPtr) | |||
| 266 | + | } | |||
| 267 | + | ||||
| 262 | fcb := func(clsPtr uintptr) { | 268 | fcb := func(clsPtr uintptr) { | ||
| 263 | fa := MountOperation{} | 269 | fa := MountOperation{} | ||
| 264 | fa.Ptr = clsPtr | 270 | fa.Ptr = clsPtr | ||
| 271 | + | cbFn := *cb | |||
| 265 | 272 | ||||
| 266 | - | cb(fa) | 273 | + | cbFn(fa) |
| 267 | 274 | ||||
| 268 | } | 275 | } | ||
| 269 | - | return gobject.SignalConnect(x.GoPointer(), "aborted", purego.NewCallback(fcb)) | 276 | + | cbRefPtr := purego.NewCallback(fcb) |
| 277 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 278 | + | return gobject.SignalConnect(x.GoPointer(), "aborted", cbRefPtr) | |||
| 270 | } | 279 | } | ||
| 271 | 280 | ||||
| 272 | // Emitted when a mount operation asks the user for a password. | 281 | // Emitted when a mount operation asks the user for a password. | ||
| @@ -274,15 +283,23 @@ func (x *MountOperation) ConnectAborted(cb func(MountOperation)) uint32 { | |||||
| 274 | // If the message contains a line break, the first line should be | 283 | // If the message contains a line break, the first line should be | ||
| 275 | // presented as a heading. For example, it may be used as the | 284 | // presented as a heading. For example, it may be used as the | ||
| 276 | // primary text in a #GtkMessageDialog. | 285 | // primary text in a #GtkMessageDialog. | ||
| 277 | - | func (x *MountOperation) ConnectAskPassword(cb func(MountOperation, string, string, string, AskPasswordFlags)) uint32 { | 286 | + | func (x *MountOperation) ConnectAskPassword(cb *func(MountOperation, string, string, string, AskPasswordFlags)) uint32 { |
| 287 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 288 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 289 | + | return gobject.SignalConnect(x.GoPointer(), "ask-password", cbRefPtr) | |||
| 290 | + | } | |||
| 291 | + | ||||
| 278 | fcb := func(clsPtr uintptr, MessageVarp string, DefaultUserVarp string, DefaultDomainVarp string, FlagsVarp AskPasswordFlags) { | 292 | fcb := func(clsPtr uintptr, MessageVarp string, DefaultUserVarp string, DefaultDomainVarp string, FlagsVarp AskPasswordFlags) { | ||
| 279 | fa := MountOperation{} | 293 | fa := MountOperation{} | ||
| 280 | fa.Ptr = clsPtr | 294 | fa.Ptr = clsPtr | ||
| 295 | + | cbFn := *cb | |||
| 281 | 296 | ||||
| 282 | - | cb(fa, MessageVarp, DefaultUserVarp, DefaultDomainVarp, FlagsVarp) | 297 | + | cbFn(fa, MessageVarp, DefaultUserVarp, DefaultDomainVarp, FlagsVarp) |
| 283 | 298 | ||||
| 284 | } | 299 | } | ||
| 285 | - | return gobject.SignalConnect(x.GoPointer(), "ask-password", purego.NewCallback(fcb)) | 300 | + | cbRefPtr := purego.NewCallback(fcb) |
| 301 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 302 | + | return gobject.SignalConnect(x.GoPointer(), "ask-password", cbRefPtr) | |||
| 286 | } | 303 | } | ||
| 287 | 304 | ||||
| 288 | // Emitted when asking the user a question and gives a list of | 305 | // Emitted when asking the user a question and gives a list of | ||
| @@ -291,27 +308,43 @@ func (x *MountOperation) ConnectAskPassword(cb func(MountOperation, string, stri | |||||
| 291 | // If the message contains a line break, the first line should be | 308 | // If the message contains a line break, the first line should be | ||
| 292 | // presented as a heading. For example, it may be used as the | 309 | // presented as a heading. For example, it may be used as the | ||
| 293 | // primary text in a #GtkMessageDialog. | 310 | // primary text in a #GtkMessageDialog. | ||
| 294 | - | func (x *MountOperation) ConnectAskQuestion(cb func(MountOperation, string, uintptr)) uint32 { | 311 | + | func (x *MountOperation) ConnectAskQuestion(cb *func(MountOperation, string, uintptr)) uint32 { |
| 312 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 313 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 314 | + | return gobject.SignalConnect(x.GoPointer(), "ask-question", cbRefPtr) | |||
| 315 | + | } | |||
| 316 | + | ||||
| 295 | fcb := func(clsPtr uintptr, MessageVarp string, ChoicesVarp uintptr) { | 317 | fcb := func(clsPtr uintptr, MessageVarp string, ChoicesVarp uintptr) { | ||
| 296 | fa := MountOperation{} | 318 | fa := MountOperation{} | ||
| 297 | fa.Ptr = clsPtr | 319 | fa.Ptr = clsPtr | ||
| 320 | + | cbFn := *cb | |||
| 298 | 321 | ||||
| 299 | - | cb(fa, MessageVarp, ChoicesVarp) | 322 | + | cbFn(fa, MessageVarp, ChoicesVarp) |
| 300 | 323 | ||||
| 301 | } | 324 | } | ||
| 302 | - | return gobject.SignalConnect(x.GoPointer(), "ask-question", purego.NewCallback(fcb)) | 325 | + | cbRefPtr := purego.NewCallback(fcb) |
| 326 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 327 | + | return gobject.SignalConnect(x.GoPointer(), "ask-question", cbRefPtr) | |||
| 303 | } | 328 | } | ||
| 304 | 329 | ||||
| 305 | // Emitted when the user has replied to the mount operation. | 330 | // Emitted when the user has replied to the mount operation. | ||
| 306 | - | func (x *MountOperation) ConnectReply(cb func(MountOperation, MountOperationResult)) uint32 { | 331 | + | func (x *MountOperation) ConnectReply(cb *func(MountOperation, MountOperationResult)) uint32 { |
| 332 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 333 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 334 | + | return gobject.SignalConnect(x.GoPointer(), "reply", cbRefPtr) | |||
| 335 | + | } | |||
| 336 | + | ||||
| 307 | fcb := func(clsPtr uintptr, ResultVarp MountOperationResult) { | 337 | fcb := func(clsPtr uintptr, ResultVarp MountOperationResult) { | ||
| 308 | fa := MountOperation{} | 338 | fa := MountOperation{} | ||
| 309 | fa.Ptr = clsPtr | 339 | fa.Ptr = clsPtr | ||
| 340 | + | cbFn := *cb | |||
| 310 | 341 | ||||
| 311 | - | cb(fa, ResultVarp) | 342 | + | cbFn(fa, ResultVarp) |
| 312 | 343 | ||||
| 313 | } | 344 | } | ||
| 314 | - | return gobject.SignalConnect(x.GoPointer(), "reply", purego.NewCallback(fcb)) | 345 | + | cbRefPtr := purego.NewCallback(fcb) |
| 346 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 347 | + | return gobject.SignalConnect(x.GoPointer(), "reply", cbRefPtr) | |||
| 315 | } | 348 | } | ||
| 316 | 349 | ||||
| 317 | // Emitted when one or more processes are blocking an operation | 350 | // Emitted when one or more processes are blocking an operation | ||
| @@ -326,15 +359,23 @@ func (x *MountOperation) ConnectReply(cb func(MountOperation, MountOperationResu | |||||
| 326 | // If the message contains a line break, the first line should be | 359 | // If the message contains a line break, the first line should be | ||
| 327 | // presented as a heading. For example, it may be used as the | 360 | // presented as a heading. For example, it may be used as the | ||
| 328 | // primary text in a #GtkMessageDialog. | 361 | // primary text in a #GtkMessageDialog. | ||
| 329 | - | func (x *MountOperation) ConnectShowProcesses(cb func(MountOperation, string, uintptr, uintptr)) uint32 { | 362 | + | func (x *MountOperation) ConnectShowProcesses(cb *func(MountOperation, string, uintptr, uintptr)) uint32 { |
| 363 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 364 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 365 | + | return gobject.SignalConnect(x.GoPointer(), "show-processes", cbRefPtr) | |||
| 366 | + | } | |||
| 367 | + | ||||
| 330 | fcb := func(clsPtr uintptr, MessageVarp string, ProcessesVarp uintptr, ChoicesVarp uintptr) { | 368 | fcb := func(clsPtr uintptr, MessageVarp string, ProcessesVarp uintptr, ChoicesVarp uintptr) { | ||
| 331 | fa := MountOperation{} | 369 | fa := MountOperation{} | ||
| 332 | fa.Ptr = clsPtr | 370 | fa.Ptr = clsPtr | ||
| 371 | + | cbFn := *cb | |||
| 333 | 372 | ||||
| 334 | - | cb(fa, MessageVarp, ProcessesVarp, ChoicesVarp) | 373 | + | cbFn(fa, MessageVarp, ProcessesVarp, ChoicesVarp) |
| 335 | 374 | ||||
| 336 | } | 375 | } | ||
| 337 | - | return gobject.SignalConnect(x.GoPointer(), "show-processes", purego.NewCallback(fcb)) | 376 | + | cbRefPtr := purego.NewCallback(fcb) |
| 377 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 378 | + | return gobject.SignalConnect(x.GoPointer(), "show-processes", cbRefPtr) | |||
| 338 | } | 379 | } | ||
| 339 | 380 | ||||
| 340 | // Emitted when an unmount operation has been busy for more than some time | 381 | // Emitted when an unmount operation has been busy for more than some time | ||
| @@ -353,15 +394,23 @@ func (x *MountOperation) ConnectShowProcesses(cb func(MountOperation, string, ui | |||||
| 353 | // If the message contains a line break, the first line should be | 394 | // If the message contains a line break, the first line should be | ||
| 354 | // presented as a heading. For example, it may be used as the | 395 | // presented as a heading. For example, it may be used as the | ||
| 355 | // primary text in a #GtkMessageDialog. | 396 | // primary text in a #GtkMessageDialog. | ||
| 356 | - | func (x *MountOperation) ConnectShowUnmountProgress(cb func(MountOperation, string, int64, int64)) uint32 { | 397 | + | func (x *MountOperation) ConnectShowUnmountProgress(cb *func(MountOperation, string, int64, int64)) uint32 { |
| 398 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 399 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 400 | + | return gobject.SignalConnect(x.GoPointer(), "show-unmount-progress", cbRefPtr) | |||
| 401 | + | } | |||
| 402 | + | ||||
| 357 | fcb := func(clsPtr uintptr, MessageVarp string, TimeLeftVarp int64, BytesLeftVarp int64) { | 403 | fcb := func(clsPtr uintptr, MessageVarp string, TimeLeftVarp int64, BytesLeftVarp int64) { | ||
| 358 | fa := MountOperation{} | 404 | fa := MountOperation{} | ||
| 359 | fa.Ptr = clsPtr | 405 | fa.Ptr = clsPtr | ||
| 406 | + | cbFn := *cb | |||
| 360 | 407 | ||||
| 361 | - | cb(fa, MessageVarp, TimeLeftVarp, BytesLeftVarp) | 408 | + | cbFn(fa, MessageVarp, TimeLeftVarp, BytesLeftVarp) |
| 362 | 409 | ||||
| 363 | } | 410 | } | ||
| 364 | - | return gobject.SignalConnect(x.GoPointer(), "show-unmount-progress", purego.NewCallback(fcb)) | 411 | + | cbRefPtr := purego.NewCallback(fcb) |
| 412 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 413 | + | return gobject.SignalConnect(x.GoPointer(), "show-unmount-progress", cbRefPtr) | |||
| 365 | } | 414 | } | ||
| 366 | 415 | ||||
| 367 | func init() { | 416 | func init() { | ||
M v4/gio/gnetworkmonitor.go +3 -3
| @@ -29,7 +29,7 @@ type NetworkMonitor interface { | |||||
| 29 | GoPointer() uintptr | 29 | GoPointer() uintptr | ||
| 30 | SetGoPointer(uintptr) | 30 | SetGoPointer(uintptr) | ||
| 31 | CanReach(ConnectableVar SocketConnectable, CancellableVar *Cancellable) bool | 31 | CanReach(ConnectableVar SocketConnectable, CancellableVar *Cancellable) bool | ||
| 32 | - | CanReachAsync(ConnectableVar SocketConnectable, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 32 | + | CanReachAsync(ConnectableVar SocketConnectable, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 33 | CanReachFinish(ResultVar AsyncResult) bool | 33 | CanReachFinish(ResultVar AsyncResult) bool | ||
| 34 | GetConnectivity() NetworkConnectivity | 34 | GetConnectivity() NetworkConnectivity | ||
| 35 | GetNetworkAvailable() bool | 35 | GetNetworkAvailable() bool | ||
| @@ -84,9 +84,9 @@ func (x *NetworkMonitorBase) CanReach(ConnectableVar SocketConnectable, Cancella | |||||
| 84 | // When the operation is finished, @callback will be called. | 84 | // When the operation is finished, @callback will be called. | ||
| 85 | // You can then call g_network_monitor_can_reach_finish() | 85 | // You can then call g_network_monitor_can_reach_finish() | ||
| 86 | // to get the result of the operation. | 86 | // to get the result of the operation. | ||
| 87 | - | func (x *NetworkMonitorBase) CanReachAsync(ConnectableVar SocketConnectable, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 87 | + | func (x *NetworkMonitorBase) CanReachAsync(ConnectableVar SocketConnectable, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 88 | 88 | ||||
| 89 | - | XGNetworkMonitorCanReachAsync(x.GoPointer(), ConnectableVar.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 89 | + | XGNetworkMonitorCanReachAsync(x.GoPointer(), ConnectableVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 90 | 90 | ||||
| 91 | } | 91 | } | ||
| 92 | 92 | ||||
M v4/gio/goutputstream.go +16 -16
| @@ -109,9 +109,9 @@ var xOutputStreamCloseAsync func(uintptr, int, uintptr, uintptr, uintptr) | |||||
| 109 | // The asynchronous methods have a default fallback that uses threads | 109 | // The asynchronous methods have a default fallback that uses threads | ||
| 110 | // to implement asynchronicity, so they are optional for inheriting | 110 | // to implement asynchronicity, so they are optional for inheriting | ||
| 111 | // classes. However, if you override one you must override all. | 111 | // classes. However, if you override one you must override all. | ||
| 112 | - | func (x *OutputStream) CloseAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 112 | + | func (x *OutputStream) CloseAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 113 | 113 | ||||
| 114 | - | xOutputStreamCloseAsync(x.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 114 | + | xOutputStreamCloseAsync(x.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 115 | 115 | ||||
| 116 | } | 116 | } | ||
| 117 | 117 | ||||
| @@ -160,9 +160,9 @@ var xOutputStreamFlushAsync func(uintptr, int, uintptr, uintptr, uintptr) | |||||
| 160 | // When the operation is finished @callback will be | 160 | // When the operation is finished @callback will be | ||
| 161 | // called. You can then call g_output_stream_flush_finish() to get the | 161 | // called. You can then call g_output_stream_flush_finish() to get the | ||
| 162 | // result of the operation. | 162 | // result of the operation. | ||
| 163 | - | func (x *OutputStream) FlushAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 163 | + | func (x *OutputStream) FlushAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 164 | 164 | ||||
| 165 | - | xOutputStreamFlushAsync(x.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 165 | + | xOutputStreamFlushAsync(x.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 166 | 166 | ||||
| 167 | } | 167 | } | ||
| 168 | 168 | ||||
| @@ -269,9 +269,9 @@ var xOutputStreamSpliceAsync func(uintptr, uintptr, OutputStreamSpliceFlags, int | |||||
| 269 | // | 269 | // | ||
| 270 | // For the synchronous, blocking version of this function, see | 270 | // For the synchronous, blocking version of this function, see | ||
| 271 | // g_output_stream_splice(). | 271 | // g_output_stream_splice(). | ||
| 272 | - | func (x *OutputStream) SpliceAsync(SourceVar *InputStream, FlagsVar OutputStreamSpliceFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 272 | + | func (x *OutputStream) SpliceAsync(SourceVar *InputStream, FlagsVar OutputStreamSpliceFlags, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 273 | 273 | ||||
| 274 | - | xOutputStreamSpliceAsync(x.GoPointer(), SourceVar.GoPointer(), FlagsVar, IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 274 | + | xOutputStreamSpliceAsync(x.GoPointer(), SourceVar.GoPointer(), FlagsVar, IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 275 | 275 | ||||
| 276 | } | 276 | } | ||
| 277 | 277 | ||||
| @@ -391,9 +391,9 @@ var xOutputStreamWriteAllAsync func(uintptr, uintptr, uint, int, uintptr, uintpt | |||||
| 391 | // | 391 | // | ||
| 392 | // Note that no copy of @buffer will be made, so it must stay valid | 392 | // Note that no copy of @buffer will be made, so it must stay valid | ||
| 393 | // until @callback is called. | 393 | // until @callback is called. | ||
| 394 | - | func (x *OutputStream) WriteAllAsync(BufferVar uintptr, CountVar uint, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 394 | + | func (x *OutputStream) WriteAllAsync(BufferVar uintptr, CountVar uint, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 395 | 395 | ||||
| 396 | - | xOutputStreamWriteAllAsync(x.GoPointer(), BufferVar, CountVar, IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 396 | + | xOutputStreamWriteAllAsync(x.GoPointer(), BufferVar, CountVar, IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 397 | 397 | ||||
| 398 | } | 398 | } | ||
| 399 | 399 | ||||
| @@ -457,9 +457,9 @@ var xOutputStreamWriteAsync func(uintptr, uintptr, uint, int, uintptr, uintptr, | |||||
| 457 | // until @callback is called. See g_output_stream_write_bytes_async() | 457 | // until @callback is called. See g_output_stream_write_bytes_async() | ||
| 458 | // for a #GBytes version that will automatically hold a reference to | 458 | // for a #GBytes version that will automatically hold a reference to | ||
| 459 | // the contents (without copying) for the duration of the call. | 459 | // the contents (without copying) for the duration of the call. | ||
| 460 | - | func (x *OutputStream) WriteAsync(BufferVar uintptr, CountVar uint, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 460 | + | func (x *OutputStream) WriteAsync(BufferVar uintptr, CountVar uint, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 461 | 461 | ||||
| 462 | - | xOutputStreamWriteAsync(x.GoPointer(), BufferVar, CountVar, IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 462 | + | xOutputStreamWriteAsync(x.GoPointer(), BufferVar, CountVar, IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 463 | 463 | ||||
| 464 | } | 464 | } | ||
| 465 | 465 | ||||
| @@ -502,9 +502,9 @@ var xOutputStreamWriteBytesAsync func(uintptr, *glib.Bytes, int, uintptr, uintpt | |||||
| 502 | // | 502 | // | ||
| 503 | // For the synchronous, blocking version of this function, see | 503 | // For the synchronous, blocking version of this function, see | ||
| 504 | // g_output_stream_write_bytes(). | 504 | // g_output_stream_write_bytes(). | ||
| 505 | - | func (x *OutputStream) WriteBytesAsync(BytesVar *glib.Bytes, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 505 | + | func (x *OutputStream) WriteBytesAsync(BytesVar *glib.Bytes, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 506 | 506 | ||||
| 507 | - | xOutputStreamWriteBytesAsync(x.GoPointer(), BytesVar, IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 507 | + | xOutputStreamWriteBytesAsync(x.GoPointer(), BytesVar, IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 508 | 508 | ||||
| 509 | } | 509 | } | ||
| 510 | 510 | ||||
| @@ -625,9 +625,9 @@ var xOutputStreamWritevAllAsync func(uintptr, uintptr, uint, int, uintptr, uintp | |||||
| 625 | // Note that no copy of @vectors will be made, so it must stay valid | 625 | // Note that no copy of @vectors will be made, so it must stay valid | ||
| 626 | // until @callback is called. The content of the individual elements | 626 | // until @callback is called. The content of the individual elements | ||
| 627 | // of @vectors might be changed by this function. | 627 | // of @vectors might be changed by this function. | ||
| 628 | - | func (x *OutputStream) WritevAllAsync(VectorsVar uintptr, NVectorsVar uint, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 628 | + | func (x *OutputStream) WritevAllAsync(VectorsVar uintptr, NVectorsVar uint, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 629 | 629 | ||||
| 630 | - | xOutputStreamWritevAllAsync(x.GoPointer(), VectorsVar, NVectorsVar, IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 630 | + | xOutputStreamWritevAllAsync(x.GoPointer(), VectorsVar, NVectorsVar, IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 631 | 631 | ||||
| 632 | } | 632 | } | ||
| 633 | 633 | ||||
| @@ -686,9 +686,9 @@ var xOutputStreamWritevAsync func(uintptr, uintptr, uint, int, uintptr, uintptr, | |||||
| 686 | // | 686 | // | ||
| 687 | // Note that no copy of @vectors will be made, so it must stay valid | 687 | // Note that no copy of @vectors will be made, so it must stay valid | ||
| 688 | // until @callback is called. | 688 | // until @callback is called. | ||
| 689 | - | func (x *OutputStream) WritevAsync(VectorsVar uintptr, NVectorsVar uint, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 689 | + | func (x *OutputStream) WritevAsync(VectorsVar uintptr, NVectorsVar uint, IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 690 | 690 | ||||
| 691 | - | xOutputStreamWritevAsync(x.GoPointer(), VectorsVar, NVectorsVar, IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 691 | + | xOutputStreamWritevAsync(x.GoPointer(), VectorsVar, NVectorsVar, IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 692 | 692 | ||||
| 693 | } | 693 | } | ||
| 694 | 694 | ||||
M v4/gio/gpermission.go +4 -4
| @@ -86,9 +86,9 @@ var xPermissionAcquireAsync func(uintptr, uintptr, uintptr, uintptr) | |||||
| 86 | // | 86 | // | ||
| 87 | // This is the first half of the asynchronous version of | 87 | // This is the first half of the asynchronous version of | ||
| 88 | // g_permission_acquire(). | 88 | // g_permission_acquire(). | ||
| 89 | - | func (x *Permission) AcquireAsync(CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 89 | + | func (x *Permission) AcquireAsync(CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 90 | 90 | ||||
| 91 | - | xPermissionAcquireAsync(x.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 91 | + | xPermissionAcquireAsync(x.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 92 | 92 | ||||
| 93 | } | 93 | } | ||
| 94 | 94 | ||||
| @@ -190,9 +190,9 @@ var xPermissionReleaseAsync func(uintptr, uintptr, uintptr, uintptr) | |||||
| 190 | // | 190 | // | ||
| 191 | // This is the first half of the asynchronous version of | 191 | // This is the first half of the asynchronous version of | ||
| 192 | // g_permission_release(). | 192 | // g_permission_release(). | ||
| 193 | - | func (x *Permission) ReleaseAsync(CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 193 | + | func (x *Permission) ReleaseAsync(CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 194 | 194 | ||||
| 195 | - | xPermissionReleaseAsync(x.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 195 | + | xPermissionReleaseAsync(x.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 196 | 196 | ||||
| 197 | } | 197 | } | ||
| 198 | 198 | ||||
M v4/gio/gproxy.go +3 -3
| @@ -28,7 +28,7 @@ type Proxy interface { | |||||
| 28 | GoPointer() uintptr | 28 | GoPointer() uintptr | ||
| 29 | SetGoPointer(uintptr) | 29 | SetGoPointer(uintptr) | ||
| 30 | Connect(ConnectionVar *IOStream, ProxyAddressVar *ProxyAddress, CancellableVar *Cancellable) *IOStream | 30 | Connect(ConnectionVar *IOStream, ProxyAddressVar *ProxyAddress, CancellableVar *Cancellable) *IOStream | ||
| 31 | - | ConnectAsync(ConnectionVar *IOStream, ProxyAddressVar *ProxyAddress, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 31 | + | ConnectAsync(ConnectionVar *IOStream, ProxyAddressVar *ProxyAddress, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 32 | ConnectFinish(ResultVar AsyncResult) *IOStream | 32 | ConnectFinish(ResultVar AsyncResult) *IOStream | ||
| 33 | SupportsHostname() bool | 33 | SupportsHostname() bool | ||
| 34 | } | 34 | } | ||
| @@ -67,9 +67,9 @@ func (x *ProxyBase) Connect(ConnectionVar *IOStream, ProxyAddressVar *ProxyAddre | |||||
| 67 | } | 67 | } | ||
| 68 | 68 | ||||
| 69 | // Asynchronous version of g_proxy_connect(). | 69 | // Asynchronous version of g_proxy_connect(). | ||
| 70 | - | func (x *ProxyBase) ConnectAsync(ConnectionVar *IOStream, ProxyAddressVar *ProxyAddress, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 70 | + | func (x *ProxyBase) ConnectAsync(ConnectionVar *IOStream, ProxyAddressVar *ProxyAddress, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 71 | 71 | ||||
| 72 | - | XGProxyConnectAsync(x.GoPointer(), ConnectionVar.GoPointer(), ProxyAddressVar.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 72 | + | XGProxyConnectAsync(x.GoPointer(), ConnectionVar.GoPointer(), ProxyAddressVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 73 | 73 | ||||
| 74 | } | 74 | } | ||
| 75 | 75 | ||||
M v4/gio/gproxyresolver.go +3 -3
| @@ -31,7 +31,7 @@ type ProxyResolver interface { | |||||
| 31 | SetGoPointer(uintptr) | 31 | SetGoPointer(uintptr) | ||
| 32 | IsSupported() bool | 32 | IsSupported() bool | ||
| 33 | Lookup(UriVar string, CancellableVar *Cancellable) uintptr | 33 | Lookup(UriVar string, CancellableVar *Cancellable) uintptr | ||
| 34 | - | LookupAsync(UriVar string, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 34 | + | LookupAsync(UriVar string, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 35 | LookupFinish(ResultVar AsyncResult) uintptr | 35 | LookupFinish(ResultVar AsyncResult) uintptr | ||
| 36 | } | 36 | } | ||
| 37 | type ProxyResolverBase struct { | 37 | type ProxyResolverBase struct { | ||
| @@ -83,9 +83,9 @@ func (x *ProxyResolverBase) Lookup(UriVar string, CancellableVar *Cancellable) ( | |||||
| 83 | 83 | ||||
| 84 | // Asynchronous lookup of proxy. See g_proxy_resolver_lookup() for more | 84 | // Asynchronous lookup of proxy. See g_proxy_resolver_lookup() for more | ||
| 85 | // details. | 85 | // details. | ||
| 86 | - | func (x *ProxyResolverBase) LookupAsync(UriVar string, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 86 | + | func (x *ProxyResolverBase) LookupAsync(UriVar string, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 87 | 87 | ||||
| 88 | - | XGProxyResolverLookupAsync(x.GoPointer(), UriVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 88 | + | XGProxyResolverLookupAsync(x.GoPointer(), UriVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 89 | 89 | ||||
| 90 | } | 90 | } | ||
| 91 | 91 | ||||
M v4/gio/gresolver.go +21 -13
| @@ -83,9 +83,9 @@ var xResolverLookupByAddressAsync func(uintptr, uintptr, uintptr, uintptr, uintp | |||||
| 83 | // Begins asynchronously reverse-resolving @address to determine its | 83 | // Begins asynchronously reverse-resolving @address to determine its | ||
| 84 | // associated hostname, and eventually calls @callback, which must | 84 | // associated hostname, and eventually calls @callback, which must | ||
| 85 | // call g_resolver_lookup_by_address_finish() to get the final result. | 85 | // call g_resolver_lookup_by_address_finish() to get the final result. | ||
| 86 | - | func (x *Resolver) LookupByAddressAsync(AddressVar *InetAddress, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 86 | + | func (x *Resolver) LookupByAddressAsync(AddressVar *InetAddress, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 87 | 87 | ||||
| 88 | - | xResolverLookupByAddressAsync(x.GoPointer(), AddressVar.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 88 | + | xResolverLookupByAddressAsync(x.GoPointer(), AddressVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 89 | 89 | ||||
| 90 | } | 90 | } | ||
| 91 | 91 | ||||
| @@ -150,9 +150,9 @@ var xResolverLookupByNameAsync func(uintptr, string, uintptr, uintptr, uintptr) | |||||
| 150 | // associated IP address(es), and eventually calls @callback, which | 150 | // associated IP address(es), and eventually calls @callback, which | ||
| 151 | // must call g_resolver_lookup_by_name_finish() to get the result. | 151 | // must call g_resolver_lookup_by_name_finish() to get the result. | ||
| 152 | // See g_resolver_lookup_by_name() for more details. | 152 | // See g_resolver_lookup_by_name() for more details. | ||
| 153 | - | func (x *Resolver) LookupByNameAsync(HostnameVar string, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 153 | + | func (x *Resolver) LookupByNameAsync(HostnameVar string, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 154 | 154 | ||||
| 155 | - | xResolverLookupByNameAsync(x.GoPointer(), HostnameVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 155 | + | xResolverLookupByNameAsync(x.GoPointer(), HostnameVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 156 | 156 | ||||
| 157 | } | 157 | } | ||
| 158 | 158 | ||||
| @@ -197,9 +197,9 @@ var xResolverLookupByNameWithFlagsAsync func(uintptr, string, ResolverNameLookup | |||||
| 197 | // associated IP address(es), and eventually calls @callback, which | 197 | // associated IP address(es), and eventually calls @callback, which | ||
| 198 | // must call g_resolver_lookup_by_name_with_flags_finish() to get the result. | 198 | // must call g_resolver_lookup_by_name_with_flags_finish() to get the result. | ||
| 199 | // See g_resolver_lookup_by_name() for more details. | 199 | // See g_resolver_lookup_by_name() for more details. | ||
| 200 | - | func (x *Resolver) LookupByNameWithFlagsAsync(HostnameVar string, FlagsVar ResolverNameLookupFlags, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 200 | + | func (x *Resolver) LookupByNameWithFlagsAsync(HostnameVar string, FlagsVar ResolverNameLookupFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 201 | 201 | ||||
| 202 | - | xResolverLookupByNameWithFlagsAsync(x.GoPointer(), HostnameVar, FlagsVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 202 | + | xResolverLookupByNameWithFlagsAsync(x.GoPointer(), HostnameVar, FlagsVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 203 | 203 | ||||
| 204 | } | 204 | } | ||
| 205 | 205 | ||||
| @@ -251,9 +251,9 @@ var xResolverLookupRecordsAsync func(uintptr, string, ResolverRecordType, uintpt | |||||
| 251 | // @rrname, and eventually calls @callback, which must call | 251 | // @rrname, and eventually calls @callback, which must call | ||
| 252 | // g_resolver_lookup_records_finish() to get the final result. See | 252 | // g_resolver_lookup_records_finish() to get the final result. See | ||
| 253 | // g_resolver_lookup_records() for more details. | 253 | // g_resolver_lookup_records() for more details. | ||
| 254 | - | func (x *Resolver) LookupRecordsAsync(RrnameVar string, RecordTypeVar ResolverRecordType, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 254 | + | func (x *Resolver) LookupRecordsAsync(RrnameVar string, RecordTypeVar ResolverRecordType, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 255 | 255 | ||||
| 256 | - | xResolverLookupRecordsAsync(x.GoPointer(), RrnameVar, RecordTypeVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 256 | + | xResolverLookupRecordsAsync(x.GoPointer(), RrnameVar, RecordTypeVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 257 | 257 | ||||
| 258 | } | 258 | } | ||
| 259 | 259 | ||||
| @@ -319,9 +319,9 @@ var xResolverLookupServiceAsync func(uintptr, string, string, string, uintptr, u | |||||
| 319 | // @callback, which must call g_resolver_lookup_service_finish() to | 319 | // @callback, which must call g_resolver_lookup_service_finish() to | ||
| 320 | // get the final result. See g_resolver_lookup_service() for more | 320 | // get the final result. See g_resolver_lookup_service() for more | ||
| 321 | // details. | 321 | // details. | ||
| 322 | - | func (x *Resolver) LookupServiceAsync(ServiceVar string, ProtocolVar string, DomainVar string, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 322 | + | func (x *Resolver) LookupServiceAsync(ServiceVar string, ProtocolVar string, DomainVar string, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 323 | 323 | ||||
| 324 | - | xResolverLookupServiceAsync(x.GoPointer(), ServiceVar, ProtocolVar, DomainVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 324 | + | xResolverLookupServiceAsync(x.GoPointer(), ServiceVar, ProtocolVar, DomainVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 325 | 325 | ||||
| 326 | } | 326 | } | ||
| 327 | 327 | ||||
| @@ -371,15 +371,23 @@ func (c *Resolver) SetGoPointer(ptr uintptr) { | |||||
| 371 | 371 | ||||
| 372 | // Emitted when the resolver notices that the system resolver | 372 | // Emitted when the resolver notices that the system resolver | ||
| 373 | // configuration has changed. | 373 | // configuration has changed. | ||
| 374 | - | func (x *Resolver) ConnectReload(cb func(Resolver)) uint32 { | 374 | + | func (x *Resolver) ConnectReload(cb *func(Resolver)) uint32 { |
| 375 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 376 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 377 | + | return gobject.SignalConnect(x.GoPointer(), "reload", cbRefPtr) | |||
| 378 | + | } | |||
| 379 | + | ||||
| 375 | fcb := func(clsPtr uintptr) { | 380 | fcb := func(clsPtr uintptr) { | ||
| 376 | fa := Resolver{} | 381 | fa := Resolver{} | ||
| 377 | fa.Ptr = clsPtr | 382 | fa.Ptr = clsPtr | ||
| 383 | + | cbFn := *cb | |||
| 378 | 384 | ||||
| 379 | - | cb(fa) | 385 | + | cbFn(fa) |
| 380 | 386 | ||||
| 381 | } | 387 | } | ||
| 382 | - | return gobject.SignalConnect(x.GoPointer(), "reload", purego.NewCallback(fcb)) | 388 | + | cbRefPtr := purego.NewCallback(fcb) |
| 389 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 390 | + | return gobject.SignalConnect(x.GoPointer(), "reload", cbRefPtr) | |||
| 383 | } | 391 | } | ||
| 384 | 392 | ||||
| 385 | var xResolverFreeAddresses func(*glib.List) | 393 | var xResolverFreeAddresses func(*glib.List) | ||
M v4/gio/gsettings.go +48 -16
| @@ -569,9 +569,9 @@ var xSettingsBindWithMapping func(uintptr, string, uintptr, string, SettingsBind | |||||
| 569 | // and that you can have only one binding per object property. | 569 | // and that you can have only one binding per object property. | ||
| 570 | // If you bind the same property twice on the same object, the second | 570 | // If you bind the same property twice on the same object, the second | ||
| 571 | // binding overrides the first one. | 571 | // binding overrides the first one. | ||
| 572 | - | func (x *Settings) BindWithMapping(KeyVar string, ObjectVar *gobject.Object, PropertyVar string, FlagsVar SettingsBindFlags, GetMappingVar SettingsBindGetMapping, SetMappingVar SettingsBindSetMapping, UserDataVar uintptr, DestroyVar glib.DestroyNotify) { | 572 | + | func (x *Settings) BindWithMapping(KeyVar string, ObjectVar *gobject.Object, PropertyVar string, FlagsVar SettingsBindFlags, GetMappingVar *SettingsBindGetMapping, SetMappingVar *SettingsBindSetMapping, UserDataVar uintptr, DestroyVar *glib.DestroyNotify) { |
| 573 | 573 | ||||
| 574 | - | xSettingsBindWithMapping(x.GoPointer(), KeyVar, ObjectVar.GoPointer(), PropertyVar, FlagsVar, purego.NewCallback(GetMappingVar), purego.NewCallback(SetMappingVar), UserDataVar, purego.NewCallback(DestroyVar)) | 574 | + | xSettingsBindWithMapping(x.GoPointer(), KeyVar, ObjectVar.GoPointer(), PropertyVar, FlagsVar, glib.NewCallback(GetMappingVar), glib.NewCallback(SetMappingVar), UserDataVar, glib.NewCallback(DestroyVar)) |
| 575 | 575 | ||||
| 576 | } | 576 | } | ||
| 577 | 577 | ||||
| @@ -844,9 +844,9 @@ var xSettingsGetMapped func(uintptr, string, uintptr, uintptr) uintptr | |||||
| 844 | // to each invocation of @mapping. The final value of that #gpointer is | 844 | // to each invocation of @mapping. The final value of that #gpointer is | ||
| 845 | // what is returned by this function. %NULL is valid; it is returned | 845 | // what is returned by this function. %NULL is valid; it is returned | ||
| 846 | // just as any other value would be. | 846 | // just as any other value would be. | ||
| 847 | - | func (x *Settings) GetMapped(KeyVar string, MappingVar SettingsGetMapping, UserDataVar uintptr) uintptr { | 847 | + | func (x *Settings) GetMapped(KeyVar string, MappingVar *SettingsGetMapping, UserDataVar uintptr) uintptr { |
| 848 | 848 | ||||
| 849 | - | cret := xSettingsGetMapped(x.GoPointer(), KeyVar, purego.NewCallback(MappingVar), UserDataVar) | 849 | + | cret := xSettingsGetMapped(x.GoPointer(), KeyVar, glib.NewCallback(MappingVar), UserDataVar) |
| 850 | return cret | 850 | return cret | ||
| 851 | } | 851 | } | ||
| 852 | 852 | ||||
| @@ -1240,15 +1240,23 @@ func (c *Settings) SetGoPointer(ptr uintptr) { | |||||
| 1240 | // The default handler for this signal invokes the "changed" signal | 1240 | // The default handler for this signal invokes the "changed" signal | ||
| 1241 | // for each affected key. If any other connected handler returns | 1241 | // for each affected key. If any other connected handler returns | ||
| 1242 | // %TRUE then this default functionality will be suppressed. | 1242 | // %TRUE then this default functionality will be suppressed. | ||
| 1243 | - | func (x *Settings) ConnectChangeEvent(cb func(Settings, uintptr, int) bool) uint32 { | 1243 | + | func (x *Settings) ConnectChangeEvent(cb *func(Settings, uintptr, int) bool) uint32 { |
| 1244 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1245 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1246 | + | return gobject.SignalConnect(x.GoPointer(), "change-event", cbRefPtr) | |||
| 1247 | + | } | |||
| 1248 | + | ||||
| 1244 | fcb := func(clsPtr uintptr, KeysVarp uintptr, NKeysVarp int) bool { | 1249 | fcb := func(clsPtr uintptr, KeysVarp uintptr, NKeysVarp int) bool { | ||
| 1245 | fa := Settings{} | 1250 | fa := Settings{} | ||
| 1246 | fa.Ptr = clsPtr | 1251 | fa.Ptr = clsPtr | ||
| 1252 | + | cbFn := *cb | |||
| 1247 | 1253 | ||||
| 1248 | - | return cb(fa, KeysVarp, NKeysVarp) | 1254 | + | return cbFn(fa, KeysVarp, NKeysVarp) |
| 1249 | 1255 | ||||
| 1250 | } | 1256 | } | ||
| 1251 | - | return gobject.SignalConnect(x.GoPointer(), "change-event", purego.NewCallback(fcb)) | 1257 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1258 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1259 | + | return gobject.SignalConnect(x.GoPointer(), "change-event", cbRefPtr) | |||
| 1252 | } | 1260 | } | ||
| 1253 | 1261 | ||||
| 1254 | // The "changed" signal is emitted when a key has potentially changed. | 1262 | // The "changed" signal is emitted when a key has potentially changed. | ||
| @@ -1261,15 +1269,23 @@ func (x *Settings) ConnectChangeEvent(cb func(Settings, uintptr, int) bool) uint | |||||
| 1261 | // | 1269 | // | ||
| 1262 | // Note that @settings only emits this signal if you have read @key at | 1270 | // Note that @settings only emits this signal if you have read @key at | ||
| 1263 | // least once while a signal handler was already connected for @key. | 1271 | // least once while a signal handler was already connected for @key. | ||
| 1264 | - | func (x *Settings) ConnectChanged(cb func(Settings, string)) uint32 { | 1272 | + | func (x *Settings) ConnectChanged(cb *func(Settings, string)) uint32 { |
| 1273 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1274 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1275 | + | return gobject.SignalConnect(x.GoPointer(), "changed", cbRefPtr) | |||
| 1276 | + | } | |||
| 1277 | + | ||||
| 1265 | fcb := func(clsPtr uintptr, KeyVarp string) { | 1278 | fcb := func(clsPtr uintptr, KeyVarp string) { | ||
| 1266 | fa := Settings{} | 1279 | fa := Settings{} | ||
| 1267 | fa.Ptr = clsPtr | 1280 | fa.Ptr = clsPtr | ||
| 1281 | + | cbFn := *cb | |||
| 1268 | 1282 | ||||
| 1269 | - | cb(fa, KeyVarp) | 1283 | + | cbFn(fa, KeyVarp) |
| 1270 | 1284 | ||||
| 1271 | } | 1285 | } | ||
| 1272 | - | return gobject.SignalConnect(x.GoPointer(), "changed", purego.NewCallback(fcb)) | 1286 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1287 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1288 | + | return gobject.SignalConnect(x.GoPointer(), "changed", cbRefPtr) | |||
| 1273 | } | 1289 | } | ||
| 1274 | 1290 | ||||
| 1275 | // The "writable-change-event" signal is emitted once per writability | 1291 | // The "writable-change-event" signal is emitted once per writability | ||
| @@ -1290,15 +1306,23 @@ func (x *Settings) ConnectChanged(cb func(Settings, string)) uint32 { | |||||
| 1290 | // example, a new mandatory setting is introduced). If any other | 1306 | // example, a new mandatory setting is introduced). If any other | ||
| 1291 | // connected handler returns %TRUE then this default functionality | 1307 | // connected handler returns %TRUE then this default functionality | ||
| 1292 | // will be suppressed. | 1308 | // will be suppressed. | ||
| 1293 | - | func (x *Settings) ConnectWritableChangeEvent(cb func(Settings, uint) bool) uint32 { | 1309 | + | func (x *Settings) ConnectWritableChangeEvent(cb *func(Settings, uint) bool) uint32 { |
| 1310 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1311 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1312 | + | return gobject.SignalConnect(x.GoPointer(), "writable-change-event", cbRefPtr) | |||
| 1313 | + | } | |||
| 1314 | + | ||||
| 1294 | fcb := func(clsPtr uintptr, KeyVarp uint) bool { | 1315 | fcb := func(clsPtr uintptr, KeyVarp uint) bool { | ||
| 1295 | fa := Settings{} | 1316 | fa := Settings{} | ||
| 1296 | fa.Ptr = clsPtr | 1317 | fa.Ptr = clsPtr | ||
| 1318 | + | cbFn := *cb | |||
| 1297 | 1319 | ||||
| 1298 | - | return cb(fa, KeyVarp) | 1320 | + | return cbFn(fa, KeyVarp) |
| 1299 | 1321 | ||||
| 1300 | } | 1322 | } | ||
| 1301 | - | return gobject.SignalConnect(x.GoPointer(), "writable-change-event", purego.NewCallback(fcb)) | 1323 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1324 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1325 | + | return gobject.SignalConnect(x.GoPointer(), "writable-change-event", cbRefPtr) | |||
| 1302 | } | 1326 | } | ||
| 1303 | 1327 | ||||
| 1304 | // The "writable-changed" signal is emitted when the writability of a | 1328 | // The "writable-changed" signal is emitted when the writability of a | ||
| @@ -1308,15 +1332,23 @@ func (x *Settings) ConnectWritableChangeEvent(cb func(Settings, uint) bool) uint | |||||
| 1308 | // This signal supports detailed connections. You can connect to the | 1332 | // This signal supports detailed connections. You can connect to the | ||
| 1309 | // detailed signal "writable-changed::x" in order to only receive | 1333 | // detailed signal "writable-changed::x" in order to only receive | ||
| 1310 | // callbacks when the writability of "x" changes. | 1334 | // callbacks when the writability of "x" changes. | ||
| 1311 | - | func (x *Settings) ConnectWritableChanged(cb func(Settings, string)) uint32 { | 1335 | + | func (x *Settings) ConnectWritableChanged(cb *func(Settings, string)) uint32 { |
| 1336 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1337 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1338 | + | return gobject.SignalConnect(x.GoPointer(), "writable-changed", cbRefPtr) | |||
| 1339 | + | } | |||
| 1340 | + | ||||
| 1312 | fcb := func(clsPtr uintptr, KeyVarp string) { | 1341 | fcb := func(clsPtr uintptr, KeyVarp string) { | ||
| 1313 | fa := Settings{} | 1342 | fa := Settings{} | ||
| 1314 | fa.Ptr = clsPtr | 1343 | fa.Ptr = clsPtr | ||
| 1344 | + | cbFn := *cb | |||
| 1315 | 1345 | ||||
| 1316 | - | cb(fa, KeyVarp) | 1346 | + | cbFn(fa, KeyVarp) |
| 1317 | 1347 | ||||
| 1318 | } | 1348 | } | ||
| 1319 | - | return gobject.SignalConnect(x.GoPointer(), "writable-changed", purego.NewCallback(fcb)) | 1349 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1350 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1351 | + | return gobject.SignalConnect(x.GoPointer(), "writable-changed", cbRefPtr) | |||
| 1320 | } | 1352 | } | ||
| 1321 | 1353 | ||||
| 1322 | var xSettingsListRelocatableSchemas func() uintptr | 1354 | var xSettingsListRelocatableSchemas func() uintptr | ||
M v4/gio/gsimpleasyncresult.go +18 -18
| @@ -22,9 +22,9 @@ var xSimpleAsyncReportErrorInIdle func(uintptr, uintptr, uintptr, glib.Quark, in | |||||
| 22 | // Reports an error in an asynchronous function in an idle function by | 22 | // Reports an error in an asynchronous function in an idle function by | ||
| 23 | // directly setting the contents of the #GAsyncResult with the given error | 23 | // directly setting the contents of the #GAsyncResult with the given error | ||
| 24 | // information. | 24 | // information. | ||
| 25 | - | func SimpleAsyncReportErrorInIdle(ObjectVar *gobject.Object, CallbackVar AsyncReadyCallback, UserDataVar uintptr, DomainVar glib.Quark, CodeVar int, FormatVar string, varArgs ...interface{}) { | 25 | + | func SimpleAsyncReportErrorInIdle(ObjectVar *gobject.Object, CallbackVar *AsyncReadyCallback, UserDataVar uintptr, DomainVar glib.Quark, CodeVar int, FormatVar string, varArgs ...interface{}) { |
| 26 | 26 | ||||
| 27 | - | xSimpleAsyncReportErrorInIdle(ObjectVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar, DomainVar, CodeVar, FormatVar, varArgs...) | 27 | + | xSimpleAsyncReportErrorInIdle(ObjectVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar, DomainVar, CodeVar, FormatVar, varArgs...) |
| 28 | 28 | ||||
| 29 | } | 29 | } | ||
| 30 | 30 | ||||
| @@ -33,9 +33,9 @@ var xSimpleAsyncReportGerrorInIdle func(uintptr, uintptr, uintptr, *glib.Error) | |||||
| 33 | // Reports an error in an idle function. Similar to | 33 | // Reports an error in an idle function. Similar to | ||
| 34 | // g_simple_async_report_error_in_idle(), but takes a #GError rather | 34 | // g_simple_async_report_error_in_idle(), but takes a #GError rather | ||
| 35 | // than building a new one. | 35 | // than building a new one. | ||
| 36 | - | func SimpleAsyncReportGerrorInIdle(ObjectVar *gobject.Object, CallbackVar AsyncReadyCallback, UserDataVar uintptr, ErrorVar *glib.Error) { | 36 | + | func SimpleAsyncReportGerrorInIdle(ObjectVar *gobject.Object, CallbackVar *AsyncReadyCallback, UserDataVar uintptr, ErrorVar *glib.Error) { |
| 37 | 37 | ||||
| 38 | - | xSimpleAsyncReportGerrorInIdle(ObjectVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar, ErrorVar) | 38 | + | xSimpleAsyncReportGerrorInIdle(ObjectVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar, ErrorVar) |
| 39 | 39 | ||||
| 40 | } | 40 | } | ||
| 41 | 41 | ||||
| @@ -44,9 +44,9 @@ var xSimpleAsyncReportTakeGerrorInIdle func(uintptr, uintptr, uintptr, *glib.Err | |||||
| 44 | // Reports an error in an idle function. Similar to | 44 | // Reports an error in an idle function. Similar to | ||
| 45 | // g_simple_async_report_gerror_in_idle(), but takes over the caller's | 45 | // g_simple_async_report_gerror_in_idle(), but takes over the caller's | ||
| 46 | // ownership of @error, so the caller does not have to free it any more. | 46 | // ownership of @error, so the caller does not have to free it any more. | ||
| 47 | - | func SimpleAsyncReportTakeGerrorInIdle(ObjectVar *gobject.Object, CallbackVar AsyncReadyCallback, UserDataVar uintptr, ErrorVar *glib.Error) { | 47 | + | func SimpleAsyncReportTakeGerrorInIdle(ObjectVar *gobject.Object, CallbackVar *AsyncReadyCallback, UserDataVar uintptr, ErrorVar *glib.Error) { |
| 48 | 48 | ||||
| 49 | - | xSimpleAsyncReportTakeGerrorInIdle(ObjectVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar, ErrorVar) | 49 | + | xSimpleAsyncReportTakeGerrorInIdle(ObjectVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar, ErrorVar) |
| 50 | 50 | ||||
| 51 | } | 51 | } | ||
| 52 | 52 | ||||
| @@ -244,10 +244,10 @@ var xNewSimpleAsyncResult func(uintptr, uintptr, uintptr, uintptr) uintptr | |||||
| 244 | // probably should) then you should provide the user's cancellable to | 244 | // probably should) then you should provide the user's cancellable to | ||
| 245 | // g_simple_async_result_set_check_cancellable() immediately after | 245 | // g_simple_async_result_set_check_cancellable() immediately after | ||
| 246 | // this function returns. | 246 | // this function returns. | ||
| 247 | - | func NewSimpleAsyncResult(SourceObjectVar *gobject.Object, CallbackVar AsyncReadyCallback, UserDataVar uintptr, SourceTagVar uintptr) *SimpleAsyncResult { | 247 | + | func NewSimpleAsyncResult(SourceObjectVar *gobject.Object, CallbackVar *AsyncReadyCallback, UserDataVar uintptr, SourceTagVar uintptr) *SimpleAsyncResult { |
| 248 | var cls *SimpleAsyncResult | 248 | var cls *SimpleAsyncResult | ||
| 249 | 249 | ||||
| 250 | - | cret := xNewSimpleAsyncResult(SourceObjectVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar, SourceTagVar) | 250 | + | cret := xNewSimpleAsyncResult(SourceObjectVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar, SourceTagVar) |
| 251 | 251 | ||||
| 252 | if cret == 0 { | 252 | if cret == 0 { | ||
| 253 | return nil | 253 | return nil | ||
| @@ -260,10 +260,10 @@ func NewSimpleAsyncResult(SourceObjectVar *gobject.Object, CallbackVar AsyncRead | |||||
| 260 | var xNewSimpleAsyncResultError func(uintptr, uintptr, uintptr, glib.Quark, int, string, ...interface{}) uintptr | 260 | var xNewSimpleAsyncResultError func(uintptr, uintptr, uintptr, glib.Quark, int, string, ...interface{}) uintptr | ||
| 261 | 261 | ||||
| 262 | // Creates a new #GSimpleAsyncResult with a set error. | 262 | // Creates a new #GSimpleAsyncResult with a set error. | ||
| 263 | - | func NewSimpleAsyncResultError(SourceObjectVar *gobject.Object, CallbackVar AsyncReadyCallback, UserDataVar uintptr, DomainVar glib.Quark, CodeVar int, FormatVar string, varArgs ...interface{}) *SimpleAsyncResult { | 263 | + | func NewSimpleAsyncResultError(SourceObjectVar *gobject.Object, CallbackVar *AsyncReadyCallback, UserDataVar uintptr, DomainVar glib.Quark, CodeVar int, FormatVar string, varArgs ...interface{}) *SimpleAsyncResult { |
| 264 | var cls *SimpleAsyncResult | 264 | var cls *SimpleAsyncResult | ||
| 265 | 265 | ||||
| 266 | - | cret := xNewSimpleAsyncResultError(SourceObjectVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar, DomainVar, CodeVar, FormatVar, varArgs...) | 266 | + | cret := xNewSimpleAsyncResultError(SourceObjectVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar, DomainVar, CodeVar, FormatVar, varArgs...) |
| 267 | 267 | ||||
| 268 | if cret == 0 { | 268 | if cret == 0 { | ||
| 269 | return nil | 269 | return nil | ||
| @@ -276,10 +276,10 @@ func NewSimpleAsyncResultError(SourceObjectVar *gobject.Object, CallbackVar Asyn | |||||
| 276 | var xNewSimpleAsyncResultFromError func(uintptr, uintptr, uintptr, *glib.Error) uintptr | 276 | var xNewSimpleAsyncResultFromError func(uintptr, uintptr, uintptr, *glib.Error) uintptr | ||
| 277 | 277 | ||||
| 278 | // Creates a #GSimpleAsyncResult from an error condition. | 278 | // Creates a #GSimpleAsyncResult from an error condition. | ||
| 279 | - | func NewSimpleAsyncResultFromError(SourceObjectVar *gobject.Object, CallbackVar AsyncReadyCallback, UserDataVar uintptr, ErrorVar *glib.Error) *SimpleAsyncResult { | 279 | + | func NewSimpleAsyncResultFromError(SourceObjectVar *gobject.Object, CallbackVar *AsyncReadyCallback, UserDataVar uintptr, ErrorVar *glib.Error) *SimpleAsyncResult { |
| 280 | var cls *SimpleAsyncResult | 280 | var cls *SimpleAsyncResult | ||
| 281 | 281 | ||||
| 282 | - | cret := xNewSimpleAsyncResultFromError(SourceObjectVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar, ErrorVar) | 282 | + | cret := xNewSimpleAsyncResultFromError(SourceObjectVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar, ErrorVar) |
| 283 | 283 | ||||
| 284 | if cret == 0 { | 284 | if cret == 0 { | ||
| 285 | return nil | 285 | return nil | ||
| @@ -293,10 +293,10 @@ var xNewSimpleAsyncResultTakeError func(uintptr, uintptr, uintptr, *glib.Error) | |||||
| 293 | 293 | ||||
| 294 | // Creates a #GSimpleAsyncResult from an error condition, and takes over the | 294 | // Creates a #GSimpleAsyncResult from an error condition, and takes over the | ||
| 295 | // caller's ownership of @error, so the caller does not need to free it anymore. | 295 | // caller's ownership of @error, so the caller does not need to free it anymore. | ||
| 296 | - | func NewSimpleAsyncResultTakeError(SourceObjectVar *gobject.Object, CallbackVar AsyncReadyCallback, UserDataVar uintptr, ErrorVar *glib.Error) *SimpleAsyncResult { | 296 | + | func NewSimpleAsyncResultTakeError(SourceObjectVar *gobject.Object, CallbackVar *AsyncReadyCallback, UserDataVar uintptr, ErrorVar *glib.Error) *SimpleAsyncResult { |
| 297 | var cls *SimpleAsyncResult | 297 | var cls *SimpleAsyncResult | ||
| 298 | 298 | ||||
| 299 | - | cret := xNewSimpleAsyncResultTakeError(SourceObjectVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar, ErrorVar) | 299 | + | cret := xNewSimpleAsyncResultTakeError(SourceObjectVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar, ErrorVar) |
| 300 | 300 | ||||
| 301 | if cret == 0 { | 301 | if cret == 0 { | ||
| 302 | return nil | 302 | return nil | ||
| @@ -399,9 +399,9 @@ var xSimpleAsyncResultRunInThread func(uintptr, uintptr, int, uintptr) | |||||
| 399 | // | 399 | // | ||
| 400 | // Calling this function takes a reference to @simple for as long as | 400 | // Calling this function takes a reference to @simple for as long as | ||
| 401 | // is needed to run the job and report its completion. | 401 | // is needed to run the job and report its completion. | ||
| 402 | - | func (x *SimpleAsyncResult) RunInThread(FuncVar SimpleAsyncThreadFunc, IoPriorityVar int, CancellableVar *Cancellable) { | 402 | + | func (x *SimpleAsyncResult) RunInThread(FuncVar *SimpleAsyncThreadFunc, IoPriorityVar int, CancellableVar *Cancellable) { |
| 403 | 403 | ||||
| 404 | - | xSimpleAsyncResultRunInThread(x.GoPointer(), purego.NewCallback(FuncVar), IoPriorityVar, CancellableVar.GoPointer()) | 404 | + | xSimpleAsyncResultRunInThread(x.GoPointer(), glib.NewCallback(FuncVar), IoPriorityVar, CancellableVar.GoPointer()) |
| 405 | 405 | ||||
| 406 | } | 406 | } | ||
| 407 | 407 | ||||
| @@ -481,9 +481,9 @@ func (x *SimpleAsyncResult) SetOpResGboolean(OpResVar bool) { | |||||
| 481 | var xSimpleAsyncResultSetOpResGpointer func(uintptr, uintptr, uintptr) | 481 | var xSimpleAsyncResultSetOpResGpointer func(uintptr, uintptr, uintptr) | ||
| 482 | 482 | ||||
| 483 | // Sets the operation result within the asynchronous result to a pointer. | 483 | // Sets the operation result within the asynchronous result to a pointer. | ||
| 484 | - | func (x *SimpleAsyncResult) SetOpResGpointer(OpResVar uintptr, DestroyOpResVar glib.DestroyNotify) { | 484 | + | func (x *SimpleAsyncResult) SetOpResGpointer(OpResVar uintptr, DestroyOpResVar *glib.DestroyNotify) { |
| 485 | 485 | ||||
| 486 | - | xSimpleAsyncResultSetOpResGpointer(x.GoPointer(), OpResVar, purego.NewCallback(DestroyOpResVar)) | 486 | + | xSimpleAsyncResultSetOpResGpointer(x.GoPointer(), OpResVar, glib.NewCallback(DestroyOpResVar)) |
| 487 | 487 | ||||
| 488 | } | 488 | } | ||
| 489 | 489 | ||||
M v4/gio/gsimpleproxyresolver.go +2 -2
| @@ -131,9 +131,9 @@ func (x *SimpleProxyResolver) Lookup(UriVar string, CancellableVar *Cancellable) | |||||
| 131 | 131 | ||||
| 132 | // Asynchronous lookup of proxy. See g_proxy_resolver_lookup() for more | 132 | // Asynchronous lookup of proxy. See g_proxy_resolver_lookup() for more | ||
| 133 | // details. | 133 | // details. | ||
| 134 | - | func (x *SimpleProxyResolver) LookupAsync(UriVar string, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 134 | + | func (x *SimpleProxyResolver) LookupAsync(UriVar string, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 135 | 135 | ||||
| 136 | - | XGProxyResolverLookupAsync(x.GoPointer(), UriVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 136 | + | XGProxyResolverLookupAsync(x.GoPointer(), UriVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 137 | 137 | ||||
| 138 | } | 138 | } | ||
| 139 | 139 | ||||
M v4/gio/gsocketaddressenumerator.go +2 -2
| @@ -83,9 +83,9 @@ var xSocketAddressEnumeratorNextAsync func(uintptr, uintptr, uintptr, uintptr) | |||||
| 83 | // g_socket_address_enumerator_next_finish() to get the result. | 83 | // g_socket_address_enumerator_next_finish() to get the result. | ||
| 84 | // | 84 | // | ||
| 85 | // It is an error to call this multiple times before the previous callback has finished. | 85 | // It is an error to call this multiple times before the previous callback has finished. | ||
| 86 | - | func (x *SocketAddressEnumerator) NextAsync(CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 86 | + | func (x *SocketAddressEnumerator) NextAsync(CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 87 | 87 | ||||
| 88 | - | xSocketAddressEnumeratorNextAsync(x.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 88 | + | xSocketAddressEnumeratorNextAsync(x.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 89 | 89 | ||||
| 90 | } | 90 | } | ||
| 91 | 91 | ||||
M v4/gio/gsocketclient.go +19 -11
| @@ -145,9 +145,9 @@ var xSocketClientConnectAsync func(uintptr, uintptr, uintptr, uintptr, uintptr) | |||||
| 145 | // When the operation is finished @callback will be | 145 | // When the operation is finished @callback will be | ||
| 146 | // called. You can then call g_socket_client_connect_finish() to get | 146 | // called. You can then call g_socket_client_connect_finish() to get | ||
| 147 | // the result of the operation. | 147 | // the result of the operation. | ||
| 148 | - | func (x *SocketClient) ConnectAsync(ConnectableVar SocketConnectable, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 148 | + | func (x *SocketClient) ConnectAsync(ConnectableVar SocketConnectable, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 149 | 149 | ||||
| 150 | - | xSocketClientConnectAsync(x.GoPointer(), ConnectableVar.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 150 | + | xSocketClientConnectAsync(x.GoPointer(), ConnectableVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 151 | 151 | ||||
| 152 | } | 152 | } | ||
| 153 | 153 | ||||
| @@ -229,9 +229,9 @@ var xSocketClientConnectToHostAsync func(uintptr, string, uint16, uintptr, uintp | |||||
| 229 | // When the operation is finished @callback will be | 229 | // When the operation is finished @callback will be | ||
| 230 | // called. You can then call g_socket_client_connect_to_host_finish() to get | 230 | // called. You can then call g_socket_client_connect_to_host_finish() to get | ||
| 231 | // the result of the operation. | 231 | // the result of the operation. | ||
| 232 | - | func (x *SocketClient) ConnectToHostAsync(HostAndPortVar string, DefaultPortVar uint16, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 232 | + | func (x *SocketClient) ConnectToHostAsync(HostAndPortVar string, DefaultPortVar uint16, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 233 | 233 | ||||
| 234 | - | xSocketClientConnectToHostAsync(x.GoPointer(), HostAndPortVar, DefaultPortVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 234 | + | xSocketClientConnectToHostAsync(x.GoPointer(), HostAndPortVar, DefaultPortVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 235 | 235 | ||||
| 236 | } | 236 | } | ||
| 237 | 237 | ||||
| @@ -294,9 +294,9 @@ var xSocketClientConnectToServiceAsync func(uintptr, string, string, uintptr, ui | |||||
| 294 | 294 | ||||
| 295 | // This is the asynchronous version of | 295 | // This is the asynchronous version of | ||
| 296 | // g_socket_client_connect_to_service(). | 296 | // g_socket_client_connect_to_service(). | ||
| 297 | - | func (x *SocketClient) ConnectToServiceAsync(DomainVar string, ServiceVar string, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 297 | + | func (x *SocketClient) ConnectToServiceAsync(DomainVar string, ServiceVar string, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 298 | 298 | ||||
| 299 | - | xSocketClientConnectToServiceAsync(x.GoPointer(), DomainVar, ServiceVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 299 | + | xSocketClientConnectToServiceAsync(x.GoPointer(), DomainVar, ServiceVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 300 | 300 | ||||
| 301 | } | 301 | } | ||
| 302 | 302 | ||||
| @@ -369,9 +369,9 @@ var xSocketClientConnectToUriAsync func(uintptr, string, uint16, uintptr, uintpt | |||||
| 369 | // When the operation is finished @callback will be | 369 | // When the operation is finished @callback will be | ||
| 370 | // called. You can then call g_socket_client_connect_to_uri_finish() to get | 370 | // called. You can then call g_socket_client_connect_to_uri_finish() to get | ||
| 371 | // the result of the operation. | 371 | // the result of the operation. | ||
| 372 | - | func (x *SocketClient) ConnectToUriAsync(UriVar string, DefaultPortVar uint16, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 372 | + | func (x *SocketClient) ConnectToUriAsync(UriVar string, DefaultPortVar uint16, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 373 | 373 | ||||
| 374 | - | xSocketClientConnectToUriAsync(x.GoPointer(), UriVar, DefaultPortVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 374 | + | xSocketClientConnectToUriAsync(x.GoPointer(), UriVar, DefaultPortVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 375 | 375 | ||||
| 376 | } | 376 | } | ||
| 377 | 377 | ||||
| @@ -710,15 +710,23 @@ func (c *SocketClient) SetGoPointer(ptr uintptr) { | |||||
| 710 | // | 710 | // | ||
| 711 | // Note that there may be additional #GSocketClientEvent values in | 711 | // Note that there may be additional #GSocketClientEvent values in | ||
| 712 | // the future; unrecognized @event values should be ignored. | 712 | // the future; unrecognized @event values should be ignored. | ||
| 713 | - | func (x *SocketClient) ConnectEvent(cb func(SocketClient, SocketClientEvent, uintptr, uintptr)) uint32 { | 713 | + | func (x *SocketClient) ConnectEvent(cb *func(SocketClient, SocketClientEvent, uintptr, uintptr)) uint32 { |
| 714 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 715 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 716 | + | return gobject.SignalConnect(x.GoPointer(), "event", cbRefPtr) | |||
| 717 | + | } | |||
| 718 | + | ||||
| 714 | fcb := func(clsPtr uintptr, EventVarp SocketClientEvent, ConnectableVarp uintptr, ConnectionVarp uintptr) { | 719 | fcb := func(clsPtr uintptr, EventVarp SocketClientEvent, ConnectableVarp uintptr, ConnectionVarp uintptr) { | ||
| 715 | fa := SocketClient{} | 720 | fa := SocketClient{} | ||
| 716 | fa.Ptr = clsPtr | 721 | fa.Ptr = clsPtr | ||
| 722 | + | cbFn := *cb | |||
| 717 | 723 | ||||
| 718 | - | cb(fa, EventVarp, ConnectableVarp, ConnectionVarp) | 724 | + | cbFn(fa, EventVarp, ConnectableVarp, ConnectionVarp) |
| 719 | 725 | ||||
| 720 | } | 726 | } | ||
| 721 | - | return gobject.SignalConnect(x.GoPointer(), "event", purego.NewCallback(fcb)) | 727 | + | cbRefPtr := purego.NewCallback(fcb) |
| 728 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 729 | + | return gobject.SignalConnect(x.GoPointer(), "event", cbRefPtr) | |||
| 722 | } | 730 | } | ||
| 723 | 731 | ||||
| 724 | func init() { | 732 | func init() { | ||
M v4/gio/gsocketconnection.go +2 -2
| @@ -73,9 +73,9 @@ var xSocketConnectionConnectAsync func(uintptr, uintptr, uintptr, uintptr, uintp | |||||
| 73 | // socket if it is currently set. | 73 | // socket if it is currently set. | ||
| 74 | // | 74 | // | ||
| 75 | // Use g_socket_connection_connect_finish() to retrieve the result. | 75 | // Use g_socket_connection_connect_finish() to retrieve the result. | ||
| 76 | - | func (x *SocketConnection) ConnectAsync(AddressVar *SocketAddress, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 76 | + | func (x *SocketConnection) ConnectAsync(AddressVar *SocketAddress, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 77 | 77 | ||||
| 78 | - | xSocketConnectionConnectAsync(x.GoPointer(), AddressVar.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 78 | + | xSocketConnectionConnectAsync(x.GoPointer(), AddressVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 79 | 79 | ||||
| 80 | } | 80 | } | ||
| 81 | 81 | ||||
M v4/gio/gsocketlistener.go +15 -7
| @@ -106,9 +106,9 @@ var xSocketListenerAcceptAsync func(uintptr, uintptr, uintptr, uintptr) | |||||
| 106 | // When the operation is finished @callback will be | 106 | // When the operation is finished @callback will be | ||
| 107 | // called. You can then call g_socket_listener_accept_finish() | 107 | // called. You can then call g_socket_listener_accept_finish() | ||
| 108 | // to get the result of the operation. | 108 | // to get the result of the operation. | ||
| 109 | - | func (x *SocketListener) AcceptAsync(CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 109 | + | func (x *SocketListener) AcceptAsync(CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 110 | 110 | ||||
| 111 | - | xSocketListenerAcceptAsync(x.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 111 | + | xSocketListenerAcceptAsync(x.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 112 | 112 | ||||
| 113 | } | 113 | } | ||
| 114 | 114 | ||||
| @@ -174,9 +174,9 @@ var xSocketListenerAcceptSocketAsync func(uintptr, uintptr, uintptr, uintptr) | |||||
| 174 | // When the operation is finished @callback will be | 174 | // When the operation is finished @callback will be | ||
| 175 | // called. You can then call g_socket_listener_accept_socket_finish() | 175 | // called. You can then call g_socket_listener_accept_socket_finish() | ||
| 176 | // to get the result of the operation. | 176 | // to get the result of the operation. | ||
| 177 | - | func (x *SocketListener) AcceptSocketAsync(CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 177 | + | func (x *SocketListener) AcceptSocketAsync(CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 178 | 178 | ||||
| 179 | - | xSocketListenerAcceptSocketAsync(x.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 179 | + | xSocketListenerAcceptSocketAsync(x.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 180 | 180 | ||||
| 181 | } | 181 | } | ||
| 182 | 182 | ||||
| @@ -345,15 +345,23 @@ func (c *SocketListener) SetGoPointer(ptr uintptr) { | |||||
| 345 | // Note that when @listener is used to listen on both IPv4 and | 345 | // Note that when @listener is used to listen on both IPv4 and | ||
| 346 | // IPv6, a separate set of signals will be emitted for each, and | 346 | // IPv6, a separate set of signals will be emitted for each, and | ||
| 347 | // the order they happen in is undefined. | 347 | // the order they happen in is undefined. | ||
| 348 | - | func (x *SocketListener) ConnectEvent(cb func(SocketListener, SocketListenerEvent, uintptr)) uint32 { | 348 | + | func (x *SocketListener) ConnectEvent(cb *func(SocketListener, SocketListenerEvent, uintptr)) uint32 { |
| 349 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 350 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 351 | + | return gobject.SignalConnect(x.GoPointer(), "event", cbRefPtr) | |||
| 352 | + | } | |||
| 353 | + | ||||
| 349 | fcb := func(clsPtr uintptr, EventVarp SocketListenerEvent, SocketVarp uintptr) { | 354 | fcb := func(clsPtr uintptr, EventVarp SocketListenerEvent, SocketVarp uintptr) { | ||
| 350 | fa := SocketListener{} | 355 | fa := SocketListener{} | ||
| 351 | fa.Ptr = clsPtr | 356 | fa.Ptr = clsPtr | ||
| 357 | + | cbFn := *cb | |||
| 352 | 358 | ||||
| 353 | - | cb(fa, EventVarp, SocketVarp) | 359 | + | cbFn(fa, EventVarp, SocketVarp) |
| 354 | 360 | ||||
| 355 | } | 361 | } | ||
| 356 | - | return gobject.SignalConnect(x.GoPointer(), "event", purego.NewCallback(fcb)) | 362 | + | cbRefPtr := purego.NewCallback(fcb) |
| 363 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 364 | + | return gobject.SignalConnect(x.GoPointer(), "event", cbRefPtr) | |||
| 357 | } | 365 | } | ||
| 358 | 366 | ||||
| 359 | func init() { | 367 | func init() { | ||
M v4/gio/gsocketservice.go +12 -3
| @@ -6,6 +6,7 @@ import ( | |||||
| 6 | 6 | ||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 9 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 10 | ) | 11 | ) | ||
| 11 | 12 | ||||
| @@ -148,15 +149,23 @@ func (c *SocketService) SetGoPointer(ptr uintptr) { | |||||
| 148 | // | 149 | // | ||
| 149 | // @connection will be unreffed once the signal handler returns, | 150 | // @connection will be unreffed once the signal handler returns, | ||
| 150 | // so you need to ref it yourself if you are planning to use it. | 151 | // so you need to ref it yourself if you are planning to use it. | ||
| 151 | - | func (x *SocketService) ConnectIncoming(cb func(SocketService, uintptr, uintptr) bool) uint32 { | 152 | + | func (x *SocketService) ConnectIncoming(cb *func(SocketService, uintptr, uintptr) bool) uint32 { |
| 153 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 154 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 155 | + | return gobject.SignalConnect(x.GoPointer(), "incoming", cbRefPtr) | |||
| 156 | + | } | |||
| 157 | + | ||||
| 152 | fcb := func(clsPtr uintptr, ConnectionVarp uintptr, SourceObjectVarp uintptr) bool { | 158 | fcb := func(clsPtr uintptr, ConnectionVarp uintptr, SourceObjectVarp uintptr) bool { | ||
| 153 | fa := SocketService{} | 159 | fa := SocketService{} | ||
| 154 | fa.Ptr = clsPtr | 160 | fa.Ptr = clsPtr | ||
| 161 | + | cbFn := *cb | |||
| 155 | 162 | ||||
| 156 | - | return cb(fa, ConnectionVarp, SourceObjectVarp) | 163 | + | return cbFn(fa, ConnectionVarp, SourceObjectVarp) |
| 157 | 164 | ||||
| 158 | } | 165 | } | ||
| 159 | - | return gobject.SignalConnect(x.GoPointer(), "incoming", purego.NewCallback(fcb)) | 166 | + | cbRefPtr := purego.NewCallback(fcb) |
| 167 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 168 | + | return gobject.SignalConnect(x.GoPointer(), "incoming", cbRefPtr) | |||
| 160 | } | 169 | } | ||
| 161 | 170 | ||||
| 162 | func init() { | 171 | func init() { | ||
M v4/gio/gtask.go +16 -16
| @@ -569,10 +569,10 @@ var xNewTask func(uintptr, uintptr, uintptr, uintptr) uintptr | |||||
| 569 | // other objects that the task depends on have been destroyed. If you | 569 | // other objects that the task depends on have been destroyed. If you | ||
| 570 | // do not want this behavior, you can use | 570 | // do not want this behavior, you can use | ||
| 571 | // g_task_set_check_cancellable() to change it. | 571 | // g_task_set_check_cancellable() to change it. | ||
| 572 | - | func NewTask(SourceObjectVar *gobject.Object, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, CallbackDataVar uintptr) *Task { | 572 | + | func NewTask(SourceObjectVar *gobject.Object, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, CallbackDataVar uintptr) *Task { |
| 573 | var cls *Task | 573 | var cls *Task | ||
| 574 | 574 | ||||
| 575 | - | cret := xNewTask(SourceObjectVar.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), CallbackDataVar) | 575 | + | cret := xNewTask(SourceObjectVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), CallbackDataVar) |
| 576 | 576 | ||||
| 577 | if cret == 0 { | 577 | if cret == 0 { | ||
| 578 | return nil | 578 | return nil | ||
| @@ -593,9 +593,9 @@ var xTaskAttachSource func(uintptr, *glib.Source, uintptr) | |||||
| 593 | // g_task_set_name()), if one has been set. | 593 | // g_task_set_name()), if one has been set. | ||
| 594 | // | 594 | // | ||
| 595 | // This takes a reference on @task until @source is destroyed. | 595 | // This takes a reference on @task until @source is destroyed. | ||
| 596 | - | func (x *Task) AttachSource(SourceVar *glib.Source, CallbackVar glib.SourceFunc) { | 596 | + | func (x *Task) AttachSource(SourceVar *glib.Source, CallbackVar *glib.SourceFunc) { |
| 597 | 597 | ||||
| 598 | - | xTaskAttachSource(x.GoPointer(), SourceVar, purego.NewCallback(CallbackVar)) | 598 | + | xTaskAttachSource(x.GoPointer(), SourceVar, glib.NewCallback(CallbackVar)) |
| 599 | 599 | ||||
| 600 | } | 600 | } | ||
| 601 | 601 | ||||
| @@ -896,9 +896,9 @@ var xTaskReturnPointer func(uintptr, uintptr, uintptr) | |||||
| 896 | // g_task_return_pointer(), you cannot assume that @result is still | 896 | // g_task_return_pointer(), you cannot assume that @result is still | ||
| 897 | // valid after calling this, unless you are still holding another | 897 | // valid after calling this, unless you are still holding another | ||
| 898 | // reference on it. | 898 | // reference on it. | ||
| 899 | - | func (x *Task) ReturnPointer(ResultVar uintptr, ResultDestroyVar glib.DestroyNotify) { | 899 | + | func (x *Task) ReturnPointer(ResultVar uintptr, ResultDestroyVar *glib.DestroyNotify) { |
| 900 | 900 | ||||
| 901 | - | xTaskReturnPointer(x.GoPointer(), ResultVar, purego.NewCallback(ResultDestroyVar)) | 901 | + | xTaskReturnPointer(x.GoPointer(), ResultVar, glib.NewCallback(ResultDestroyVar)) |
| 902 | 902 | ||||
| 903 | } | 903 | } | ||
| 904 | 904 | ||||
| @@ -932,9 +932,9 @@ var xTaskRunInThread func(uintptr, uintptr) | |||||
| 932 | // do this. If you have a very large number of tasks to run (several tens of | 932 | // do this. If you have a very large number of tasks to run (several tens of | ||
| 933 | // tasks), but don't want them to all run at once, you should only queue a | 933 | // tasks), but don't want them to all run at once, you should only queue a | ||
| 934 | // limited number of them (around ten) at a time. | 934 | // limited number of them (around ten) at a time. | ||
| 935 | - | func (x *Task) RunInThread(TaskFuncVar TaskThreadFunc) { | 935 | + | func (x *Task) RunInThread(TaskFuncVar *TaskThreadFunc) { |
| 936 | 936 | ||||
| 937 | - | xTaskRunInThread(x.GoPointer(), purego.NewCallback(TaskFuncVar)) | 937 | + | xTaskRunInThread(x.GoPointer(), glib.NewCallback(TaskFuncVar)) |
| 938 | 938 | ||||
| 939 | } | 939 | } | ||
| 940 | 940 | ||||
| @@ -956,9 +956,9 @@ var xTaskRunInThreadSync func(uintptr, uintptr) | |||||
| 956 | // always do this. If you have a very large number of tasks to run, | 956 | // always do this. If you have a very large number of tasks to run, | ||
| 957 | // but don't want them to all run at once, you should only queue a | 957 | // but don't want them to all run at once, you should only queue a | ||
| 958 | // limited number of them at a time. | 958 | // limited number of them at a time. | ||
| 959 | - | func (x *Task) RunInThreadSync(TaskFuncVar TaskThreadFunc) { | 959 | + | func (x *Task) RunInThreadSync(TaskFuncVar *TaskThreadFunc) { |
| 960 | 960 | ||||
| 961 | - | xTaskRunInThreadSync(x.GoPointer(), purego.NewCallback(TaskFuncVar)) | 961 | + | xTaskRunInThreadSync(x.GoPointer(), glib.NewCallback(TaskFuncVar)) |
| 962 | 962 | ||||
| 963 | } | 963 | } | ||
| 964 | 964 | ||||
| @@ -1076,9 +1076,9 @@ func (x *Task) SetSourceTag(SourceTagVar uintptr) { | |||||
| 1076 | var xTaskSetTaskData func(uintptr, uintptr, uintptr) | 1076 | var xTaskSetTaskData func(uintptr, uintptr, uintptr) | ||
| 1077 | 1077 | ||||
| 1078 | // Sets @task's task data (freeing the existing task data, if any). | 1078 | // Sets @task's task data (freeing the existing task data, if any). | ||
| 1079 | - | func (x *Task) SetTaskData(TaskDataVar uintptr, TaskDataDestroyVar glib.DestroyNotify) { | 1079 | + | func (x *Task) SetTaskData(TaskDataVar uintptr, TaskDataDestroyVar *glib.DestroyNotify) { |
| 1080 | 1080 | ||||
| 1081 | - | xTaskSetTaskData(x.GoPointer(), TaskDataVar, purego.NewCallback(TaskDataDestroyVar)) | 1081 | + | xTaskSetTaskData(x.GoPointer(), TaskDataVar, glib.NewCallback(TaskDataDestroyVar)) |
| 1082 | 1082 | ||||
| 1083 | } | 1083 | } | ||
| 1084 | 1084 | ||||
| @@ -1147,9 +1147,9 @@ var xTaskReportError func(uintptr, uintptr, uintptr, uintptr, *glib.Error) | |||||
| 1147 | // wrapper method, and deal with it appropriately if so. | 1147 | // wrapper method, and deal with it appropriately if so. | ||
| 1148 | // | 1148 | // | ||
| 1149 | // See also g_task_report_new_error(). | 1149 | // See also g_task_report_new_error(). | ||
| 1150 | - | func TaskReportError(SourceObjectVar *gobject.Object, CallbackVar AsyncReadyCallback, CallbackDataVar uintptr, SourceTagVar uintptr, ErrorVar *glib.Error) { | 1150 | + | func TaskReportError(SourceObjectVar *gobject.Object, CallbackVar *AsyncReadyCallback, CallbackDataVar uintptr, SourceTagVar uintptr, ErrorVar *glib.Error) { |
| 1151 | 1151 | ||||
| 1152 | - | xTaskReportError(SourceObjectVar.GoPointer(), purego.NewCallback(CallbackVar), CallbackDataVar, SourceTagVar, ErrorVar) | 1152 | + | xTaskReportError(SourceObjectVar.GoPointer(), glib.NewCallback(CallbackVar), CallbackDataVar, SourceTagVar, ErrorVar) |
| 1153 | 1153 | ||||
| 1154 | } | 1154 | } | ||
| 1155 | 1155 | ||||
| @@ -1164,9 +1164,9 @@ var xTaskReportNewError func(uintptr, uintptr, uintptr, uintptr, glib.Quark, int | |||||
| 1164 | // appropriately if so. | 1164 | // appropriately if so. | ||
| 1165 | // | 1165 | // | ||
| 1166 | // See also g_task_report_error(). | 1166 | // See also g_task_report_error(). | ||
| 1167 | - | func TaskReportNewError(SourceObjectVar *gobject.Object, CallbackVar AsyncReadyCallback, CallbackDataVar uintptr, SourceTagVar uintptr, DomainVar glib.Quark, CodeVar int, FormatVar string, varArgs ...interface{}) { | 1167 | + | func TaskReportNewError(SourceObjectVar *gobject.Object, CallbackVar *AsyncReadyCallback, CallbackDataVar uintptr, SourceTagVar uintptr, DomainVar glib.Quark, CodeVar int, FormatVar string, varArgs ...interface{}) { |
| 1168 | 1168 | ||||
| 1169 | - | xTaskReportNewError(SourceObjectVar.GoPointer(), purego.NewCallback(CallbackVar), CallbackDataVar, SourceTagVar, DomainVar, CodeVar, FormatVar, varArgs...) | 1169 | + | xTaskReportNewError(SourceObjectVar.GoPointer(), glib.NewCallback(CallbackVar), CallbackDataVar, SourceTagVar, DomainVar, CodeVar, FormatVar, varArgs...) |
| 1170 | 1170 | ||||
| 1171 | } | 1171 | } | ||
| 1172 | 1172 | ||||
M v4/gio/gthreadedsocketservice.go +12 -3
| @@ -6,6 +6,7 @@ import ( | |||||
| 6 | 6 | ||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 9 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 10 | ) | 11 | ) | ||
| 11 | 12 | ||||
| @@ -78,15 +79,23 @@ func (c *ThreadedSocketService) SetGoPointer(ptr uintptr) { | |||||
| 78 | // incoming connection. This thread is dedicated to handling | 79 | // incoming connection. This thread is dedicated to handling | ||
| 79 | // @connection and may perform blocking IO. The signal handler need | 80 | // @connection and may perform blocking IO. The signal handler need | ||
| 80 | // not return until the connection is closed. | 81 | // not return until the connection is closed. | ||
| 81 | - | func (x *ThreadedSocketService) ConnectRun(cb func(ThreadedSocketService, uintptr, uintptr) bool) uint32 { | 82 | + | func (x *ThreadedSocketService) ConnectRun(cb *func(ThreadedSocketService, uintptr, uintptr) bool) uint32 { |
| 83 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 84 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 85 | + | return gobject.SignalConnect(x.GoPointer(), "run", cbRefPtr) | |||
| 86 | + | } | |||
| 87 | + | ||||
| 82 | fcb := func(clsPtr uintptr, ConnectionVarp uintptr, SourceObjectVarp uintptr) bool { | 88 | fcb := func(clsPtr uintptr, ConnectionVarp uintptr, SourceObjectVarp uintptr) bool { | ||
| 83 | fa := ThreadedSocketService{} | 89 | fa := ThreadedSocketService{} | ||
| 84 | fa.Ptr = clsPtr | 90 | fa.Ptr = clsPtr | ||
| 91 | + | cbFn := *cb | |||
| 85 | 92 | ||||
| 86 | - | return cb(fa, ConnectionVarp, SourceObjectVarp) | 93 | + | return cbFn(fa, ConnectionVarp, SourceObjectVarp) |
| 87 | 94 | ||||
| 88 | } | 95 | } | ||
| 89 | - | return gobject.SignalConnect(x.GoPointer(), "run", purego.NewCallback(fcb)) | 96 | + | cbRefPtr := purego.NewCallback(fcb) |
| 97 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 98 | + | return gobject.SignalConnect(x.GoPointer(), "run", cbRefPtr) | |||
| 90 | } | 99 | } | ||
| 91 | 100 | ||||
| 92 | func init() { | 101 | func init() { | ||
M v4/gio/gtlsconnection.go +13 -5
| @@ -289,9 +289,9 @@ var xTlsConnectionHandshakeAsync func(uintptr, int, uintptr, uintptr, uintptr) | |||||
| 289 | 289 | ||||
| 290 | // Asynchronously performs a TLS handshake on @conn. See | 290 | // Asynchronously performs a TLS handshake on @conn. See | ||
| 291 | // g_tls_connection_handshake() for more information. | 291 | // g_tls_connection_handshake() for more information. | ||
| 292 | - | func (x *TlsConnection) HandshakeAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 292 | + | func (x *TlsConnection) HandshakeAsync(IoPriorityVar int, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 293 | 293 | ||||
| 294 | - | xTlsConnectionHandshakeAsync(x.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 294 | + | xTlsConnectionHandshakeAsync(x.GoPointer(), IoPriorityVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 295 | 295 | ||||
| 296 | } | 296 | } | ||
| 297 | 297 | ||||
| @@ -499,15 +499,23 @@ func (c *TlsConnection) SetGoPointer(ptr uintptr) { | |||||
| 499 | // If you are doing I/O in another thread, you do not | 499 | // If you are doing I/O in another thread, you do not | ||
| 500 | // need to worry about this, and can simply block in the signal | 500 | // need to worry about this, and can simply block in the signal | ||
| 501 | // handler until the UI thread returns an answer. | 501 | // handler until the UI thread returns an answer. | ||
| 502 | - | func (x *TlsConnection) ConnectAcceptCertificate(cb func(TlsConnection, uintptr, TlsCertificateFlags) bool) uint32 { | 502 | + | func (x *TlsConnection) ConnectAcceptCertificate(cb *func(TlsConnection, uintptr, TlsCertificateFlags) bool) uint32 { |
| 503 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 504 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 505 | + | return gobject.SignalConnect(x.GoPointer(), "accept-certificate", cbRefPtr) | |||
| 506 | + | } | |||
| 507 | + | ||||
| 503 | fcb := func(clsPtr uintptr, PeerCertVarp uintptr, ErrorsVarp TlsCertificateFlags) bool { | 508 | fcb := func(clsPtr uintptr, PeerCertVarp uintptr, ErrorsVarp TlsCertificateFlags) bool { | ||
| 504 | fa := TlsConnection{} | 509 | fa := TlsConnection{} | ||
| 505 | fa.Ptr = clsPtr | 510 | fa.Ptr = clsPtr | ||
| 511 | + | cbFn := *cb | |||
| 506 | 512 | ||||
| 507 | - | return cb(fa, PeerCertVarp, ErrorsVarp) | 513 | + | return cbFn(fa, PeerCertVarp, ErrorsVarp) |
| 508 | 514 | ||||
| 509 | } | 515 | } | ||
| 510 | - | return gobject.SignalConnect(x.GoPointer(), "accept-certificate", purego.NewCallback(fcb)) | 516 | + | cbRefPtr := purego.NewCallback(fcb) |
| 517 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 518 | + | return gobject.SignalConnect(x.GoPointer(), "accept-certificate", cbRefPtr) | |||
| 511 | } | 519 | } | ||
| 512 | 520 | ||||
| 513 | func init() { | 521 | func init() { | ||
M v4/gio/gtlsdatabase.go +8 -8
| @@ -110,9 +110,9 @@ var xTlsDatabaseLookupCertificateForHandleAsync func(uintptr, string, uintptr, T | |||||
| 110 | 110 | ||||
| 111 | // Asynchronously look up a certificate by its handle in the database. See | 111 | // Asynchronously look up a certificate by its handle in the database. See | ||
| 112 | // g_tls_database_lookup_certificate_for_handle() for more information. | 112 | // g_tls_database_lookup_certificate_for_handle() for more information. | ||
| 113 | - | func (x *TlsDatabase) LookupCertificateForHandleAsync(HandleVar string, InteractionVar *TlsInteraction, FlagsVar TlsDatabaseLookupFlags, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 113 | + | func (x *TlsDatabase) LookupCertificateForHandleAsync(HandleVar string, InteractionVar *TlsInteraction, FlagsVar TlsDatabaseLookupFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 114 | 114 | ||||
| 115 | - | xTlsDatabaseLookupCertificateForHandleAsync(x.GoPointer(), HandleVar, InteractionVar.GoPointer(), FlagsVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 115 | + | xTlsDatabaseLookupCertificateForHandleAsync(x.GoPointer(), HandleVar, InteractionVar.GoPointer(), FlagsVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 116 | 116 | ||||
| 117 | } | 117 | } | ||
| 118 | 118 | ||||
| @@ -185,9 +185,9 @@ var xTlsDatabaseLookupCertificateIssuerAsync func(uintptr, uintptr, uintptr, Tls | |||||
| 185 | 185 | ||||
| 186 | // Asynchronously look up the issuer of @certificate in the database. See | 186 | // Asynchronously look up the issuer of @certificate in the database. See | ||
| 187 | // g_tls_database_lookup_certificate_issuer() for more information. | 187 | // g_tls_database_lookup_certificate_issuer() for more information. | ||
| 188 | - | func (x *TlsDatabase) LookupCertificateIssuerAsync(CertificateVar *TlsCertificate, InteractionVar *TlsInteraction, FlagsVar TlsDatabaseLookupFlags, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 188 | + | func (x *TlsDatabase) LookupCertificateIssuerAsync(CertificateVar *TlsCertificate, InteractionVar *TlsInteraction, FlagsVar TlsDatabaseLookupFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 189 | 189 | ||||
| 190 | - | xTlsDatabaseLookupCertificateIssuerAsync(x.GoPointer(), CertificateVar.GoPointer(), InteractionVar.GoPointer(), FlagsVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 190 | + | xTlsDatabaseLookupCertificateIssuerAsync(x.GoPointer(), CertificateVar.GoPointer(), InteractionVar.GoPointer(), FlagsVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 191 | 191 | ||||
| 192 | } | 192 | } | ||
| 193 | 193 | ||||
| @@ -238,9 +238,9 @@ var xTlsDatabaseLookupCertificatesIssuedByAsync func(uintptr, uintptr, uintptr, | |||||
| 238 | // The database may choose to hold a reference to the issuer byte array for the duration | 238 | // The database may choose to hold a reference to the issuer byte array for the duration | ||
| 239 | // of of this asynchronous operation. The byte array should not be modified during | 239 | // of of this asynchronous operation. The byte array should not be modified during | ||
| 240 | // this time. | 240 | // this time. | ||
| 241 | - | func (x *TlsDatabase) LookupCertificatesIssuedByAsync(IssuerRawDnVar uintptr, InteractionVar *TlsInteraction, FlagsVar TlsDatabaseLookupFlags, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 241 | + | func (x *TlsDatabase) LookupCertificatesIssuedByAsync(IssuerRawDnVar uintptr, InteractionVar *TlsInteraction, FlagsVar TlsDatabaseLookupFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 242 | 242 | ||||
| 243 | - | xTlsDatabaseLookupCertificatesIssuedByAsync(x.GoPointer(), IssuerRawDnVar, InteractionVar.GoPointer(), FlagsVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 243 | + | xTlsDatabaseLookupCertificatesIssuedByAsync(x.GoPointer(), IssuerRawDnVar, InteractionVar.GoPointer(), FlagsVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 244 | 244 | ||||
| 245 | } | 245 | } | ||
| 246 | 246 | ||||
| @@ -337,9 +337,9 @@ var xTlsDatabaseVerifyChainAsync func(uintptr, uintptr, string, uintptr, uintptr | |||||
| 337 | // Asynchronously determines the validity of a certificate chain after | 337 | // Asynchronously determines the validity of a certificate chain after | ||
| 338 | // looking up and adding any missing certificates to the chain. See | 338 | // looking up and adding any missing certificates to the chain. See | ||
| 339 | // g_tls_database_verify_chain() for more information. | 339 | // g_tls_database_verify_chain() for more information. | ||
| 340 | - | func (x *TlsDatabase) VerifyChainAsync(ChainVar *TlsCertificate, PurposeVar string, IdentityVar SocketConnectable, InteractionVar *TlsInteraction, FlagsVar TlsDatabaseVerifyFlags, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 340 | + | func (x *TlsDatabase) VerifyChainAsync(ChainVar *TlsCertificate, PurposeVar string, IdentityVar SocketConnectable, InteractionVar *TlsInteraction, FlagsVar TlsDatabaseVerifyFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 341 | 341 | ||||
| 342 | - | xTlsDatabaseVerifyChainAsync(x.GoPointer(), ChainVar.GoPointer(), PurposeVar, IdentityVar.GoPointer(), InteractionVar.GoPointer(), FlagsVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 342 | + | xTlsDatabaseVerifyChainAsync(x.GoPointer(), ChainVar.GoPointer(), PurposeVar, IdentityVar.GoPointer(), InteractionVar.GoPointer(), FlagsVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 343 | 343 | ||||
| 344 | } | 344 | } | ||
| 345 | 345 | ||||
M v4/gio/gtlsinteraction.go +4 -4
| @@ -114,9 +114,9 @@ var xTlsInteractionAskPasswordAsync func(uintptr, uintptr, uintptr, uintptr, uin | |||||
| 114 | // not support immediate cancellation. | 114 | // not support immediate cancellation. | ||
| 115 | // | 115 | // | ||
| 116 | // Certain implementations may not support immediate cancellation. | 116 | // Certain implementations may not support immediate cancellation. | ||
| 117 | - | func (x *TlsInteraction) AskPasswordAsync(PasswordVar *TlsPassword, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 117 | + | func (x *TlsInteraction) AskPasswordAsync(PasswordVar *TlsPassword, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 118 | 118 | ||||
| 119 | - | xTlsInteractionAskPasswordAsync(x.GoPointer(), PasswordVar.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 119 | + | xTlsInteractionAskPasswordAsync(x.GoPointer(), PasswordVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 120 | 120 | ||||
| 121 | } | 121 | } | ||
| 122 | 122 | ||||
| @@ -246,9 +246,9 @@ var xTlsInteractionRequestCertificateAsync func(uintptr, uintptr, TlsCertificate | |||||
| 246 | // also choose to provide a certificate from elsewhere. @callback will be called | 246 | // also choose to provide a certificate from elsewhere. @callback will be called | ||
| 247 | // when the operation completes. Alternatively the user may abort this certificate | 247 | // when the operation completes. Alternatively the user may abort this certificate | ||
| 248 | // request, which will usually abort the TLS connection. | 248 | // request, which will usually abort the TLS connection. | ||
| 249 | - | func (x *TlsInteraction) RequestCertificateAsync(ConnectionVar *TlsConnection, FlagsVar TlsCertificateRequestFlags, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 249 | + | func (x *TlsInteraction) RequestCertificateAsync(ConnectionVar *TlsConnection, FlagsVar TlsCertificateRequestFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 250 | 250 | ||||
| 251 | - | xTlsInteractionRequestCertificateAsync(x.GoPointer(), ConnectionVar.GoPointer(), FlagsVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 251 | + | xTlsInteractionRequestCertificateAsync(x.GoPointer(), ConnectionVar.GoPointer(), FlagsVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 252 | 252 | ||||
| 253 | } | 253 | } | ||
| 254 | 254 | ||||
M v4/gio/gtlspassword.go +2 -2
| @@ -141,9 +141,9 @@ var xTlsPasswordSetValueFull func(uintptr, uintptr, int, uintptr) | |||||
| 141 | // @length if using a nul-terminated password, and @length will be | 141 | // @length if using a nul-terminated password, and @length will be | ||
| 142 | // calculated automatically. (Note that the terminating nul is not | 142 | // calculated automatically. (Note that the terminating nul is not | ||
| 143 | // considered part of the password in this case.) | 143 | // considered part of the password in this case.) | ||
| 144 | - | func (x *TlsPassword) SetValueFull(ValueVar uintptr, LengthVar int, DestroyVar glib.DestroyNotify) { | 144 | + | func (x *TlsPassword) SetValueFull(ValueVar uintptr, LengthVar int, DestroyVar *glib.DestroyNotify) { |
| 145 | 145 | ||||
| 146 | - | xTlsPasswordSetValueFull(x.GoPointer(), ValueVar, LengthVar, purego.NewCallback(DestroyVar)) | 146 | + | xTlsPasswordSetValueFull(x.GoPointer(), ValueVar, LengthVar, glib.NewCallback(DestroyVar)) |
| 147 | 147 | ||||
| 148 | } | 148 | } | ||
| 149 | 149 | ||||
M v4/gio/gunixconnection.go +4 -4
| @@ -93,9 +93,9 @@ var xUnixConnectionReceiveCredentialsAsync func(uintptr, uintptr, uintptr, uintp | |||||
| 93 | // | 93 | // | ||
| 94 | // When the operation is finished, @callback will be called. You can then call | 94 | // When the operation is finished, @callback will be called. You can then call | ||
| 95 | // g_unix_connection_receive_credentials_finish() to get the result of the operation. | 95 | // g_unix_connection_receive_credentials_finish() to get the result of the operation. | ||
| 96 | - | func (x *UnixConnection) ReceiveCredentialsAsync(CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 96 | + | func (x *UnixConnection) ReceiveCredentialsAsync(CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 97 | 97 | ||||
| 98 | - | xUnixConnectionReceiveCredentialsAsync(x.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 98 | + | xUnixConnectionReceiveCredentialsAsync(x.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 99 | 99 | ||||
| 100 | } | 100 | } | ||
| 101 | 101 | ||||
| @@ -182,9 +182,9 @@ var xUnixConnectionSendCredentialsAsync func(uintptr, uintptr, uintptr, uintptr) | |||||
| 182 | // | 182 | // | ||
| 183 | // When the operation is finished, @callback will be called. You can then call | 183 | // When the operation is finished, @callback will be called. You can then call | ||
| 184 | // g_unix_connection_send_credentials_finish() to get the result of the operation. | 184 | // g_unix_connection_send_credentials_finish() to get the result of the operation. | ||
| 185 | - | func (x *UnixConnection) SendCredentialsAsync(CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 185 | + | func (x *UnixConnection) SendCredentialsAsync(CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 186 | 186 | ||||
| 187 | - | xUnixConnectionSendCredentialsAsync(x.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 187 | + | xUnixConnectionSendCredentialsAsync(x.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 188 | 188 | ||||
| 189 | } | 189 | } | ||
| 190 | 190 | ||||
M v4/gio/gunixmounts.go +22 -6
| @@ -525,27 +525,43 @@ func (c *UnixMountMonitor) SetGoPointer(ptr uintptr) { | |||||
| 525 | } | 525 | } | ||
| 526 | 526 | ||||
| 527 | // Emitted when the unix mount points have changed. | 527 | // Emitted when the unix mount points have changed. | ||
| 528 | - | func (x *UnixMountMonitor) ConnectMountpointsChanged(cb func(UnixMountMonitor)) uint32 { | 528 | + | func (x *UnixMountMonitor) ConnectMountpointsChanged(cb *func(UnixMountMonitor)) uint32 { |
| 529 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 530 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 531 | + | return gobject.SignalConnect(x.GoPointer(), "mountpoints-changed", cbRefPtr) | |||
| 532 | + | } | |||
| 533 | + | ||||
| 529 | fcb := func(clsPtr uintptr) { | 534 | fcb := func(clsPtr uintptr) { | ||
| 530 | fa := UnixMountMonitor{} | 535 | fa := UnixMountMonitor{} | ||
| 531 | fa.Ptr = clsPtr | 536 | fa.Ptr = clsPtr | ||
| 537 | + | cbFn := *cb | |||
| 532 | 538 | ||||
| 533 | - | cb(fa) | 539 | + | cbFn(fa) |
| 534 | 540 | ||||
| 535 | } | 541 | } | ||
| 536 | - | return gobject.SignalConnect(x.GoPointer(), "mountpoints-changed", purego.NewCallback(fcb)) | 542 | + | cbRefPtr := purego.NewCallback(fcb) |
| 543 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 544 | + | return gobject.SignalConnect(x.GoPointer(), "mountpoints-changed", cbRefPtr) | |||
| 537 | } | 545 | } | ||
| 538 | 546 | ||||
| 539 | // Emitted when the unix mounts have changed. | 547 | // Emitted when the unix mounts have changed. | ||
| 540 | - | func (x *UnixMountMonitor) ConnectMountsChanged(cb func(UnixMountMonitor)) uint32 { | 548 | + | func (x *UnixMountMonitor) ConnectMountsChanged(cb *func(UnixMountMonitor)) uint32 { |
| 549 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 550 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 551 | + | return gobject.SignalConnect(x.GoPointer(), "mounts-changed", cbRefPtr) | |||
| 552 | + | } | |||
| 553 | + | ||||
| 541 | fcb := func(clsPtr uintptr) { | 554 | fcb := func(clsPtr uintptr) { | ||
| 542 | fa := UnixMountMonitor{} | 555 | fa := UnixMountMonitor{} | ||
| 543 | fa.Ptr = clsPtr | 556 | fa.Ptr = clsPtr | ||
| 557 | + | cbFn := *cb | |||
| 544 | 558 | ||||
| 545 | - | cb(fa) | 559 | + | cbFn(fa) |
| 546 | 560 | ||||
| 547 | } | 561 | } | ||
| 548 | - | return gobject.SignalConnect(x.GoPointer(), "mounts-changed", purego.NewCallback(fcb)) | 562 | + | cbRefPtr := purego.NewCallback(fcb) |
| 563 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 564 | + | return gobject.SignalConnect(x.GoPointer(), "mounts-changed", cbRefPtr) | |||
| 549 | } | 565 | } | ||
| 550 | 566 | ||||
| 551 | var xUnixMountMonitorGet func() uintptr | 567 | var xUnixMountMonitorGet func() uintptr | ||
M v4/gio/gvfs.go +2 -2
| @@ -137,9 +137,9 @@ var xVfsRegisterUriScheme func(uintptr, string, uintptr, uintptr, uintptr, uintp | |||||
| 137 | // | 137 | // | ||
| 138 | // It's an error to call this function twice with the same scheme. To unregister | 138 | // It's an error to call this function twice with the same scheme. To unregister | ||
| 139 | // a custom URI scheme, use g_vfs_unregister_uri_scheme(). | 139 | // a custom URI scheme, use g_vfs_unregister_uri_scheme(). | ||
| 140 | - | func (x *Vfs) RegisterUriScheme(SchemeVar string, UriFuncVar VfsFileLookupFunc, UriDataVar uintptr, UriDestroyVar glib.DestroyNotify, ParseNameFuncVar VfsFileLookupFunc, ParseNameDataVar uintptr, ParseNameDestroyVar glib.DestroyNotify) bool { | 140 | + | func (x *Vfs) RegisterUriScheme(SchemeVar string, UriFuncVar *VfsFileLookupFunc, UriDataVar uintptr, UriDestroyVar *glib.DestroyNotify, ParseNameFuncVar *VfsFileLookupFunc, ParseNameDataVar uintptr, ParseNameDestroyVar *glib.DestroyNotify) bool { |
| 141 | 141 | ||||
| 142 | - | cret := xVfsRegisterUriScheme(x.GoPointer(), SchemeVar, purego.NewCallback(UriFuncVar), UriDataVar, purego.NewCallback(UriDestroyVar), purego.NewCallback(ParseNameFuncVar), ParseNameDataVar, purego.NewCallback(ParseNameDestroyVar)) | 142 | + | cret := xVfsRegisterUriScheme(x.GoPointer(), SchemeVar, glib.NewCallback(UriFuncVar), UriDataVar, glib.NewCallback(UriDestroyVar), glib.NewCallback(ParseNameFuncVar), ParseNameDataVar, glib.NewCallback(ParseNameDestroyVar)) |
| 143 | return cret | 143 | return cret | ||
| 144 | } | 144 | } | ||
| 145 | 145 | ||||
M v4/gio/gvolume.go +9 -9
| @@ -63,9 +63,9 @@ type Volume interface { | |||||
| 63 | SetGoPointer(uintptr) | 63 | SetGoPointer(uintptr) | ||
| 64 | CanEject() bool | 64 | CanEject() bool | ||
| 65 | CanMount() bool | 65 | CanMount() bool | ||
| 66 | - | Eject(FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 66 | + | Eject(FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 67 | EjectFinish(ResultVar AsyncResult) bool | 67 | EjectFinish(ResultVar AsyncResult) bool | ||
| 68 | - | EjectWithOperation(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 68 | + | EjectWithOperation(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 69 | EjectWithOperationFinish(ResultVar AsyncResult) bool | 69 | EjectWithOperationFinish(ResultVar AsyncResult) bool | ||
| 70 | EnumerateIdentifiers() []string | 70 | EnumerateIdentifiers() []string | ||
| 71 | GetActivationRoot() *FileBase | 71 | GetActivationRoot() *FileBase | ||
| @@ -77,7 +77,7 @@ type Volume interface { | |||||
| 77 | GetSortKey() string | 77 | GetSortKey() string | ||
| 78 | GetSymbolicIcon() *IconBase | 78 | GetSymbolicIcon() *IconBase | ||
| 79 | GetUuid() string | 79 | GetUuid() string | ||
| 80 | - | Mount(FlagsVar MountMountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) | 80 | + | Mount(FlagsVar MountMountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) |
| 81 | MountFinish(ResultVar AsyncResult) bool | 81 | MountFinish(ResultVar AsyncResult) bool | ||
| 82 | ShouldAutomount() bool | 82 | ShouldAutomount() bool | ||
| 83 | } | 83 | } | ||
| @@ -110,9 +110,9 @@ func (x *VolumeBase) CanMount() bool { | |||||
| 110 | // Ejects a volume. This is an asynchronous operation, and is | 110 | // Ejects a volume. This is an asynchronous operation, and is | ||
| 111 | // finished by calling g_volume_eject_finish() with the @volume | 111 | // finished by calling g_volume_eject_finish() with the @volume | ||
| 112 | // and #GAsyncResult returned in the @callback. | 112 | // and #GAsyncResult returned in the @callback. | ||
| 113 | - | func (x *VolumeBase) Eject(FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 113 | + | func (x *VolumeBase) Eject(FlagsVar MountUnmountFlags, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 114 | 114 | ||||
| 115 | - | XGVolumeEject(x.GoPointer(), FlagsVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 115 | + | XGVolumeEject(x.GoPointer(), FlagsVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 116 | 116 | ||||
| 117 | } | 117 | } | ||
| 118 | 118 | ||||
| @@ -132,9 +132,9 @@ func (x *VolumeBase) EjectFinish(ResultVar AsyncResult) (bool, error) { | |||||
| 132 | // Ejects a volume. This is an asynchronous operation, and is | 132 | // Ejects a volume. This is an asynchronous operation, and is | ||
| 133 | // finished by calling g_volume_eject_with_operation_finish() with the @volume | 133 | // finished by calling g_volume_eject_with_operation_finish() with the @volume | ||
| 134 | // and #GAsyncResult data returned in the @callback. | 134 | // and #GAsyncResult data returned in the @callback. | ||
| 135 | - | func (x *VolumeBase) EjectWithOperation(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 135 | + | func (x *VolumeBase) EjectWithOperation(FlagsVar MountUnmountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 136 | 136 | ||||
| 137 | - | XGVolumeEjectWithOperation(x.GoPointer(), FlagsVar, MountOperationVar.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 137 | + | XGVolumeEjectWithOperation(x.GoPointer(), FlagsVar, MountOperationVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 138 | 138 | ||||
| 139 | } | 139 | } | ||
| 140 | 140 | ||||
| @@ -294,9 +294,9 @@ func (x *VolumeBase) GetUuid() string { | |||||
| 294 | // Mounts a volume. This is an asynchronous operation, and is | 294 | // Mounts a volume. This is an asynchronous operation, and is | ||
| 295 | // finished by calling g_volume_mount_finish() with the @volume | 295 | // finished by calling g_volume_mount_finish() with the @volume | ||
| 296 | // and #GAsyncResult returned in the @callback. | 296 | // and #GAsyncResult returned in the @callback. | ||
| 297 | - | func (x *VolumeBase) Mount(FlagsVar MountMountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar AsyncReadyCallback, UserDataVar uintptr) { | 297 | + | func (x *VolumeBase) Mount(FlagsVar MountMountFlags, MountOperationVar *MountOperation, CancellableVar *Cancellable, CallbackVar *AsyncReadyCallback, UserDataVar uintptr) { |
| 298 | 298 | ||||
| 299 | - | XGVolumeMount(x.GoPointer(), FlagsVar, MountOperationVar.GoPointer(), CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 299 | + | XGVolumeMount(x.GoPointer(), FlagsVar, MountOperationVar.GoPointer(), CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 300 | 300 | ||||
| 301 | } | 301 | } | ||
| 302 | 302 | ||||
M v4/gio/gvolumemonitor.go +132 -36
| @@ -122,150 +122,246 @@ func (c *VolumeMonitor) SetGoPointer(ptr uintptr) { | |||||
| 122 | } | 122 | } | ||
| 123 | 123 | ||||
| 124 | // Emitted when a drive changes. | 124 | // Emitted when a drive changes. | ||
| 125 | - | func (x *VolumeMonitor) ConnectDriveChanged(cb func(VolumeMonitor, uintptr)) uint32 { | 125 | + | func (x *VolumeMonitor) ConnectDriveChanged(cb *func(VolumeMonitor, uintptr)) uint32 { |
| 126 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 127 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 128 | + | return gobject.SignalConnect(x.GoPointer(), "drive-changed", cbRefPtr) | |||
| 129 | + | } | |||
| 130 | + | ||||
| 126 | fcb := func(clsPtr uintptr, DriveVarp uintptr) { | 131 | fcb := func(clsPtr uintptr, DriveVarp uintptr) { | ||
| 127 | fa := VolumeMonitor{} | 132 | fa := VolumeMonitor{} | ||
| 128 | fa.Ptr = clsPtr | 133 | fa.Ptr = clsPtr | ||
| 134 | + | cbFn := *cb | |||
| 129 | 135 | ||||
| 130 | - | cb(fa, DriveVarp) | 136 | + | cbFn(fa, DriveVarp) |
| 131 | 137 | ||||
| 132 | } | 138 | } | ||
| 133 | - | return gobject.SignalConnect(x.GoPointer(), "drive-changed", purego.NewCallback(fcb)) | 139 | + | cbRefPtr := purego.NewCallback(fcb) |
| 140 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 141 | + | return gobject.SignalConnect(x.GoPointer(), "drive-changed", cbRefPtr) | |||
| 134 | } | 142 | } | ||
| 135 | 143 | ||||
| 136 | // Emitted when a drive is connected to the system. | 144 | // Emitted when a drive is connected to the system. | ||
| 137 | - | func (x *VolumeMonitor) ConnectDriveConnected(cb func(VolumeMonitor, uintptr)) uint32 { | 145 | + | func (x *VolumeMonitor) ConnectDriveConnected(cb *func(VolumeMonitor, uintptr)) uint32 { |
| 146 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 147 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 148 | + | return gobject.SignalConnect(x.GoPointer(), "drive-connected", cbRefPtr) | |||
| 149 | + | } | |||
| 150 | + | ||||
| 138 | fcb := func(clsPtr uintptr, DriveVarp uintptr) { | 151 | fcb := func(clsPtr uintptr, DriveVarp uintptr) { | ||
| 139 | fa := VolumeMonitor{} | 152 | fa := VolumeMonitor{} | ||
| 140 | fa.Ptr = clsPtr | 153 | fa.Ptr = clsPtr | ||
| 154 | + | cbFn := *cb | |||
| 141 | 155 | ||||
| 142 | - | cb(fa, DriveVarp) | 156 | + | cbFn(fa, DriveVarp) |
| 143 | 157 | ||||
| 144 | } | 158 | } | ||
| 145 | - | return gobject.SignalConnect(x.GoPointer(), "drive-connected", purego.NewCallback(fcb)) | 159 | + | cbRefPtr := purego.NewCallback(fcb) |
| 160 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 161 | + | return gobject.SignalConnect(x.GoPointer(), "drive-connected", cbRefPtr) | |||
| 146 | } | 162 | } | ||
| 147 | 163 | ||||
| 148 | // Emitted when a drive is disconnected from the system. | 164 | // Emitted when a drive is disconnected from the system. | ||
| 149 | - | func (x *VolumeMonitor) ConnectDriveDisconnected(cb func(VolumeMonitor, uintptr)) uint32 { | 165 | + | func (x *VolumeMonitor) ConnectDriveDisconnected(cb *func(VolumeMonitor, uintptr)) uint32 { |
| 166 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 167 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 168 | + | return gobject.SignalConnect(x.GoPointer(), "drive-disconnected", cbRefPtr) | |||
| 169 | + | } | |||
| 170 | + | ||||
| 150 | fcb := func(clsPtr uintptr, DriveVarp uintptr) { | 171 | fcb := func(clsPtr uintptr, DriveVarp uintptr) { | ||
| 151 | fa := VolumeMonitor{} | 172 | fa := VolumeMonitor{} | ||
| 152 | fa.Ptr = clsPtr | 173 | fa.Ptr = clsPtr | ||
| 174 | + | cbFn := *cb | |||
| 153 | 175 | ||||
| 154 | - | cb(fa, DriveVarp) | 176 | + | cbFn(fa, DriveVarp) |
| 155 | 177 | ||||
| 156 | } | 178 | } | ||
| 157 | - | return gobject.SignalConnect(x.GoPointer(), "drive-disconnected", purego.NewCallback(fcb)) | 179 | + | cbRefPtr := purego.NewCallback(fcb) |
| 180 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 181 | + | return gobject.SignalConnect(x.GoPointer(), "drive-disconnected", cbRefPtr) | |||
| 158 | } | 182 | } | ||
| 159 | 183 | ||||
| 160 | // Emitted when the eject button is pressed on @drive. | 184 | // Emitted when the eject button is pressed on @drive. | ||
| 161 | - | func (x *VolumeMonitor) ConnectDriveEjectButton(cb func(VolumeMonitor, uintptr)) uint32 { | 185 | + | func (x *VolumeMonitor) ConnectDriveEjectButton(cb *func(VolumeMonitor, uintptr)) uint32 { |
| 186 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 187 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 188 | + | return gobject.SignalConnect(x.GoPointer(), "drive-eject-button", cbRefPtr) | |||
| 189 | + | } | |||
| 190 | + | ||||
| 162 | fcb := func(clsPtr uintptr, DriveVarp uintptr) { | 191 | fcb := func(clsPtr uintptr, DriveVarp uintptr) { | ||
| 163 | fa := VolumeMonitor{} | 192 | fa := VolumeMonitor{} | ||
| 164 | fa.Ptr = clsPtr | 193 | fa.Ptr = clsPtr | ||
| 194 | + | cbFn := *cb | |||
| 165 | 195 | ||||
| 166 | - | cb(fa, DriveVarp) | 196 | + | cbFn(fa, DriveVarp) |
| 167 | 197 | ||||
| 168 | } | 198 | } | ||
| 169 | - | return gobject.SignalConnect(x.GoPointer(), "drive-eject-button", purego.NewCallback(fcb)) | 199 | + | cbRefPtr := purego.NewCallback(fcb) |
| 200 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 201 | + | return gobject.SignalConnect(x.GoPointer(), "drive-eject-button", cbRefPtr) | |||
| 170 | } | 202 | } | ||
| 171 | 203 | ||||
| 172 | // Emitted when the stop button is pressed on @drive. | 204 | // Emitted when the stop button is pressed on @drive. | ||
| 173 | - | func (x *VolumeMonitor) ConnectDriveStopButton(cb func(VolumeMonitor, uintptr)) uint32 { | 205 | + | func (x *VolumeMonitor) ConnectDriveStopButton(cb *func(VolumeMonitor, uintptr)) uint32 { |
| 206 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 207 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 208 | + | return gobject.SignalConnect(x.GoPointer(), "drive-stop-button", cbRefPtr) | |||
| 209 | + | } | |||
| 210 | + | ||||
| 174 | fcb := func(clsPtr uintptr, DriveVarp uintptr) { | 211 | fcb := func(clsPtr uintptr, DriveVarp uintptr) { | ||
| 175 | fa := VolumeMonitor{} | 212 | fa := VolumeMonitor{} | ||
| 176 | fa.Ptr = clsPtr | 213 | fa.Ptr = clsPtr | ||
| 214 | + | cbFn := *cb | |||
| 177 | 215 | ||||
| 178 | - | cb(fa, DriveVarp) | 216 | + | cbFn(fa, DriveVarp) |
| 179 | 217 | ||||
| 180 | } | 218 | } | ||
| 181 | - | return gobject.SignalConnect(x.GoPointer(), "drive-stop-button", purego.NewCallback(fcb)) | 219 | + | cbRefPtr := purego.NewCallback(fcb) |
| 220 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 221 | + | return gobject.SignalConnect(x.GoPointer(), "drive-stop-button", cbRefPtr) | |||
| 182 | } | 222 | } | ||
| 183 | 223 | ||||
| 184 | // Emitted when a mount is added. | 224 | // Emitted when a mount is added. | ||
| 185 | - | func (x *VolumeMonitor) ConnectMountAdded(cb func(VolumeMonitor, uintptr)) uint32 { | 225 | + | func (x *VolumeMonitor) ConnectMountAdded(cb *func(VolumeMonitor, uintptr)) uint32 { |
| 226 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 227 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 228 | + | return gobject.SignalConnect(x.GoPointer(), "mount-added", cbRefPtr) | |||
| 229 | + | } | |||
| 230 | + | ||||
| 186 | fcb := func(clsPtr uintptr, MountVarp uintptr) { | 231 | fcb := func(clsPtr uintptr, MountVarp uintptr) { | ||
| 187 | fa := VolumeMonitor{} | 232 | fa := VolumeMonitor{} | ||
| 188 | fa.Ptr = clsPtr | 233 | fa.Ptr = clsPtr | ||
| 234 | + | cbFn := *cb | |||
| 189 | 235 | ||||
| 190 | - | cb(fa, MountVarp) | 236 | + | cbFn(fa, MountVarp) |
| 191 | 237 | ||||
| 192 | } | 238 | } | ||
| 193 | - | return gobject.SignalConnect(x.GoPointer(), "mount-added", purego.NewCallback(fcb)) | 239 | + | cbRefPtr := purego.NewCallback(fcb) |
| 240 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 241 | + | return gobject.SignalConnect(x.GoPointer(), "mount-added", cbRefPtr) | |||
| 194 | } | 242 | } | ||
| 195 | 243 | ||||
| 196 | // Emitted when a mount changes. | 244 | // Emitted when a mount changes. | ||
| 197 | - | func (x *VolumeMonitor) ConnectMountChanged(cb func(VolumeMonitor, uintptr)) uint32 { | 245 | + | func (x *VolumeMonitor) ConnectMountChanged(cb *func(VolumeMonitor, uintptr)) uint32 { |
| 246 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 247 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 248 | + | return gobject.SignalConnect(x.GoPointer(), "mount-changed", cbRefPtr) | |||
| 249 | + | } | |||
| 250 | + | ||||
| 198 | fcb := func(clsPtr uintptr, MountVarp uintptr) { | 251 | fcb := func(clsPtr uintptr, MountVarp uintptr) { | ||
| 199 | fa := VolumeMonitor{} | 252 | fa := VolumeMonitor{} | ||
| 200 | fa.Ptr = clsPtr | 253 | fa.Ptr = clsPtr | ||
| 254 | + | cbFn := *cb | |||
| 201 | 255 | ||||
| 202 | - | cb(fa, MountVarp) | 256 | + | cbFn(fa, MountVarp) |
| 203 | 257 | ||||
| 204 | } | 258 | } | ||
| 205 | - | return gobject.SignalConnect(x.GoPointer(), "mount-changed", purego.NewCallback(fcb)) | 259 | + | cbRefPtr := purego.NewCallback(fcb) |
| 260 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 261 | + | return gobject.SignalConnect(x.GoPointer(), "mount-changed", cbRefPtr) | |||
| 206 | } | 262 | } | ||
| 207 | 263 | ||||
| 208 | // May be emitted when a mount is about to be removed. | 264 | // May be emitted when a mount is about to be removed. | ||
| 209 | // | 265 | // | ||
| 210 | // This signal depends on the backend and is only emitted if | 266 | // This signal depends on the backend and is only emitted if | ||
| 211 | // GIO was used to unmount. | 267 | // GIO was used to unmount. | ||
| 212 | - | func (x *VolumeMonitor) ConnectMountPreUnmount(cb func(VolumeMonitor, uintptr)) uint32 { | 268 | + | func (x *VolumeMonitor) ConnectMountPreUnmount(cb *func(VolumeMonitor, uintptr)) uint32 { |
| 269 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 270 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 271 | + | return gobject.SignalConnect(x.GoPointer(), "mount-pre-unmount", cbRefPtr) | |||
| 272 | + | } | |||
| 273 | + | ||||
| 213 | fcb := func(clsPtr uintptr, MountVarp uintptr) { | 274 | fcb := func(clsPtr uintptr, MountVarp uintptr) { | ||
| 214 | fa := VolumeMonitor{} | 275 | fa := VolumeMonitor{} | ||
| 215 | fa.Ptr = clsPtr | 276 | fa.Ptr = clsPtr | ||
| 277 | + | cbFn := *cb | |||
| 216 | 278 | ||||
| 217 | - | cb(fa, MountVarp) | 279 | + | cbFn(fa, MountVarp) |
| 218 | 280 | ||||
| 219 | } | 281 | } | ||
| 220 | - | return gobject.SignalConnect(x.GoPointer(), "mount-pre-unmount", purego.NewCallback(fcb)) | 282 | + | cbRefPtr := purego.NewCallback(fcb) |
| 283 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 284 | + | return gobject.SignalConnect(x.GoPointer(), "mount-pre-unmount", cbRefPtr) | |||
| 221 | } | 285 | } | ||
| 222 | 286 | ||||
| 223 | // Emitted when a mount is removed. | 287 | // Emitted when a mount is removed. | ||
| 224 | - | func (x *VolumeMonitor) ConnectMountRemoved(cb func(VolumeMonitor, uintptr)) uint32 { | 288 | + | func (x *VolumeMonitor) ConnectMountRemoved(cb *func(VolumeMonitor, uintptr)) uint32 { |
| 289 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 290 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 291 | + | return gobject.SignalConnect(x.GoPointer(), "mount-removed", cbRefPtr) | |||
| 292 | + | } | |||
| 293 | + | ||||
| 225 | fcb := func(clsPtr uintptr, MountVarp uintptr) { | 294 | fcb := func(clsPtr uintptr, MountVarp uintptr) { | ||
| 226 | fa := VolumeMonitor{} | 295 | fa := VolumeMonitor{} | ||
| 227 | fa.Ptr = clsPtr | 296 | fa.Ptr = clsPtr | ||
| 297 | + | cbFn := *cb | |||
| 228 | 298 | ||||
| 229 | - | cb(fa, MountVarp) | 299 | + | cbFn(fa, MountVarp) |
| 230 | 300 | ||||
| 231 | } | 301 | } | ||
| 232 | - | return gobject.SignalConnect(x.GoPointer(), "mount-removed", purego.NewCallback(fcb)) | 302 | + | cbRefPtr := purego.NewCallback(fcb) |
| 303 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 304 | + | return gobject.SignalConnect(x.GoPointer(), "mount-removed", cbRefPtr) | |||
| 233 | } | 305 | } | ||
| 234 | 306 | ||||
| 235 | // Emitted when a mountable volume is added to the system. | 307 | // Emitted when a mountable volume is added to the system. | ||
| 236 | - | func (x *VolumeMonitor) ConnectVolumeAdded(cb func(VolumeMonitor, uintptr)) uint32 { | 308 | + | func (x *VolumeMonitor) ConnectVolumeAdded(cb *func(VolumeMonitor, uintptr)) uint32 { |
| 309 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 310 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 311 | + | return gobject.SignalConnect(x.GoPointer(), "volume-added", cbRefPtr) | |||
| 312 | + | } | |||
| 313 | + | ||||
| 237 | fcb := func(clsPtr uintptr, VolumeVarp uintptr) { | 314 | fcb := func(clsPtr uintptr, VolumeVarp uintptr) { | ||
| 238 | fa := VolumeMonitor{} | 315 | fa := VolumeMonitor{} | ||
| 239 | fa.Ptr = clsPtr | 316 | fa.Ptr = clsPtr | ||
| 317 | + | cbFn := *cb | |||
| 240 | 318 | ||||
| 241 | - | cb(fa, VolumeVarp) | 319 | + | cbFn(fa, VolumeVarp) |
| 242 | 320 | ||||
| 243 | } | 321 | } | ||
| 244 | - | return gobject.SignalConnect(x.GoPointer(), "volume-added", purego.NewCallback(fcb)) | 322 | + | cbRefPtr := purego.NewCallback(fcb) |
| 323 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 324 | + | return gobject.SignalConnect(x.GoPointer(), "volume-added", cbRefPtr) | |||
| 245 | } | 325 | } | ||
| 246 | 326 | ||||
| 247 | // Emitted when mountable volume is changed. | 327 | // Emitted when mountable volume is changed. | ||
| 248 | - | func (x *VolumeMonitor) ConnectVolumeChanged(cb func(VolumeMonitor, uintptr)) uint32 { | 328 | + | func (x *VolumeMonitor) ConnectVolumeChanged(cb *func(VolumeMonitor, uintptr)) uint32 { |
| 329 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 330 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 331 | + | return gobject.SignalConnect(x.GoPointer(), "volume-changed", cbRefPtr) | |||
| 332 | + | } | |||
| 333 | + | ||||
| 249 | fcb := func(clsPtr uintptr, VolumeVarp uintptr) { | 334 | fcb := func(clsPtr uintptr, VolumeVarp uintptr) { | ||
| 250 | fa := VolumeMonitor{} | 335 | fa := VolumeMonitor{} | ||
| 251 | fa.Ptr = clsPtr | 336 | fa.Ptr = clsPtr | ||
| 337 | + | cbFn := *cb | |||
| 252 | 338 | ||||
| 253 | - | cb(fa, VolumeVarp) | 339 | + | cbFn(fa, VolumeVarp) |
| 254 | 340 | ||||
| 255 | } | 341 | } | ||
| 256 | - | return gobject.SignalConnect(x.GoPointer(), "volume-changed", purego.NewCallback(fcb)) | 342 | + | cbRefPtr := purego.NewCallback(fcb) |
| 343 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 344 | + | return gobject.SignalConnect(x.GoPointer(), "volume-changed", cbRefPtr) | |||
| 257 | } | 345 | } | ||
| 258 | 346 | ||||
| 259 | // Emitted when a mountable volume is removed from the system. | 347 | // Emitted when a mountable volume is removed from the system. | ||
| 260 | - | func (x *VolumeMonitor) ConnectVolumeRemoved(cb func(VolumeMonitor, uintptr)) uint32 { | 348 | + | func (x *VolumeMonitor) ConnectVolumeRemoved(cb *func(VolumeMonitor, uintptr)) uint32 { |
| 349 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 350 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 351 | + | return gobject.SignalConnect(x.GoPointer(), "volume-removed", cbRefPtr) | |||
| 352 | + | } | |||
| 353 | + | ||||
| 261 | fcb := func(clsPtr uintptr, VolumeVarp uintptr) { | 354 | fcb := func(clsPtr uintptr, VolumeVarp uintptr) { | ||
| 262 | fa := VolumeMonitor{} | 355 | fa := VolumeMonitor{} | ||
| 263 | fa.Ptr = clsPtr | 356 | fa.Ptr = clsPtr | ||
| 357 | + | cbFn := *cb | |||
| 264 | 358 | ||||
| 265 | - | cb(fa, VolumeVarp) | 359 | + | cbFn(fa, VolumeVarp) |
| 266 | 360 | ||||
| 267 | } | 361 | } | ||
| 268 | - | return gobject.SignalConnect(x.GoPointer(), "volume-removed", purego.NewCallback(fcb)) | 362 | + | cbRefPtr := purego.NewCallback(fcb) |
| 363 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 364 | + | return gobject.SignalConnect(x.GoPointer(), "volume-removed", cbRefPtr) | |||
| 269 | } | 365 | } | ||
| 270 | 366 | ||||
| 271 | var xVolumeMonitorAdoptOrphanMount func(uintptr) uintptr | 367 | var xVolumeMonitorAdoptOrphanMount func(uintptr) uintptr | ||
M v4/glib/garray.go +4 -4
| @@ -115,9 +115,9 @@ var xNewBytesWithFreeFunc func(uintptr, uint, uintptr, uintptr) *Bytes | |||||
| 115 | // been called to indicate that the bytes is no longer in use. | 115 | // been called to indicate that the bytes is no longer in use. | ||
| 116 | // | 116 | // | ||
| 117 | // @data may be %NULL if @size is 0. | 117 | // @data may be %NULL if @size is 0. | ||
| 118 | - | func NewBytesWithFreeFunc(DataVar uintptr, SizeVar uint, FreeFuncVar DestroyNotify, UserDataVar uintptr) *Bytes { | 118 | + | func NewBytesWithFreeFunc(DataVar uintptr, SizeVar uint, FreeFuncVar *DestroyNotify, UserDataVar uintptr) *Bytes { |
| 119 | 119 | ||||
| 120 | - | cret := xNewBytesWithFreeFunc(DataVar, SizeVar, purego.NewCallback(FreeFuncVar), UserDataVar) | 120 | + | cret := xNewBytesWithFreeFunc(DataVar, SizeVar, NewCallback(FreeFuncVar), UserDataVar) |
| 121 | return cret | 121 | return cret | ||
| 122 | } | 122 | } | ||
| 123 | 123 | ||||
| @@ -400,9 +400,9 @@ var xPtrArrayFindWithEqualFunc func(uintptr, uintptr, uintptr, uint) bool | |||||
| 400 | // @equal_func is called with the element from the array as its first parameter, | 400 | // @equal_func is called with the element from the array as its first parameter, | ||
| 401 | // and @needle as its second parameter. If @equal_func is %NULL, pointer | 401 | // and @needle as its second parameter. If @equal_func is %NULL, pointer | ||
| 402 | // equality is used. | 402 | // equality is used. | ||
| 403 | - | func PtrArrayFindWithEqualFunc(HaystackVar uintptr, NeedleVar uintptr, EqualFuncVar EqualFunc, IndexVar uint) bool { | 403 | + | func PtrArrayFindWithEqualFunc(HaystackVar uintptr, NeedleVar uintptr, EqualFuncVar *EqualFunc, IndexVar uint) bool { |
| 404 | 404 | ||||
| 405 | - | cret := xPtrArrayFindWithEqualFunc(HaystackVar, NeedleVar, purego.NewCallback(EqualFuncVar), IndexVar) | 405 | + | cret := xPtrArrayFindWithEqualFunc(HaystackVar, NeedleVar, NewCallback(EqualFuncVar), IndexVar) |
| 406 | return cret | 406 | return cret | ||
| 407 | } | 407 | } | ||
| 408 | 408 | ||||
M v4/glib/gasyncqueue.go +8 -8
| @@ -138,9 +138,9 @@ var xAsyncQueuePushSorted func(uintptr, uintptr, uintptr, uintptr) | |||||
| 138 | // it when it is finished. | 138 | // it when it is finished. | ||
| 139 | // | 139 | // | ||
| 140 | // For an example of @func see g_async_queue_sort(). | 140 | // For an example of @func see g_async_queue_sort(). | ||
| 141 | - | func (x *AsyncQueue) PushSorted(DataVar uintptr, FuncVar CompareDataFunc, UserDataVar uintptr) { | 141 | + | func (x *AsyncQueue) PushSorted(DataVar uintptr, FuncVar *CompareDataFunc, UserDataVar uintptr) { |
| 142 | 142 | ||||
| 143 | - | xAsyncQueuePushSorted(x.GoPointer(), DataVar, purego.NewCallback(FuncVar), UserDataVar) | 143 | + | xAsyncQueuePushSorted(x.GoPointer(), DataVar, NewCallback(FuncVar), UserDataVar) |
| 144 | 144 | ||||
| 145 | } | 145 | } | ||
| 146 | 146 | ||||
| @@ -161,9 +161,9 @@ var xAsyncQueuePushSortedUnlocked func(uintptr, uintptr, uintptr, uintptr) | |||||
| 161 | // This function must be called while holding the @queue's lock. | 161 | // This function must be called while holding the @queue's lock. | ||
| 162 | // | 162 | // | ||
| 163 | // For an example of @func see g_async_queue_sort(). | 163 | // For an example of @func see g_async_queue_sort(). | ||
| 164 | - | func (x *AsyncQueue) PushSortedUnlocked(DataVar uintptr, FuncVar CompareDataFunc, UserDataVar uintptr) { | 164 | + | func (x *AsyncQueue) PushSortedUnlocked(DataVar uintptr, FuncVar *CompareDataFunc, UserDataVar uintptr) { |
| 165 | 165 | ||||
| 166 | - | xAsyncQueuePushSortedUnlocked(x.GoPointer(), DataVar, purego.NewCallback(FuncVar), UserDataVar) | 166 | + | xAsyncQueuePushSortedUnlocked(x.GoPointer(), DataVar, NewCallback(FuncVar), UserDataVar) |
| 167 | 167 | ||||
| 168 | } | 168 | } | ||
| 169 | 169 | ||||
| @@ -243,9 +243,9 @@ var xAsyncQueueSort func(uintptr, uintptr, uintptr) | |||||
| 243 | // return (id1 > id2 ? +1 : id1 == id2 ? 0 : -1); | 243 | // return (id1 > id2 ? +1 : id1 == id2 ? 0 : -1); | ||
| 244 | // | 244 | // | ||
| 245 | // ]| | 245 | // ]| | ||
| 246 | - | func (x *AsyncQueue) Sort(FuncVar CompareDataFunc, UserDataVar uintptr) { | 246 | + | func (x *AsyncQueue) Sort(FuncVar *CompareDataFunc, UserDataVar uintptr) { |
| 247 | 247 | ||||
| 248 | - | xAsyncQueueSort(x.GoPointer(), purego.NewCallback(FuncVar), UserDataVar) | 248 | + | xAsyncQueueSort(x.GoPointer(), NewCallback(FuncVar), UserDataVar) |
| 249 | 249 | ||||
| 250 | } | 250 | } | ||
| 251 | 251 | ||||
| @@ -260,9 +260,9 @@ var xAsyncQueueSortUnlocked func(uintptr, uintptr, uintptr) | |||||
| 260 | // element. | 260 | // element. | ||
| 261 | // | 261 | // | ||
| 262 | // This function must be called while holding the @queue's lock. | 262 | // This function must be called while holding the @queue's lock. | ||
| 263 | - | func (x *AsyncQueue) SortUnlocked(FuncVar CompareDataFunc, UserDataVar uintptr) { | 263 | + | func (x *AsyncQueue) SortUnlocked(FuncVar *CompareDataFunc, UserDataVar uintptr) { |
| 264 | 264 | ||||
| 265 | - | xAsyncQueueSortUnlocked(x.GoPointer(), purego.NewCallback(FuncVar), UserDataVar) | 265 | + | xAsyncQueueSortUnlocked(x.GoPointer(), NewCallback(FuncVar), UserDataVar) |
| 266 | 266 | ||||
| 267 | } | 267 | } | ||
| 268 | 268 | ||||
M v4/glib/gdataset.go +12 -12
| @@ -59,9 +59,9 @@ var xDatalistForeach func(**Data, uintptr, uintptr) | |||||
| 59 | // @func can make changes to @datalist, but the iteration will not | 59 | // @func can make changes to @datalist, but the iteration will not | ||
| 60 | // reflect changes made during the g_datalist_foreach() call, other | 60 | // reflect changes made during the g_datalist_foreach() call, other | ||
| 61 | // than skipping over elements that are removed. | 61 | // than skipping over elements that are removed. | ||
| 62 | - | func DatalistForeach(DatalistVar **Data, FuncVar DataForeachFunc, UserDataVar uintptr) { | 62 | + | func DatalistForeach(DatalistVar **Data, FuncVar *DataForeachFunc, UserDataVar uintptr) { |
| 63 | 63 | ||||
| 64 | - | xDatalistForeach(DatalistVar, purego.NewCallback(FuncVar), UserDataVar) | 64 | + | xDatalistForeach(DatalistVar, NewCallback(FuncVar), UserDataVar) |
| 65 | 65 | ||||
| 66 | } | 66 | } | ||
| 67 | 67 | ||||
| @@ -100,9 +100,9 @@ var xDatalistIdDupData func(**Data, Quark, uintptr, uintptr) uintptr | |||||
| 100 | // | 100 | // | ||
| 101 | // This function can be useful to avoid races when multiple | 101 | // This function can be useful to avoid races when multiple | ||
| 102 | // threads are using the same datalist and the same key. | 102 | // threads are using the same datalist and the same key. | ||
| 103 | - | func DatalistIdDupData(DatalistVar **Data, KeyIdVar Quark, DupFuncVar DuplicateFunc, UserDataVar uintptr) uintptr { | 103 | + | func DatalistIdDupData(DatalistVar **Data, KeyIdVar Quark, DupFuncVar *DuplicateFunc, UserDataVar uintptr) uintptr { |
| 104 | 104 | ||||
| 105 | - | cret := xDatalistIdDupData(DatalistVar, KeyIdVar, purego.NewCallback(DupFuncVar), UserDataVar) | 105 | + | cret := xDatalistIdDupData(DatalistVar, KeyIdVar, NewCallback(DupFuncVar), UserDataVar) |
| 106 | return cret | 106 | return cret | ||
| 107 | } | 107 | } | ||
| 108 | 108 | ||||
| @@ -140,9 +140,9 @@ var xDatalistIdReplaceData func(**Data, Quark, uintptr, uintptr, uintptr, uintpt | |||||
| 140 | // Its up to the caller to free this as they wish, which may | 140 | // Its up to the caller to free this as they wish, which may | ||
| 141 | // or may not include using @old_destroy as sometimes replacement | 141 | // or may not include using @old_destroy as sometimes replacement | ||
| 142 | // should not destroy the object in the normal way. | 142 | // should not destroy the object in the normal way. | ||
| 143 | - | func DatalistIdReplaceData(DatalistVar **Data, KeyIdVar Quark, OldvalVar uintptr, NewvalVar uintptr, DestroyVar DestroyNotify, OldDestroyVar DestroyNotify) bool { | 143 | + | func DatalistIdReplaceData(DatalistVar **Data, KeyIdVar Quark, OldvalVar uintptr, NewvalVar uintptr, DestroyVar *DestroyNotify, OldDestroyVar *DestroyNotify) bool { |
| 144 | 144 | ||||
| 145 | - | cret := xDatalistIdReplaceData(DatalistVar, KeyIdVar, OldvalVar, NewvalVar, purego.NewCallback(DestroyVar), purego.NewCallback(OldDestroyVar)) | 145 | + | cret := xDatalistIdReplaceData(DatalistVar, KeyIdVar, OldvalVar, NewvalVar, NewCallback(DestroyVar), NewCallback(OldDestroyVar)) |
| 146 | return cret | 146 | return cret | ||
| 147 | } | 147 | } | ||
| 148 | 148 | ||||
| @@ -152,9 +152,9 @@ var xDatalistIdSetDataFull func(**Data, Quark, uintptr, uintptr) | |||||
| 152 | // function to be called when the element is removed from the datalist. | 152 | // function to be called when the element is removed from the datalist. | ||
| 153 | // Any previous data with the same key is removed, and its destroy | 153 | // Any previous data with the same key is removed, and its destroy | ||
| 154 | // function is called. | 154 | // function is called. | ||
| 155 | - | func DatalistIdSetDataFull(DatalistVar **Data, KeyIdVar Quark, DataVar uintptr, DestroyFuncVar DestroyNotify) { | 155 | + | func DatalistIdSetDataFull(DatalistVar **Data, KeyIdVar Quark, DataVar uintptr, DestroyFuncVar *DestroyNotify) { |
| 156 | 156 | ||||
| 157 | - | xDatalistIdSetDataFull(DatalistVar, KeyIdVar, DataVar, purego.NewCallback(DestroyFuncVar)) | 157 | + | xDatalistIdSetDataFull(DatalistVar, KeyIdVar, DataVar, NewCallback(DestroyFuncVar)) |
| 158 | 158 | ||||
| 159 | } | 159 | } | ||
| 160 | 160 | ||||
| @@ -211,9 +211,9 @@ var xDatasetForeach func(uintptr, uintptr, uintptr) | |||||
| 211 | // @func can make changes to the dataset, but the iteration will not | 211 | // @func can make changes to the dataset, but the iteration will not | ||
| 212 | // reflect changes made during the g_dataset_foreach() call, other | 212 | // reflect changes made during the g_dataset_foreach() call, other | ||
| 213 | // than skipping over elements that are removed. | 213 | // than skipping over elements that are removed. | ||
| 214 | - | func DatasetForeach(DatasetLocationVar uintptr, FuncVar DataForeachFunc, UserDataVar uintptr) { | 214 | + | func DatasetForeach(DatasetLocationVar uintptr, FuncVar *DataForeachFunc, UserDataVar uintptr) { |
| 215 | 215 | ||||
| 216 | - | xDatasetForeach(DatasetLocationVar, purego.NewCallback(FuncVar), UserDataVar) | 216 | + | xDatasetForeach(DatasetLocationVar, NewCallback(FuncVar), UserDataVar) |
| 217 | 217 | ||||
| 218 | } | 218 | } | ||
| 219 | 219 | ||||
| @@ -242,9 +242,9 @@ var xDatasetIdSetDataFull func(uintptr, Quark, uintptr, uintptr) | |||||
| 242 | // the function to call when the data element is destroyed. Any | 242 | // the function to call when the data element is destroyed. Any | ||
| 243 | // previous data with the same key is removed, and its destroy function | 243 | // previous data with the same key is removed, and its destroy function | ||
| 244 | // is called. | 244 | // is called. | ||
| 245 | - | func DatasetIdSetDataFull(DatasetLocationVar uintptr, KeyIdVar Quark, DataVar uintptr, DestroyFuncVar DestroyNotify) { | 245 | + | func DatasetIdSetDataFull(DatasetLocationVar uintptr, KeyIdVar Quark, DataVar uintptr, DestroyFuncVar *DestroyNotify) { |
| 246 | 246 | ||||
| 247 | - | xDatasetIdSetDataFull(DatasetLocationVar, KeyIdVar, DataVar, purego.NewCallback(DestroyFuncVar)) | 247 | + | xDatasetIdSetDataFull(DatasetLocationVar, KeyIdVar, DataVar, NewCallback(DestroyFuncVar)) |
| 248 | 248 | ||||
| 249 | } | 249 | } | ||
| 250 | 250 | ||||
M v4/glib/ghook.go +4 -4
| @@ -128,9 +128,9 @@ func (x *HookList) InvokeCheck(MayRecurseVar bool) { | |||||
| 128 | var xHookListMarshal func(uintptr, bool, uintptr, uintptr) | 128 | var xHookListMarshal func(uintptr, bool, uintptr, uintptr) | ||
| 129 | 129 | ||||
| 130 | // Calls a function on each valid #GHook. | 130 | // Calls a function on each valid #GHook. | ||
| 131 | - | func (x *HookList) Marshal(MayRecurseVar bool, MarshallerVar HookMarshaller, MarshalDataVar uintptr) { | 131 | + | func (x *HookList) Marshal(MayRecurseVar bool, MarshallerVar *HookMarshaller, MarshalDataVar uintptr) { |
| 132 | 132 | ||||
| 133 | - | xHookListMarshal(x.GoPointer(), MayRecurseVar, purego.NewCallback(MarshallerVar), MarshalDataVar) | 133 | + | xHookListMarshal(x.GoPointer(), MayRecurseVar, NewCallback(MarshallerVar), MarshalDataVar) |
| 134 | 134 | ||||
| 135 | } | 135 | } | ||
| 136 | 136 | ||||
| @@ -138,9 +138,9 @@ var xHookListMarshalCheck func(uintptr, bool, uintptr, uintptr) | |||||
| 138 | 138 | ||||
| 139 | // Calls a function on each valid #GHook and destroys it if the | 139 | // Calls a function on each valid #GHook and destroys it if the | ||
| 140 | // function returns %FALSE. | 140 | // function returns %FALSE. | ||
| 141 | - | func (x *HookList) MarshalCheck(MayRecurseVar bool, MarshallerVar HookCheckMarshaller, MarshalDataVar uintptr) { | 141 | + | func (x *HookList) MarshalCheck(MayRecurseVar bool, MarshallerVar *HookCheckMarshaller, MarshalDataVar uintptr) { |
| 142 | 142 | ||||
| 143 | - | xHookListMarshalCheck(x.GoPointer(), MayRecurseVar, purego.NewCallback(MarshallerVar), MarshalDataVar) | 143 | + | xHookListMarshalCheck(x.GoPointer(), MayRecurseVar, NewCallback(MarshallerVar), MarshalDataVar) |
| 144 | 144 | ||||
| 145 | } | 145 | } | ||
| 146 | 146 | ||||
M v4/glib/giochannel.go +4 -4
| @@ -670,9 +670,9 @@ var xIoAddWatch func(*IOChannel, IOCondition, uintptr, uintptr) uint | |||||
| 670 | 670 | ||||
| 671 | // Adds the #GIOChannel into the default main loop context | 671 | // Adds the #GIOChannel into the default main loop context | ||
| 672 | // with the default priority. | 672 | // with the default priority. | ||
| 673 | - | func IoAddWatch(ChannelVar *IOChannel, ConditionVar IOCondition, FuncVar IOFunc, UserDataVar uintptr) uint { | 673 | + | func IoAddWatch(ChannelVar *IOChannel, ConditionVar IOCondition, FuncVar *IOFunc, UserDataVar uintptr) uint { |
| 674 | 674 | ||||
| 675 | - | cret := xIoAddWatch(ChannelVar, ConditionVar, purego.NewCallback(FuncVar), UserDataVar) | 675 | + | cret := xIoAddWatch(ChannelVar, ConditionVar, NewCallback(FuncVar), UserDataVar) |
| 676 | return cret | 676 | return cret | ||
| 677 | } | 677 | } | ||
| 678 | 678 | ||||
| @@ -684,9 +684,9 @@ var xIoAddWatchFull func(*IOChannel, int, IOCondition, uintptr, uintptr, uintptr | |||||
| 684 | // This internally creates a main loop source using g_io_create_watch() | 684 | // This internally creates a main loop source using g_io_create_watch() | ||
| 685 | // and attaches it to the main loop context with g_source_attach(). | 685 | // and attaches it to the main loop context with g_source_attach(). | ||
| 686 | // You can do these steps manually if you need greater control. | 686 | // You can do these steps manually if you need greater control. | ||
| 687 | - | func IoAddWatchFull(ChannelVar *IOChannel, PriorityVar int, ConditionVar IOCondition, FuncVar IOFunc, UserDataVar uintptr, NotifyVar DestroyNotify) uint { | 687 | + | func IoAddWatchFull(ChannelVar *IOChannel, PriorityVar int, ConditionVar IOCondition, FuncVar *IOFunc, UserDataVar uintptr, NotifyVar *DestroyNotify) uint { |
| 688 | 688 | ||||
| 689 | - | cret := xIoAddWatchFull(ChannelVar, PriorityVar, ConditionVar, purego.NewCallback(FuncVar), UserDataVar, purego.NewCallback(NotifyVar)) | 689 | + | cret := xIoAddWatchFull(ChannelVar, PriorityVar, ConditionVar, NewCallback(FuncVar), UserDataVar, NewCallback(NotifyVar)) |
| 690 | return cret | 690 | return cret | ||
| 691 | } | 691 | } | ||
| 692 | 692 | ||||
M v4/glib/glib-unix.go +8 -8
| @@ -25,9 +25,9 @@ var xUnixFdAdd func(int, IOCondition, uintptr, uintptr) uint | |||||
| 25 | // to cancel the watch at any time that it exists. | 25 | // to cancel the watch at any time that it exists. | ||
| 26 | // | 26 | // | ||
| 27 | // The source will never close the fd -- you must do it yourself. | 27 | // The source will never close the fd -- you must do it yourself. | ||
| 28 | - | func UnixFdAdd(FdVar int, ConditionVar IOCondition, FunctionVar UnixFDSourceFunc, UserDataVar uintptr) uint { | 28 | + | func UnixFdAdd(FdVar int, ConditionVar IOCondition, FunctionVar *UnixFDSourceFunc, UserDataVar uintptr) uint { |
| 29 | 29 | ||||
| 30 | - | cret := xUnixFdAdd(FdVar, ConditionVar, purego.NewCallback(FunctionVar), UserDataVar) | 30 | + | cret := xUnixFdAdd(FdVar, ConditionVar, NewCallback(FunctionVar), UserDataVar) |
| 31 | return cret | 31 | return cret | ||
| 32 | } | 32 | } | ||
| 33 | 33 | ||||
| @@ -39,9 +39,9 @@ var xUnixFdAddFull func(int, int, IOCondition, uintptr, uintptr, uintptr) uint | |||||
| 39 | // This is the same as g_unix_fd_add(), except that it allows you to | 39 | // This is the same as g_unix_fd_add(), except that it allows you to | ||
| 40 | // specify a non-default priority and a provide a #GDestroyNotify for | 40 | // specify a non-default priority and a provide a #GDestroyNotify for | ||
| 41 | // @user_data. | 41 | // @user_data. | ||
| 42 | - | func UnixFdAddFull(PriorityVar int, FdVar int, ConditionVar IOCondition, FunctionVar UnixFDSourceFunc, UserDataVar uintptr, NotifyVar DestroyNotify) uint { | 42 | + | func UnixFdAddFull(PriorityVar int, FdVar int, ConditionVar IOCondition, FunctionVar *UnixFDSourceFunc, UserDataVar uintptr, NotifyVar *DestroyNotify) uint { |
| 43 | 43 | ||||
| 44 | - | cret := xUnixFdAddFull(PriorityVar, FdVar, ConditionVar, purego.NewCallback(FunctionVar), UserDataVar, purego.NewCallback(NotifyVar)) | 44 | + | cret := xUnixFdAddFull(PriorityVar, FdVar, ConditionVar, NewCallback(FunctionVar), UserDataVar, NewCallback(NotifyVar)) |
| 45 | return cret | 45 | return cret | ||
| 46 | } | 46 | } | ||
| 47 | 47 | ||||
| @@ -123,9 +123,9 @@ var xUnixSignalAdd func(int, uintptr, uintptr) uint | |||||
| 123 | // A convenience function for g_unix_signal_source_new(), which | 123 | // A convenience function for g_unix_signal_source_new(), which | ||
| 124 | // attaches to the default #GMainContext. You can remove the watch | 124 | // attaches to the default #GMainContext. You can remove the watch | ||
| 125 | // using g_source_remove(). | 125 | // using g_source_remove(). | ||
| 126 | - | func UnixSignalAdd(SignumVar int, HandlerVar SourceFunc, UserDataVar uintptr) uint { | 126 | + | func UnixSignalAdd(SignumVar int, HandlerVar *SourceFunc, UserDataVar uintptr) uint { |
| 127 | 127 | ||||
| 128 | - | cret := xUnixSignalAdd(SignumVar, purego.NewCallback(HandlerVar), UserDataVar) | 128 | + | cret := xUnixSignalAdd(SignumVar, NewCallback(HandlerVar), UserDataVar) |
| 129 | return cret | 129 | return cret | ||
| 130 | } | 130 | } | ||
| 131 | 131 | ||||
| @@ -134,9 +134,9 @@ var xUnixSignalAddFull func(int, int, uintptr, uintptr, uintptr) uint | |||||
| 134 | // A convenience function for g_unix_signal_source_new(), which | 134 | // A convenience function for g_unix_signal_source_new(), which | ||
| 135 | // attaches to the default #GMainContext. You can remove the watch | 135 | // attaches to the default #GMainContext. You can remove the watch | ||
| 136 | // using g_source_remove(). | 136 | // using g_source_remove(). | ||
| 137 | - | func UnixSignalAddFull(PriorityVar int, SignumVar int, HandlerVar SourceFunc, UserDataVar uintptr, NotifyVar DestroyNotify) uint { | 137 | + | func UnixSignalAddFull(PriorityVar int, SignumVar int, HandlerVar *SourceFunc, UserDataVar uintptr, NotifyVar *DestroyNotify) uint { |
| 138 | 138 | ||||
| 139 | - | cret := xUnixSignalAddFull(PriorityVar, SignumVar, purego.NewCallback(HandlerVar), UserDataVar, purego.NewCallback(NotifyVar)) | 139 | + | cret := xUnixSignalAddFull(PriorityVar, SignumVar, NewCallback(HandlerVar), UserDataVar, NewCallback(NotifyVar)) |
| 140 | return cret | 140 | return cret | ||
| 141 | } | 141 | } | ||
| 142 | 142 | ||||
M v4/glib/glist.go +2 -2
| @@ -26,9 +26,9 @@ var xClearList func(**List, uintptr) | |||||
| 26 | // Clears a pointer to a #GList, freeing it and, optionally, freeing its elements using @destroy. | 26 | // Clears a pointer to a #GList, freeing it and, optionally, freeing its elements using @destroy. | ||
| 27 | // | 27 | // | ||
| 28 | // @list_ptr must be a valid pointer. If @list_ptr points to a null #GList, this does nothing. | 28 | // @list_ptr must be a valid pointer. If @list_ptr points to a null #GList, this does nothing. | ||
| 29 | - | func ClearList(ListPtrVar **List, DestroyVar DestroyNotify) { | 29 | + | func ClearList(ListPtrVar **List, DestroyVar *DestroyNotify) { |
| 30 | 30 | ||||
| 31 | - | xClearList(ListPtrVar, purego.NewCallback(DestroyVar)) | 31 | + | xClearList(ListPtrVar, NewCallback(DestroyVar)) |
| 32 | 32 | ||||
| 33 | } | 33 | } | ||
| 34 | 34 | ||||
M v4/glib/gmain.go +28 -28
| @@ -196,9 +196,9 @@ var xMainContextInvoke func(uintptr, uintptr, uintptr) | |||||
| 196 | // Note that, as with normal idle functions, @function should probably | 196 | // Note that, as with normal idle functions, @function should probably | ||
| 197 | // return %FALSE. If it returns %TRUE, it will be continuously run in a | 197 | // return %FALSE. If it returns %TRUE, it will be continuously run in a | ||
| 198 | // loop (and may prevent this call from returning). | 198 | // loop (and may prevent this call from returning). | ||
| 199 | - | func (x *MainContext) Invoke(FunctionVar SourceFunc, DataVar uintptr) { | 199 | + | func (x *MainContext) Invoke(FunctionVar *SourceFunc, DataVar uintptr) { |
| 200 | 200 | ||||
| 201 | - | xMainContextInvoke(x.GoPointer(), purego.NewCallback(FunctionVar), DataVar) | 201 | + | xMainContextInvoke(x.GoPointer(), NewCallback(FunctionVar), DataVar) |
| 202 | 202 | ||||
| 203 | } | 203 | } | ||
| 204 | 204 | ||||
| @@ -213,9 +213,9 @@ var xMainContextInvokeFull func(uintptr, int, uintptr, uintptr, uintptr) | |||||
| 213 | // | 213 | // | ||
| 214 | // @notify should not assume that it is called from any particular | 214 | // @notify should not assume that it is called from any particular | ||
| 215 | // thread or with any particular context acquired. | 215 | // thread or with any particular context acquired. | ||
| 216 | - | func (x *MainContext) InvokeFull(PriorityVar int, FunctionVar SourceFunc, DataVar uintptr, NotifyVar DestroyNotify) { | 216 | + | func (x *MainContext) InvokeFull(PriorityVar int, FunctionVar *SourceFunc, DataVar uintptr, NotifyVar *DestroyNotify) { |
| 217 | 217 | ||||
| 218 | - | xMainContextInvokeFull(x.GoPointer(), PriorityVar, purego.NewCallback(FunctionVar), DataVar, purego.NewCallback(NotifyVar)) | 218 | + | xMainContextInvokeFull(x.GoPointer(), PriorityVar, NewCallback(FunctionVar), DataVar, NewCallback(NotifyVar)) |
| 219 | 219 | ||||
| 220 | } | 220 | } | ||
| 221 | 221 | ||||
| @@ -384,9 +384,9 @@ var xMainContextSetPollFunc func(uintptr, uintptr) | |||||
| 384 | // | 384 | // | ||
| 385 | // This function could possibly be used to integrate the GLib event | 385 | // This function could possibly be used to integrate the GLib event | ||
| 386 | // loop with an external event loop. | 386 | // loop with an external event loop. | ||
| 387 | - | func (x *MainContext) SetPollFunc(FuncVar PollFunc) { | 387 | + | func (x *MainContext) SetPollFunc(FuncVar *PollFunc) { |
| 388 | 388 | ||||
| 389 | - | xMainContextSetPollFunc(x.GoPointer(), purego.NewCallback(FuncVar)) | 389 | + | xMainContextSetPollFunc(x.GoPointer(), NewCallback(FuncVar)) |
| 390 | 390 | ||||
| 391 | } | 391 | } | ||
| 392 | 392 | ||||
| @@ -988,9 +988,9 @@ var xSourceSetCallback func(uintptr, uintptr, uintptr, uintptr) | |||||
| 988 | // | 988 | // | ||
| 989 | // Note that g_source_destroy() for a currently attached source has the effect | 989 | // Note that g_source_destroy() for a currently attached source has the effect | ||
| 990 | // of also unsetting the callback. | 990 | // of also unsetting the callback. | ||
| 991 | - | func (x *Source) SetCallback(FuncVar SourceFunc, DataVar uintptr, NotifyVar DestroyNotify) { | 991 | + | func (x *Source) SetCallback(FuncVar *SourceFunc, DataVar uintptr, NotifyVar *DestroyNotify) { |
| 992 | 992 | ||||
| 993 | - | xSourceSetCallback(x.GoPointer(), purego.NewCallback(FuncVar), DataVar, purego.NewCallback(NotifyVar)) | 993 | + | xSourceSetCallback(x.GoPointer(), NewCallback(FuncVar), DataVar, NewCallback(NotifyVar)) |
| 994 | 994 | ||||
| 995 | } | 995 | } | ||
| 996 | 996 | ||||
| @@ -1042,9 +1042,9 @@ var xSourceSetDisposeFunction func(uintptr, uintptr) | |||||
| 1042 | // @source is already partially freed and not valid anymore. | 1042 | // @source is already partially freed and not valid anymore. | ||
| 1043 | // | 1043 | // | ||
| 1044 | // This should only ever be called from #GSource implementations. | 1044 | // This should only ever be called from #GSource implementations. | ||
| 1045 | - | func (x *Source) SetDisposeFunction(DisposeVar SourceDisposeFunc) { | 1045 | + | func (x *Source) SetDisposeFunction(DisposeVar *SourceDisposeFunc) { |
| 1046 | 1046 | ||||
| 1047 | - | xSourceSetDisposeFunction(x.GoPointer(), purego.NewCallback(DisposeVar)) | 1047 | + | xSourceSetDisposeFunction(x.GoPointer(), NewCallback(DisposeVar)) |
| 1048 | 1048 | ||||
| 1049 | } | 1049 | } | ||
| 1050 | 1050 | ||||
| @@ -1273,9 +1273,9 @@ var xChildWatchAdd func(Pid, uintptr, uintptr) uint | |||||
| 1273 | // g_child_watch_source_new() and attaches it to the main loop context | 1273 | // g_child_watch_source_new() and attaches it to the main loop context | ||
| 1274 | // using g_source_attach(). You can do these steps manually if you | 1274 | // using g_source_attach(). You can do these steps manually if you | ||
| 1275 | // need greater control. | 1275 | // need greater control. | ||
| 1276 | - | func ChildWatchAdd(PidVar Pid, FunctionVar ChildWatchFunc, DataVar uintptr) uint { | 1276 | + | func ChildWatchAdd(PidVar Pid, FunctionVar *ChildWatchFunc, DataVar uintptr) uint { |
| 1277 | 1277 | ||||
| 1278 | - | cret := xChildWatchAdd(PidVar, purego.NewCallback(FunctionVar), DataVar) | 1278 | + | cret := xChildWatchAdd(PidVar, NewCallback(FunctionVar), DataVar) |
| 1279 | return cret | 1279 | return cret | ||
| 1280 | } | 1280 | } | ||
| 1281 | 1281 | ||||
| @@ -1305,9 +1305,9 @@ var xChildWatchAddFull func(int, Pid, uintptr, uintptr, uintptr) uint | |||||
| 1305 | // g_child_watch_source_new() and attaches it to the main loop context | 1305 | // g_child_watch_source_new() and attaches it to the main loop context | ||
| 1306 | // using g_source_attach(). You can do these steps manually if you | 1306 | // using g_source_attach(). You can do these steps manually if you | ||
| 1307 | // need greater control. | 1307 | // need greater control. | ||
| 1308 | - | func ChildWatchAddFull(PriorityVar int, PidVar Pid, FunctionVar ChildWatchFunc, DataVar uintptr, NotifyVar DestroyNotify) uint { | 1308 | + | func ChildWatchAddFull(PriorityVar int, PidVar Pid, FunctionVar *ChildWatchFunc, DataVar uintptr, NotifyVar *DestroyNotify) uint { |
| 1309 | 1309 | ||||
| 1310 | - | cret := xChildWatchAddFull(PriorityVar, PidVar, purego.NewCallback(FunctionVar), DataVar, purego.NewCallback(NotifyVar)) | 1310 | + | cret := xChildWatchAddFull(PriorityVar, PidVar, NewCallback(FunctionVar), DataVar, NewCallback(NotifyVar)) |
| 1311 | return cret | 1311 | return cret | ||
| 1312 | } | 1312 | } | ||
| 1313 | 1313 | ||||
| @@ -1363,9 +1363,9 @@ var xClearHandleId func(uint, uintptr) | |||||
| 1363 | // | 1363 | // | ||
| 1364 | // A macro is also included that allows this function to be used without | 1364 | // A macro is also included that allows this function to be used without | ||
| 1365 | // pointer casts. | 1365 | // pointer casts. | ||
| 1366 | - | func ClearHandleId(TagPtrVar uint, ClearFuncVar ClearHandleFunc) { | 1366 | + | func ClearHandleId(TagPtrVar uint, ClearFuncVar *ClearHandleFunc) { |
| 1367 | 1367 | ||||
| 1368 | - | xClearHandleId(TagPtrVar, purego.NewCallback(ClearFuncVar)) | 1368 | + | xClearHandleId(TagPtrVar, NewCallback(ClearFuncVar)) |
| 1369 | 1369 | ||||
| 1370 | } | 1370 | } | ||
| 1371 | 1371 | ||||
| @@ -1431,9 +1431,9 @@ var xIdleAdd func(uintptr, uintptr) uint | |||||
| 1431 | // the callback will be invoked in whichever thread is running that main | 1431 | // the callback will be invoked in whichever thread is running that main | ||
| 1432 | // context. You can do these steps manually if you need greater control or to | 1432 | // context. You can do these steps manually if you need greater control or to | ||
| 1433 | // use a custom main context. | 1433 | // use a custom main context. | ||
| 1434 | - | func IdleAdd(FunctionVar SourceFunc, DataVar uintptr) uint { | 1434 | + | func IdleAdd(FunctionVar *SourceFunc, DataVar uintptr) uint { |
| 1435 | 1435 | ||||
| 1436 | - | cret := xIdleAdd(purego.NewCallback(FunctionVar), DataVar) | 1436 | + | cret := xIdleAdd(NewCallback(FunctionVar), DataVar) |
| 1437 | return cret | 1437 | return cret | ||
| 1438 | } | 1438 | } | ||
| 1439 | 1439 | ||||
| @@ -1453,9 +1453,9 @@ var xIdleAddFull func(int, uintptr, uintptr, uintptr) uint | |||||
| 1453 | // the callback will be invoked in whichever thread is running that main | 1453 | // the callback will be invoked in whichever thread is running that main | ||
| 1454 | // context. You can do these steps manually if you need greater control or to | 1454 | // context. You can do these steps manually if you need greater control or to | ||
| 1455 | // use a custom main context. | 1455 | // use a custom main context. | ||
| 1456 | - | func IdleAddFull(PriorityVar int, FunctionVar SourceFunc, DataVar uintptr, NotifyVar DestroyNotify) uint { | 1456 | + | func IdleAddFull(PriorityVar int, FunctionVar *SourceFunc, DataVar uintptr, NotifyVar *DestroyNotify) uint { |
| 1457 | 1457 | ||||
| 1458 | - | cret := xIdleAddFull(PriorityVar, purego.NewCallback(FunctionVar), DataVar, purego.NewCallback(NotifyVar)) | 1458 | + | cret := xIdleAddFull(PriorityVar, NewCallback(FunctionVar), DataVar, NewCallback(NotifyVar)) |
| 1459 | return cret | 1459 | return cret | ||
| 1460 | } | 1460 | } | ||
| 1461 | 1461 | ||||
| @@ -1762,9 +1762,9 @@ var xTimeoutAdd func(uint, uintptr, uintptr) uint | |||||
| 1762 | // | 1762 | // | ||
| 1763 | // The interval given is in terms of monotonic time, not wall clock | 1763 | // The interval given is in terms of monotonic time, not wall clock | ||
| 1764 | // time. See g_get_monotonic_time(). | 1764 | // time. See g_get_monotonic_time(). | ||
| 1765 | - | func TimeoutAdd(IntervalVar uint, FunctionVar SourceFunc, DataVar uintptr) uint { | 1765 | + | func TimeoutAdd(IntervalVar uint, FunctionVar *SourceFunc, DataVar uintptr) uint { |
| 1766 | 1766 | ||||
| 1767 | - | cret := xTimeoutAdd(IntervalVar, purego.NewCallback(FunctionVar), DataVar) | 1767 | + | cret := xTimeoutAdd(IntervalVar, NewCallback(FunctionVar), DataVar) |
| 1768 | return cret | 1768 | return cret | ||
| 1769 | } | 1769 | } | ||
| 1770 | 1770 | ||||
| @@ -1794,9 +1794,9 @@ var xTimeoutAddFull func(int, uint, uintptr, uintptr, uintptr) uint | |||||
| 1794 | // | 1794 | // | ||
| 1795 | // The interval given is in terms of monotonic time, not wall clock time. | 1795 | // The interval given is in terms of monotonic time, not wall clock time. | ||
| 1796 | // See g_get_monotonic_time(). | 1796 | // See g_get_monotonic_time(). | ||
| 1797 | - | func TimeoutAddFull(PriorityVar int, IntervalVar uint, FunctionVar SourceFunc, DataVar uintptr, NotifyVar DestroyNotify) uint { | 1797 | + | func TimeoutAddFull(PriorityVar int, IntervalVar uint, FunctionVar *SourceFunc, DataVar uintptr, NotifyVar *DestroyNotify) uint { |
| 1798 | 1798 | ||||
| 1799 | - | cret := xTimeoutAddFull(PriorityVar, IntervalVar, purego.NewCallback(FunctionVar), DataVar, purego.NewCallback(NotifyVar)) | 1799 | + | cret := xTimeoutAddFull(PriorityVar, IntervalVar, NewCallback(FunctionVar), DataVar, NewCallback(NotifyVar)) |
| 1800 | return cret | 1800 | return cret | ||
| 1801 | } | 1801 | } | ||
| 1802 | 1802 | ||||
| @@ -1825,9 +1825,9 @@ var xTimeoutAddSeconds func(uint, uintptr, uintptr) uint | |||||
| 1825 | // | 1825 | // | ||
| 1826 | // The interval given is in terms of monotonic time, not wall clock | 1826 | // The interval given is in terms of monotonic time, not wall clock | ||
| 1827 | // time. See g_get_monotonic_time(). | 1827 | // time. See g_get_monotonic_time(). | ||
| 1828 | - | func TimeoutAddSeconds(IntervalVar uint, FunctionVar SourceFunc, DataVar uintptr) uint { | 1828 | + | func TimeoutAddSeconds(IntervalVar uint, FunctionVar *SourceFunc, DataVar uintptr) uint { |
| 1829 | 1829 | ||||
| 1830 | - | cret := xTimeoutAddSeconds(IntervalVar, purego.NewCallback(FunctionVar), DataVar) | 1830 | + | cret := xTimeoutAddSeconds(IntervalVar, NewCallback(FunctionVar), DataVar) |
| 1831 | return cret | 1831 | return cret | ||
| 1832 | } | 1832 | } | ||
| 1833 | 1833 | ||||
| @@ -1872,9 +1872,9 @@ var xTimeoutAddSecondsFull func(int, uint, uintptr, uintptr, uintptr) uint | |||||
| 1872 | // | 1872 | // | ||
| 1873 | // The interval given is in terms of monotonic time, not wall clock | 1873 | // The interval given is in terms of monotonic time, not wall clock | ||
| 1874 | // time. See g_get_monotonic_time(). | 1874 | // time. See g_get_monotonic_time(). | ||
| 1875 | - | func TimeoutAddSecondsFull(PriorityVar int, IntervalVar uint, FunctionVar SourceFunc, DataVar uintptr, NotifyVar DestroyNotify) uint { | 1875 | + | func TimeoutAddSecondsFull(PriorityVar int, IntervalVar uint, FunctionVar *SourceFunc, DataVar uintptr, NotifyVar *DestroyNotify) uint { |
| 1876 | 1876 | ||||
| 1877 | - | cret := xTimeoutAddSecondsFull(PriorityVar, IntervalVar, purego.NewCallback(FunctionVar), DataVar, purego.NewCallback(NotifyVar)) | 1877 | + | cret := xTimeoutAddSecondsFull(PriorityVar, IntervalVar, NewCallback(FunctionVar), DataVar, NewCallback(NotifyVar)) |
| 1878 | return cret | 1878 | return cret | ||
| 1879 | } | 1879 | } | ||
| 1880 | 1880 | ||||
M v4/glib/gmarkup.go +2 -2
| @@ -27,9 +27,9 @@ var xNewMarkupParseContext func(*MarkupParser, MarkupParseFlags, uintptr, uintpt | |||||
| 27 | // a context, as long as no errors occur; once an error occurs, | 27 | // a context, as long as no errors occur; once an error occurs, | ||
| 28 | // the parse context can't continue to parse text (you have to | 28 | // the parse context can't continue to parse text (you have to | ||
| 29 | // free it and create a new parse context). | 29 | // free it and create a new parse context). | ||
| 30 | - | func NewMarkupParseContext(ParserVar *MarkupParser, FlagsVar MarkupParseFlags, UserDataVar uintptr, UserDataDnotifyVar DestroyNotify) *MarkupParseContext { | 30 | + | func NewMarkupParseContext(ParserVar *MarkupParser, FlagsVar MarkupParseFlags, UserDataVar uintptr, UserDataDnotifyVar *DestroyNotify) *MarkupParseContext { |
| 31 | 31 | ||||
| 32 | - | cret := xNewMarkupParseContext(ParserVar, FlagsVar, UserDataVar, purego.NewCallback(UserDataDnotifyVar)) | 32 | + | cret := xNewMarkupParseContext(ParserVar, FlagsVar, UserDataVar, NewCallback(UserDataDnotifyVar)) |
| 33 | return cret | 33 | return cret | ||
| 34 | } | 34 | } | ||
| 35 | 35 | ||||
M v4/glib/gmem.go +2 -2
| @@ -70,9 +70,9 @@ var xClearPointer func(uintptr, uintptr) | |||||
| 70 | // compatible with being called as `GDestroyNotify` using the standard calling | 70 | // compatible with being called as `GDestroyNotify` using the standard calling | ||
| 71 | // convention for the platform that GLib was compiled for; otherwise the program | 71 | // convention for the platform that GLib was compiled for; otherwise the program | ||
| 72 | // will experience undefined behaviour. | 72 | // will experience undefined behaviour. | ||
| 73 | - | func ClearPointer(PpVar uintptr, DestroyVar DestroyNotify) { | 73 | + | func ClearPointer(PpVar uintptr, DestroyVar *DestroyNotify) { |
| 74 | 74 | ||||
| 75 | - | xClearPointer(PpVar, purego.NewCallback(DestroyVar)) | 75 | + | xClearPointer(PpVar, NewCallback(DestroyVar)) |
| 76 | 76 | ||||
| 77 | } | 77 | } | ||
| 78 | 78 | ||||
M v4/glib/gmessages.go +12 -12
| @@ -283,9 +283,9 @@ var xLogSetDefaultHandler func(uintptr, uintptr) uintptr | |||||
| 283 | // | 283 | // | ||
| 284 | // This has no effect if structured logging is enabled; see | 284 | // This has no effect if structured logging is enabled; see | ||
| 285 | // [Using Structured Logging][using-structured-logging]. | 285 | // [Using Structured Logging][using-structured-logging]. | ||
| 286 | - | func LogSetDefaultHandler(LogFuncVar LogFunc, UserDataVar uintptr) uintptr { | 286 | + | func LogSetDefaultHandler(LogFuncVar *LogFunc, UserDataVar uintptr) uintptr { |
| 287 | 287 | ||||
| 288 | - | cret := xLogSetDefaultHandler(purego.NewCallback(LogFuncVar), UserDataVar) | 288 | + | cret := xLogSetDefaultHandler(NewCallback(LogFuncVar), UserDataVar) |
| 289 | return cret | 289 | return cret | ||
| 290 | } | 290 | } | ||
| 291 | 291 | ||||
| @@ -352,9 +352,9 @@ var xLogSetHandler func(string, LogLevelFlags, uintptr, uintptr) uint | |||||
| 352 | // | G_LOG_FLAG_RECURSION, my_log_handler, NULL); | 352 | // | G_LOG_FLAG_RECURSION, my_log_handler, NULL); | ||
| 353 | // | 353 | // | ||
| 354 | // ]| | 354 | // ]| | ||
| 355 | - | func LogSetHandler(LogDomainVar string, LogLevelsVar LogLevelFlags, LogFuncVar LogFunc, UserDataVar uintptr) uint { | 355 | + | func LogSetHandler(LogDomainVar string, LogLevelsVar LogLevelFlags, LogFuncVar *LogFunc, UserDataVar uintptr) uint { |
| 356 | 356 | ||||
| 357 | - | cret := xLogSetHandler(LogDomainVar, LogLevelsVar, purego.NewCallback(LogFuncVar), UserDataVar) | 357 | + | cret := xLogSetHandler(LogDomainVar, LogLevelsVar, NewCallback(LogFuncVar), UserDataVar) |
| 358 | return cret | 358 | return cret | ||
| 359 | } | 359 | } | ||
| 360 | 360 | ||||
| @@ -364,9 +364,9 @@ var xLogSetHandlerFull func(string, LogLevelFlags, uintptr, uintptr, uintptr) ui | |||||
| 364 | // | 364 | // | ||
| 365 | // This has no effect if structured logging is enabled; see | 365 | // This has no effect if structured logging is enabled; see | ||
| 366 | // [Using Structured Logging][using-structured-logging]. | 366 | // [Using Structured Logging][using-structured-logging]. | ||
| 367 | - | func LogSetHandlerFull(LogDomainVar string, LogLevelsVar LogLevelFlags, LogFuncVar LogFunc, UserDataVar uintptr, DestroyVar DestroyNotify) uint { | 367 | + | func LogSetHandlerFull(LogDomainVar string, LogLevelsVar LogLevelFlags, LogFuncVar *LogFunc, UserDataVar uintptr, DestroyVar *DestroyNotify) uint { |
| 368 | 368 | ||||
| 369 | - | cret := xLogSetHandlerFull(LogDomainVar, LogLevelsVar, purego.NewCallback(LogFuncVar), UserDataVar, purego.NewCallback(DestroyVar)) | 369 | + | cret := xLogSetHandlerFull(LogDomainVar, LogLevelsVar, NewCallback(LogFuncVar), UserDataVar, NewCallback(DestroyVar)) |
| 370 | return cret | 370 | return cret | ||
| 371 | } | 371 | } | ||
| 372 | 372 | ||||
| @@ -381,9 +381,9 @@ var xLogSetWriterFunc func(uintptr, uintptr, uintptr) | |||||
| 381 | // log messages are formatted and outputted. | 381 | // log messages are formatted and outputted. | ||
| 382 | // | 382 | // | ||
| 383 | // There can only be one writer function. It is an error to set more than one. | 383 | // There can only be one writer function. It is an error to set more than one. | ||
| 384 | - | func LogSetWriterFunc(FuncVar LogWriterFunc, UserDataVar uintptr, UserDataFreeVar DestroyNotify) { | 384 | + | func LogSetWriterFunc(FuncVar *LogWriterFunc, UserDataVar uintptr, UserDataFreeVar *DestroyNotify) { |
| 385 | 385 | ||||
| 386 | - | xLogSetWriterFunc(purego.NewCallback(FuncVar), UserDataVar, purego.NewCallback(UserDataFreeVar)) | 386 | + | xLogSetWriterFunc(NewCallback(FuncVar), UserDataVar, NewCallback(UserDataFreeVar)) |
| 387 | 387 | ||||
| 388 | } | 388 | } | ||
| 389 | 389 | ||||
| @@ -784,9 +784,9 @@ var xSetPrintHandler func(uintptr) uintptr | |||||
| 784 | // the message to stdout. By providing your own handler | 784 | // the message to stdout. By providing your own handler | ||
| 785 | // you can redirect the output, to a GTK+ widget or a | 785 | // you can redirect the output, to a GTK+ widget or a | ||
| 786 | // log file for example. | 786 | // log file for example. | ||
| 787 | - | func SetPrintHandler(FuncVar PrintFunc) uintptr { | 787 | + | func SetPrintHandler(FuncVar *PrintFunc) uintptr { |
| 788 | 788 | ||||
| 789 | - | cret := xSetPrintHandler(purego.NewCallback(FuncVar)) | 789 | + | cret := xSetPrintHandler(NewCallback(FuncVar)) |
| 790 | return cret | 790 | return cret | ||
| 791 | } | 791 | } | ||
| 792 | 792 | ||||
| @@ -799,9 +799,9 @@ var xSetPrinterrHandler func(uintptr) uintptr | |||||
| 799 | // message to stderr. By providing your own handler you can | 799 | // message to stderr. By providing your own handler you can | ||
| 800 | // redirect the output, to a GTK+ widget or a log file for | 800 | // redirect the output, to a GTK+ widget or a log file for | ||
| 801 | // example. | 801 | // example. | ||
| 802 | - | func SetPrinterrHandler(FuncVar PrintFunc) uintptr { | 802 | + | func SetPrinterrHandler(FuncVar *PrintFunc) uintptr { |
| 803 | 803 | ||||
| 804 | - | cret := xSetPrinterrHandler(purego.NewCallback(FuncVar)) | 804 | + | cret := xSetPrinterrHandler(NewCallback(FuncVar)) |
| 805 | return cret | 805 | return cret | ||
| 806 | } | 806 | } | ||
| 807 | 807 | ||||
M v4/glib/gnode.go +6 -6
| @@ -62,9 +62,9 @@ var xNodeChildrenForeach func(uintptr, TraverseFlags, uintptr, uintptr) | |||||
| 62 | // Calls a function for each of the children of a #GNode. Note that it | 62 | // Calls a function for each of the children of a #GNode. Note that it | ||
| 63 | // doesn't descend beneath the child nodes. @func must not do anything | 63 | // doesn't descend beneath the child nodes. @func must not do anything | ||
| 64 | // that would modify the structure of the tree. | 64 | // that would modify the structure of the tree. | ||
| 65 | - | func (x *Node) ChildrenForeach(FlagsVar TraverseFlags, FuncVar NodeForeachFunc, DataVar uintptr) { | 65 | + | func (x *Node) ChildrenForeach(FlagsVar TraverseFlags, FuncVar *NodeForeachFunc, DataVar uintptr) { |
| 66 | 66 | ||||
| 67 | - | xNodeChildrenForeach(x.GoPointer(), FlagsVar, purego.NewCallback(FuncVar), DataVar) | 67 | + | xNodeChildrenForeach(x.GoPointer(), FlagsVar, NewCallback(FuncVar), DataVar) |
| 68 | 68 | ||||
| 69 | } | 69 | } | ||
| 70 | 70 | ||||
| @@ -81,9 +81,9 @@ func (x *Node) Copy() *Node { | |||||
| 81 | var xNodeCopyDeep func(uintptr, uintptr, uintptr) *Node | 81 | var xNodeCopyDeep func(uintptr, uintptr, uintptr) *Node | ||
| 82 | 82 | ||||
| 83 | // Recursively copies a #GNode and its data. | 83 | // Recursively copies a #GNode and its data. | ||
| 84 | - | func (x *Node) CopyDeep(CopyFuncVar CopyFunc, DataVar uintptr) *Node { | 84 | + | func (x *Node) CopyDeep(CopyFuncVar *CopyFunc, DataVar uintptr) *Node { |
| 85 | 85 | ||||
| 86 | - | cret := xNodeCopyDeep(x.GoPointer(), purego.NewCallback(CopyFuncVar), DataVar) | 86 | + | cret := xNodeCopyDeep(x.GoPointer(), NewCallback(CopyFuncVar), DataVar) |
| 87 | return cret | 87 | return cret | ||
| 88 | } | 88 | } | ||
| 89 | 89 | ||||
| @@ -270,9 +270,9 @@ var xNodeTraverse func(uintptr, TraverseType, TraverseFlags, int, uintptr, uintp | |||||
| 270 | // It calls the given function for each node visited. | 270 | // It calls the given function for each node visited. | ||
| 271 | // The traversal can be halted at any point by returning %TRUE from @func. | 271 | // The traversal can be halted at any point by returning %TRUE from @func. | ||
| 272 | // @func must not do anything that would modify the structure of the tree. | 272 | // @func must not do anything that would modify the structure of the tree. | ||
| 273 | - | func (x *Node) Traverse(OrderVar TraverseType, FlagsVar TraverseFlags, MaxDepthVar int, FuncVar NodeTraverseFunc, DataVar uintptr) { | 273 | + | func (x *Node) Traverse(OrderVar TraverseType, FlagsVar TraverseFlags, MaxDepthVar int, FuncVar *NodeTraverseFunc, DataVar uintptr) { |
| 274 | 274 | ||||
| 275 | - | xNodeTraverse(x.GoPointer(), OrderVar, FlagsVar, MaxDepthVar, purego.NewCallback(FuncVar), DataVar) | 275 | + | xNodeTraverse(x.GoPointer(), OrderVar, FlagsVar, MaxDepthVar, NewCallback(FuncVar), DataVar) |
| 276 | 276 | ||||
| 277 | } | 277 | } | ||
| 278 | 278 | ||||
M v4/glib/goption.go +10 -10
| @@ -309,9 +309,9 @@ var xOptionContextSetTranslateFunc func(uintptr, uintptr, uintptr, uintptr) | |||||
| 309 | // | 309 | // | ||
| 310 | // If you are using gettext(), you only need to set the translation | 310 | // If you are using gettext(), you only need to set the translation | ||
| 311 | // domain, see g_option_context_set_translation_domain(). | 311 | // domain, see g_option_context_set_translation_domain(). | ||
| 312 | - | func (x *OptionContext) SetTranslateFunc(FuncVar TranslateFunc, DataVar uintptr, DestroyNotifyVar DestroyNotify) { | 312 | + | func (x *OptionContext) SetTranslateFunc(FuncVar *TranslateFunc, DataVar uintptr, DestroyNotifyVar *DestroyNotify) { |
| 313 | 313 | ||||
| 314 | - | xOptionContextSetTranslateFunc(x.GoPointer(), purego.NewCallback(FuncVar), DataVar, purego.NewCallback(DestroyNotifyVar)) | 314 | + | xOptionContextSetTranslateFunc(x.GoPointer(), NewCallback(FuncVar), DataVar, NewCallback(DestroyNotifyVar)) |
| 315 | 315 | ||||
| 316 | } | 316 | } | ||
| 317 | 317 | ||||
| @@ -365,9 +365,9 @@ func (x *OptionGroup) GoPointer() uintptr { | |||||
| 365 | var xNewOptionGroup func(string, string, string, uintptr, uintptr) *OptionGroup | 365 | var xNewOptionGroup func(string, string, string, uintptr, uintptr) *OptionGroup | ||
| 366 | 366 | ||||
| 367 | // Creates a new #GOptionGroup. | 367 | // Creates a new #GOptionGroup. | ||
| 368 | - | func NewOptionGroup(NameVar string, DescriptionVar string, HelpDescriptionVar string, UserDataVar uintptr, DestroyVar DestroyNotify) *OptionGroup { | 368 | + | func NewOptionGroup(NameVar string, DescriptionVar string, HelpDescriptionVar string, UserDataVar uintptr, DestroyVar *DestroyNotify) *OptionGroup { |
| 369 | 369 | ||||
| 370 | - | cret := xNewOptionGroup(NameVar, DescriptionVar, HelpDescriptionVar, UserDataVar, purego.NewCallback(DestroyVar)) | 370 | + | cret := xNewOptionGroup(NameVar, DescriptionVar, HelpDescriptionVar, UserDataVar, NewCallback(DestroyVar)) |
| 371 | return cret | 371 | return cret | ||
| 372 | } | 372 | } | ||
| 373 | 373 | ||||
| @@ -406,9 +406,9 @@ var xOptionGroupSetErrorHook func(uintptr, uintptr) | |||||
| 406 | // | 406 | // | ||
| 407 | // Note that the user data to be passed to @error_func can be | 407 | // Note that the user data to be passed to @error_func can be | ||
| 408 | // specified when constructing the group with g_option_group_new(). | 408 | // specified when constructing the group with g_option_group_new(). | ||
| 409 | - | func (x *OptionGroup) SetErrorHook(ErrorFuncVar OptionErrorFunc) { | 409 | + | func (x *OptionGroup) SetErrorHook(ErrorFuncVar *OptionErrorFunc) { |
| 410 | 410 | ||||
| 411 | - | xOptionGroupSetErrorHook(x.GoPointer(), purego.NewCallback(ErrorFuncVar)) | 411 | + | xOptionGroupSetErrorHook(x.GoPointer(), NewCallback(ErrorFuncVar)) |
| 412 | 412 | ||||
| 413 | } | 413 | } | ||
| 414 | 414 | ||||
| @@ -421,9 +421,9 @@ var xOptionGroupSetParseHooks func(uintptr, uintptr, uintptr) | |||||
| 421 | // Note that the user data to be passed to @pre_parse_func and | 421 | // Note that the user data to be passed to @pre_parse_func and | ||
| 422 | // @post_parse_func can be specified when constructing the group | 422 | // @post_parse_func can be specified when constructing the group | ||
| 423 | // with g_option_group_new(). | 423 | // with g_option_group_new(). | ||
| 424 | - | func (x *OptionGroup) SetParseHooks(PreParseFuncVar OptionParseFunc, PostParseFuncVar OptionParseFunc) { | 424 | + | func (x *OptionGroup) SetParseHooks(PreParseFuncVar *OptionParseFunc, PostParseFuncVar *OptionParseFunc) { |
| 425 | 425 | ||||
| 426 | - | xOptionGroupSetParseHooks(x.GoPointer(), purego.NewCallback(PreParseFuncVar), purego.NewCallback(PostParseFuncVar)) | 426 | + | xOptionGroupSetParseHooks(x.GoPointer(), NewCallback(PreParseFuncVar), NewCallback(PostParseFuncVar)) |
| 427 | 427 | ||||
| 428 | } | 428 | } | ||
| 429 | 429 | ||||
| @@ -435,9 +435,9 @@ var xOptionGroupSetTranslateFunc func(uintptr, uintptr, uintptr, uintptr) | |||||
| 435 | // | 435 | // | ||
| 436 | // If you are using gettext(), you only need to set the translation | 436 | // If you are using gettext(), you only need to set the translation | ||
| 437 | // domain, see g_option_group_set_translation_domain(). | 437 | // domain, see g_option_group_set_translation_domain(). | ||
| 438 | - | func (x *OptionGroup) SetTranslateFunc(FuncVar TranslateFunc, DataVar uintptr, DestroyNotifyVar DestroyNotify) { | 438 | + | func (x *OptionGroup) SetTranslateFunc(FuncVar *TranslateFunc, DataVar uintptr, DestroyNotifyVar *DestroyNotify) { |
| 439 | 439 | ||||
| 440 | - | xOptionGroupSetTranslateFunc(x.GoPointer(), purego.NewCallback(FuncVar), DataVar, purego.NewCallback(DestroyNotifyVar)) | 440 | + | xOptionGroupSetTranslateFunc(x.GoPointer(), NewCallback(FuncVar), DataVar, NewCallback(DestroyNotifyVar)) |
| 441 | 441 | ||||
| 442 | } | 442 | } | ||
| 443 | 443 | ||||
M v4/glib/gqsort.go +2 -2
| @@ -12,9 +12,9 @@ var xQsortWithData func(uintptr, int, uint, uintptr, uintptr) | |||||
| 12 | // the comparison routine accepts a user data argument. | 12 | // the comparison routine accepts a user data argument. | ||
| 13 | // | 13 | // | ||
| 14 | // This is guaranteed to be a stable sort since version 2.32. | 14 | // This is guaranteed to be a stable sort since version 2.32. | ||
| 15 | - | func QsortWithData(PbaseVar uintptr, TotalElemsVar int, SizeVar uint, CompareFuncVar CompareDataFunc, UserDataVar uintptr) { | 15 | + | func QsortWithData(PbaseVar uintptr, TotalElemsVar int, SizeVar uint, CompareFuncVar *CompareDataFunc, UserDataVar uintptr) { |
| 16 | 16 | ||||
| 17 | - | xQsortWithData(PbaseVar, TotalElemsVar, SizeVar, purego.NewCallback(CompareFuncVar), UserDataVar) | 17 | + | xQsortWithData(PbaseVar, TotalElemsVar, SizeVar, NewCallback(CompareFuncVar), UserDataVar) |
| 18 | 18 | ||||
| 19 | } | 19 | } | ||
| 20 | 20 | ||||
M v4/glib/gqueue.go +12 -12
| @@ -36,9 +36,9 @@ var xQueueClearFull func(uintptr, uintptr) | |||||
| 36 | 36 | ||||
| 37 | // Convenience method, which frees all the memory used by a #GQueue, | 37 | // Convenience method, which frees all the memory used by a #GQueue, | ||
| 38 | // and calls the provided @free_func on each item in the #GQueue. | 38 | // and calls the provided @free_func on each item in the #GQueue. | ||
| 39 | - | func (x *Queue) ClearFull(FreeFuncVar DestroyNotify) { | 39 | + | func (x *Queue) ClearFull(FreeFuncVar *DestroyNotify) { |
| 40 | 40 | ||||
| 41 | - | xQueueClearFull(x.GoPointer(), purego.NewCallback(FreeFuncVar)) | 41 | + | xQueueClearFull(x.GoPointer(), NewCallback(FreeFuncVar)) |
| 42 | 42 | ||||
| 43 | } | 43 | } | ||
| 44 | 44 | ||||
| @@ -80,9 +80,9 @@ var xQueueFindCustom func(uintptr, uintptr, uintptr) *List | |||||
| 80 | // which should return 0 when the desired element is found. The function | 80 | // which should return 0 when the desired element is found. The function | ||
| 81 | // takes two gconstpointer arguments, the #GQueue element's data as the | 81 | // takes two gconstpointer arguments, the #GQueue element's data as the | ||
| 82 | // first argument and the given user data as the second argument. | 82 | // first argument and the given user data as the second argument. | ||
| 83 | - | func (x *Queue) FindCustom(DataVar uintptr, FuncVar CompareFunc) *List { | 83 | + | func (x *Queue) FindCustom(DataVar uintptr, FuncVar *CompareFunc) *List { |
| 84 | 84 | ||||
| 85 | - | cret := xQueueFindCustom(x.GoPointer(), DataVar, purego.NewCallback(FuncVar)) | 85 | + | cret := xQueueFindCustom(x.GoPointer(), DataVar, NewCallback(FuncVar)) |
| 86 | return cret | 86 | return cret | ||
| 87 | } | 87 | } | ||
| 88 | 88 | ||||
| @@ -93,9 +93,9 @@ var xQueueForeach func(uintptr, uintptr, uintptr) | |||||
| 93 | // | 93 | // | ||
| 94 | // It is safe for @func to remove the element from @queue, but it must | 94 | // It is safe for @func to remove the element from @queue, but it must | ||
| 95 | // not modify any part of the queue after that element. | 95 | // not modify any part of the queue after that element. | ||
| 96 | - | func (x *Queue) Foreach(FuncVar Func, UserDataVar uintptr) { | 96 | + | func (x *Queue) Foreach(FuncVar *Func, UserDataVar uintptr) { |
| 97 | 97 | ||||
| 98 | - | xQueueForeach(x.GoPointer(), purego.NewCallback(FuncVar), UserDataVar) | 98 | + | xQueueForeach(x.GoPointer(), NewCallback(FuncVar), UserDataVar) |
| 99 | 99 | ||||
| 100 | } | 100 | } | ||
| 101 | 101 | ||||
| @@ -120,9 +120,9 @@ var xQueueFreeFull func(uintptr, uintptr) | |||||
| 120 | // | 120 | // | ||
| 121 | // @free_func should not modify the queue (eg, by removing the freed | 121 | // @free_func should not modify the queue (eg, by removing the freed | ||
| 122 | // element from it). | 122 | // element from it). | ||
| 123 | - | func (x *Queue) FreeFull(FreeFuncVar DestroyNotify) { | 123 | + | func (x *Queue) FreeFull(FreeFuncVar *DestroyNotify) { |
| 124 | 124 | ||||
| 125 | - | xQueueFreeFull(x.GoPointer(), purego.NewCallback(FreeFuncVar)) | 125 | + | xQueueFreeFull(x.GoPointer(), NewCallback(FreeFuncVar)) |
| 126 | 126 | ||||
| 127 | } | 127 | } | ||
| 128 | 128 | ||||
| @@ -205,9 +205,9 @@ func (x *Queue) InsertBeforeLink(SiblingVar *List, LinkVar *List) { | |||||
| 205 | var xQueueInsertSorted func(uintptr, uintptr, uintptr, uintptr) | 205 | var xQueueInsertSorted func(uintptr, uintptr, uintptr, uintptr) | ||
| 206 | 206 | ||||
| 207 | // Inserts @data into @queue using @func to determine the new position. | 207 | // Inserts @data into @queue using @func to determine the new position. | ||
| 208 | - | func (x *Queue) InsertSorted(DataVar uintptr, FuncVar CompareDataFunc, UserDataVar uintptr) { | 208 | + | func (x *Queue) InsertSorted(DataVar uintptr, FuncVar *CompareDataFunc, UserDataVar uintptr) { |
| 209 | 209 | ||||
| 210 | - | xQueueInsertSorted(x.GoPointer(), DataVar, purego.NewCallback(FuncVar), UserDataVar) | 210 | + | xQueueInsertSorted(x.GoPointer(), DataVar, NewCallback(FuncVar), UserDataVar) |
| 211 | 211 | ||||
| 212 | } | 212 | } | ||
| 213 | 213 | ||||
| @@ -421,9 +421,9 @@ func (x *Queue) Reverse() { | |||||
| 421 | var xQueueSort func(uintptr, uintptr, uintptr) | 421 | var xQueueSort func(uintptr, uintptr, uintptr) | ||
| 422 | 422 | ||||
| 423 | // Sorts @queue using @compare_func. | 423 | // Sorts @queue using @compare_func. | ||
| 424 | - | func (x *Queue) Sort(CompareFuncVar CompareDataFunc, UserDataVar uintptr) { | 424 | + | func (x *Queue) Sort(CompareFuncVar *CompareDataFunc, UserDataVar uintptr) { |
| 425 | 425 | ||||
| 426 | - | xQueueSort(x.GoPointer(), purego.NewCallback(CompareFuncVar), UserDataVar) | 426 | + | xQueueSort(x.GoPointer(), NewCallback(CompareFuncVar), UserDataVar) |
| 427 | 427 | ||||
| 428 | } | 428 | } | ||
| 429 | 429 | ||||
M v4/glib/grcbox.go +4 -4
| @@ -88,9 +88,9 @@ var xAtomicRcBoxReleaseFull func(uintptr, uintptr) | |||||
| 88 | // If the reference was the last one, it will call @clear_func | 88 | // If the reference was the last one, it will call @clear_func | ||
| 89 | // to clear the contents of @mem_block, and then will free the | 89 | // to clear the contents of @mem_block, and then will free the | ||
| 90 | // resources allocated for @mem_block. | 90 | // resources allocated for @mem_block. | ||
| 91 | - | func AtomicRcBoxReleaseFull(MemBlockVar uintptr, ClearFuncVar DestroyNotify) { | 91 | + | func AtomicRcBoxReleaseFull(MemBlockVar uintptr, ClearFuncVar *DestroyNotify) { |
| 92 | 92 | ||||
| 93 | - | xAtomicRcBoxReleaseFull(MemBlockVar, purego.NewCallback(ClearFuncVar)) | 93 | + | xAtomicRcBoxReleaseFull(MemBlockVar, NewCallback(ClearFuncVar)) |
| 94 | 94 | ||||
| 95 | } | 95 | } | ||
| 96 | 96 | ||||
| @@ -176,9 +176,9 @@ var xRcBoxReleaseFull func(uintptr, uintptr) | |||||
| 176 | // If the reference was the last one, it will call @clear_func | 176 | // If the reference was the last one, it will call @clear_func | ||
| 177 | // to clear the contents of @mem_block, and then will free the | 177 | // to clear the contents of @mem_block, and then will free the | ||
| 178 | // resources allocated for @mem_block. | 178 | // resources allocated for @mem_block. | ||
| 179 | - | func RcBoxReleaseFull(MemBlockVar uintptr, ClearFuncVar DestroyNotify) { | 179 | + | func RcBoxReleaseFull(MemBlockVar uintptr, ClearFuncVar *DestroyNotify) { |
| 180 | 180 | ||||
| 181 | - | xRcBoxReleaseFull(MemBlockVar, purego.NewCallback(ClearFuncVar)) | 181 | + | xRcBoxReleaseFull(MemBlockVar, NewCallback(ClearFuncVar)) |
| 182 | 182 | ||||
| 183 | } | 183 | } | ||
| 184 | 184 | ||||
M v4/glib/gregex.go +2 -2
| @@ -741,10 +741,10 @@ var xRegexReplaceEval func(uintptr, uintptr, int, int, RegexMatchFlags, uintptr, | |||||
| 741 | // | 741 | // | ||
| 742 | // ... | 742 | // ... | ||
| 743 | // ]| | 743 | // ]| | ||
| 744 | - | func (x *Regex) ReplaceEval(StringVar uintptr, StringLenVar int, StartPositionVar int, MatchOptionsVar RegexMatchFlags, EvalVar RegexEvalCallback, UserDataVar uintptr) (string, error) { | 744 | + | func (x *Regex) ReplaceEval(StringVar uintptr, StringLenVar int, StartPositionVar int, MatchOptionsVar RegexMatchFlags, EvalVar *RegexEvalCallback, UserDataVar uintptr) (string, error) { |
| 745 | var cerr *Error | 745 | var cerr *Error | ||
| 746 | 746 | ||||
| 747 | - | cret := xRegexReplaceEval(x.GoPointer(), StringVar, StringLenVar, StartPositionVar, MatchOptionsVar, purego.NewCallback(EvalVar), UserDataVar, &cerr) | 747 | + | cret := xRegexReplaceEval(x.GoPointer(), StringVar, StringLenVar, StartPositionVar, MatchOptionsVar, NewCallback(EvalVar), UserDataVar, &cerr) |
| 748 | if cerr == nil { | 748 | if cerr == nil { | ||
| 749 | return cret, nil | 749 | return cret, nil | ||
| 750 | } | 750 | } | ||
M v4/glib/gscanner.go +2 -2
| @@ -218,9 +218,9 @@ var xScannerScopeForeachSymbol func(uintptr, uint, uintptr, uintptr) | |||||
| 218 | // in the given scope of the #GScanner. The function is passed | 218 | // in the given scope of the #GScanner. The function is passed | ||
| 219 | // the symbol and value of each pair, and the given @user_data | 219 | // the symbol and value of each pair, and the given @user_data | ||
| 220 | // parameter. | 220 | // parameter. | ||
| 221 | - | func (x *Scanner) ScopeForeachSymbol(ScopeIdVar uint, FuncVar HFunc, UserDataVar uintptr) { | 221 | + | func (x *Scanner) ScopeForeachSymbol(ScopeIdVar uint, FuncVar *HFunc, UserDataVar uintptr) { |
| 222 | 222 | ||||
| 223 | - | xScannerScopeForeachSymbol(x.GoPointer(), ScopeIdVar, purego.NewCallback(FuncVar), UserDataVar) | 223 | + | xScannerScopeForeachSymbol(x.GoPointer(), ScopeIdVar, NewCallback(FuncVar), UserDataVar) |
| 224 | 224 | ||||
| 225 | } | 225 | } | ||
| 226 | 226 | ||||
M v4/glib/gsequence.go +18 -18
| @@ -35,9 +35,9 @@ var xSequenceForeach func(uintptr, uintptr, uintptr) | |||||
| 35 | 35 | ||||
| 36 | // Calls @func for each item in the sequence passing @user_data | 36 | // Calls @func for each item in the sequence passing @user_data | ||
| 37 | // to the function. @func must not modify the sequence itself. | 37 | // to the function. @func must not modify the sequence itself. | ||
| 38 | - | func (x *Sequence) Foreach(FuncVar Func, UserDataVar uintptr) { | 38 | + | func (x *Sequence) Foreach(FuncVar *Func, UserDataVar uintptr) { |
| 39 | 39 | ||||
| 40 | - | xSequenceForeach(x.GoPointer(), purego.NewCallback(FuncVar), UserDataVar) | 40 | + | xSequenceForeach(x.GoPointer(), NewCallback(FuncVar), UserDataVar) |
| 41 | 41 | ||||
| 42 | } | 42 | } | ||
| 43 | 43 | ||||
| @@ -105,9 +105,9 @@ var xSequenceInsertSorted func(uintptr, uintptr, uintptr, uintptr) *SequenceIter | |||||
| 105 | // Note that when adding a large amount of data to a #GSequence, | 105 | // Note that when adding a large amount of data to a #GSequence, | ||
| 106 | // it is more efficient to do unsorted insertions and then call | 106 | // it is more efficient to do unsorted insertions and then call | ||
| 107 | // g_sequence_sort() or g_sequence_sort_iter(). | 107 | // g_sequence_sort() or g_sequence_sort_iter(). | ||
| 108 | - | func (x *Sequence) InsertSorted(DataVar uintptr, CmpFuncVar CompareDataFunc, CmpDataVar uintptr) *SequenceIter { | 108 | + | func (x *Sequence) InsertSorted(DataVar uintptr, CmpFuncVar *CompareDataFunc, CmpDataVar uintptr) *SequenceIter { |
| 109 | 109 | ||||
| 110 | - | cret := xSequenceInsertSorted(x.GoPointer(), DataVar, purego.NewCallback(CmpFuncVar), CmpDataVar) | 110 | + | cret := xSequenceInsertSorted(x.GoPointer(), DataVar, NewCallback(CmpFuncVar), CmpDataVar) |
| 111 | return cret | 111 | return cret | ||
| 112 | } | 112 | } | ||
| 113 | 113 | ||||
| @@ -125,9 +125,9 @@ var xSequenceInsertSortedIter func(uintptr, uintptr, uintptr, uintptr) *Sequence | |||||
| 125 | // Note that when adding a large amount of data to a #GSequence, | 125 | // Note that when adding a large amount of data to a #GSequence, | ||
| 126 | // it is more efficient to do unsorted insertions and then call | 126 | // it is more efficient to do unsorted insertions and then call | ||
| 127 | // g_sequence_sort() or g_sequence_sort_iter(). | 127 | // g_sequence_sort() or g_sequence_sort_iter(). | ||
| 128 | - | func (x *Sequence) InsertSortedIter(DataVar uintptr, IterCmpVar SequenceIterCompareFunc, CmpDataVar uintptr) *SequenceIter { | 128 | + | func (x *Sequence) InsertSortedIter(DataVar uintptr, IterCmpVar *SequenceIterCompareFunc, CmpDataVar uintptr) *SequenceIter { |
| 129 | 129 | ||||
| 130 | - | cret := xSequenceInsertSortedIter(x.GoPointer(), DataVar, purego.NewCallback(IterCmpVar), CmpDataVar) | 130 | + | cret := xSequenceInsertSortedIter(x.GoPointer(), DataVar, NewCallback(IterCmpVar), CmpDataVar) |
| 131 | return cret | 131 | return cret | ||
| 132 | } | 132 | } | ||
| 133 | 133 | ||||
| @@ -159,9 +159,9 @@ var xSequenceLookup func(uintptr, uintptr, uintptr, uintptr) *SequenceIter | |||||
| 159 | // | 159 | // | ||
| 160 | // This function will fail if the data contained in the sequence is | 160 | // This function will fail if the data contained in the sequence is | ||
| 161 | // unsorted. | 161 | // unsorted. | ||
| 162 | - | func (x *Sequence) Lookup(DataVar uintptr, CmpFuncVar CompareDataFunc, CmpDataVar uintptr) *SequenceIter { | 162 | + | func (x *Sequence) Lookup(DataVar uintptr, CmpFuncVar *CompareDataFunc, CmpDataVar uintptr) *SequenceIter { |
| 163 | 163 | ||||
| 164 | - | cret := xSequenceLookup(x.GoPointer(), DataVar, purego.NewCallback(CmpFuncVar), CmpDataVar) | 164 | + | cret := xSequenceLookup(x.GoPointer(), DataVar, NewCallback(CmpFuncVar), CmpDataVar) |
| 165 | return cret | 165 | return cret | ||
| 166 | } | 166 | } | ||
| 167 | 167 | ||||
| @@ -177,9 +177,9 @@ var xSequenceLookupIter func(uintptr, uintptr, uintptr, uintptr) *SequenceIter | |||||
| 177 | // | 177 | // | ||
| 178 | // This function will fail if the data contained in the sequence is | 178 | // This function will fail if the data contained in the sequence is | ||
| 179 | // unsorted. | 179 | // unsorted. | ||
| 180 | - | func (x *Sequence) LookupIter(DataVar uintptr, IterCmpVar SequenceIterCompareFunc, CmpDataVar uintptr) *SequenceIter { | 180 | + | func (x *Sequence) LookupIter(DataVar uintptr, IterCmpVar *SequenceIterCompareFunc, CmpDataVar uintptr) *SequenceIter { |
| 181 | 181 | ||||
| 182 | - | cret := xSequenceLookupIter(x.GoPointer(), DataVar, purego.NewCallback(IterCmpVar), CmpDataVar) | 182 | + | cret := xSequenceLookupIter(x.GoPointer(), DataVar, NewCallback(IterCmpVar), CmpDataVar) |
| 183 | return cret | 183 | return cret | ||
| 184 | } | 184 | } | ||
| 185 | 185 | ||||
| @@ -207,9 +207,9 @@ var xSequenceSearch func(uintptr, uintptr, uintptr, uintptr) *SequenceIter | |||||
| 207 | // | 207 | // | ||
| 208 | // This function will fail if the data contained in the sequence is | 208 | // This function will fail if the data contained in the sequence is | ||
| 209 | // unsorted. | 209 | // unsorted. | ||
| 210 | - | func (x *Sequence) Search(DataVar uintptr, CmpFuncVar CompareDataFunc, CmpDataVar uintptr) *SequenceIter { | 210 | + | func (x *Sequence) Search(DataVar uintptr, CmpFuncVar *CompareDataFunc, CmpDataVar uintptr) *SequenceIter { |
| 211 | 211 | ||||
| 212 | - | cret := xSequenceSearch(x.GoPointer(), DataVar, purego.NewCallback(CmpFuncVar), CmpDataVar) | 212 | + | cret := xSequenceSearch(x.GoPointer(), DataVar, NewCallback(CmpFuncVar), CmpDataVar) |
| 213 | return cret | 213 | return cret | ||
| 214 | } | 214 | } | ||
| 215 | 215 | ||||
| @@ -228,9 +228,9 @@ var xSequenceSearchIter func(uintptr, uintptr, uintptr, uintptr) *SequenceIter | |||||
| 228 | // | 228 | // | ||
| 229 | // This function will fail if the data contained in the sequence is | 229 | // This function will fail if the data contained in the sequence is | ||
| 230 | // unsorted. | 230 | // unsorted. | ||
| 231 | - | func (x *Sequence) SearchIter(DataVar uintptr, IterCmpVar SequenceIterCompareFunc, CmpDataVar uintptr) *SequenceIter { | 231 | + | func (x *Sequence) SearchIter(DataVar uintptr, IterCmpVar *SequenceIterCompareFunc, CmpDataVar uintptr) *SequenceIter { |
| 232 | 232 | ||||
| 233 | - | cret := xSequenceSearchIter(x.GoPointer(), DataVar, purego.NewCallback(IterCmpVar), CmpDataVar) | 233 | + | cret := xSequenceSearchIter(x.GoPointer(), DataVar, NewCallback(IterCmpVar), CmpDataVar) |
| 234 | return cret | 234 | return cret | ||
| 235 | } | 235 | } | ||
| 236 | 236 | ||||
| @@ -242,9 +242,9 @@ var xSequenceSort func(uintptr, uintptr, uintptr) | |||||
| 242 | // return 0 if they are equal, a negative value if the | 242 | // return 0 if they are equal, a negative value if the | ||
| 243 | // first comes before the second, and a positive value | 243 | // first comes before the second, and a positive value | ||
| 244 | // if the second comes before the first. | 244 | // if the second comes before the first. | ||
| 245 | - | func (x *Sequence) Sort(CmpFuncVar CompareDataFunc, CmpDataVar uintptr) { | 245 | + | func (x *Sequence) Sort(CmpFuncVar *CompareDataFunc, CmpDataVar uintptr) { |
| 246 | 246 | ||||
| 247 | - | xSequenceSort(x.GoPointer(), purego.NewCallback(CmpFuncVar), CmpDataVar) | 247 | + | xSequenceSort(x.GoPointer(), NewCallback(CmpFuncVar), CmpDataVar) |
| 248 | 248 | ||||
| 249 | } | 249 | } | ||
| 250 | 250 | ||||
| @@ -257,9 +257,9 @@ var xSequenceSortIter func(uintptr, uintptr, uintptr) | |||||
| 257 | // return 0 if the iterators are equal, a negative value if the first | 257 | // return 0 if the iterators are equal, a negative value if the first | ||
| 258 | // iterator comes before the second, and a positive value if the second | 258 | // iterator comes before the second, and a positive value if the second | ||
| 259 | // iterator comes before the first. | 259 | // iterator comes before the first. | ||
| 260 | - | func (x *Sequence) SortIter(CmpFuncVar SequenceIterCompareFunc, CmpDataVar uintptr) { | 260 | + | func (x *Sequence) SortIter(CmpFuncVar *SequenceIterCompareFunc, CmpDataVar uintptr) { |
| 261 | 261 | ||||
| 262 | - | xSequenceSortIter(x.GoPointer(), purego.NewCallback(CmpFuncVar), CmpDataVar) | 262 | + | xSequenceSortIter(x.GoPointer(), NewCallback(CmpFuncVar), CmpDataVar) |
| 263 | 263 | ||||
| 264 | } | 264 | } | ||
| 265 | 265 | ||||
M v4/glib/gslist.go +2 -2
| @@ -25,9 +25,9 @@ var xClearSlist func(**SList, uintptr) | |||||
| 25 | // Clears a pointer to a #GSList, freeing it and, optionally, freeing its elements using @destroy. | 25 | // Clears a pointer to a #GSList, freeing it and, optionally, freeing its elements using @destroy. | ||
| 26 | // | 26 | // | ||
| 27 | // @slist_ptr must be a valid pointer. If @slist_ptr points to a null #GSList, this does nothing. | 27 | // @slist_ptr must be a valid pointer. If @slist_ptr points to a null #GSList, this does nothing. | ||
| 28 | - | func ClearSlist(SlistPtrVar **SList, DestroyVar DestroyNotify) { | 28 | + | func ClearSlist(SlistPtrVar **SList, DestroyVar *DestroyNotify) { |
| 29 | 29 | ||||
| 30 | - | xClearSlist(SlistPtrVar, purego.NewCallback(DestroyVar)) | 30 | + | xClearSlist(SlistPtrVar, NewCallback(DestroyVar)) |
| 31 | 31 | ||||
| 32 | } | 32 | } | ||
| 33 | 33 | ||||
M v4/glib/gspawn.go +10 -10
| @@ -146,10 +146,10 @@ var xSpawnAsync func(string, uintptr, uintptr, SpawnFlags, uintptr, uintptr, *Pi | |||||
| 146 | // Note that the returned @child_pid on Windows is a handle to the child | 146 | // Note that the returned @child_pid on Windows is a handle to the child | ||
| 147 | // process and not its identifier. Process handles and process identifiers | 147 | // process and not its identifier. Process handles and process identifiers | ||
| 148 | // are different concepts on Windows. | 148 | // are different concepts on Windows. | ||
| 149 | - | func SpawnAsync(WorkingDirectoryVar string, ArgvVar uintptr, EnvpVar uintptr, FlagsVar SpawnFlags, ChildSetupVar SpawnChildSetupFunc, UserDataVar uintptr, ChildPidVar *Pid) (bool, error) { | 149 | + | func SpawnAsync(WorkingDirectoryVar string, ArgvVar uintptr, EnvpVar uintptr, FlagsVar SpawnFlags, ChildSetupVar *SpawnChildSetupFunc, UserDataVar uintptr, ChildPidVar *Pid) (bool, error) { |
| 150 | var cerr *Error | 150 | var cerr *Error | ||
| 151 | 151 | ||||
| 152 | - | cret := xSpawnAsync(WorkingDirectoryVar, ArgvVar, EnvpVar, FlagsVar, purego.NewCallback(ChildSetupVar), UserDataVar, ChildPidVar, &cerr) | 152 | + | cret := xSpawnAsync(WorkingDirectoryVar, ArgvVar, EnvpVar, FlagsVar, NewCallback(ChildSetupVar), UserDataVar, ChildPidVar, &cerr) |
| 153 | if cerr == nil { | 153 | if cerr == nil { | ||
| 154 | return cret, nil | 154 | return cret, nil | ||
| 155 | } | 155 | } | ||
| @@ -163,10 +163,10 @@ var xSpawnAsyncWithFds func(string, uintptr, uintptr, SpawnFlags, uintptr, uintp | |||||
| 163 | // | 163 | // | ||
| 164 | // Identical to g_spawn_async_with_pipes_and_fds() but with `n_fds` set to zero, | 164 | // Identical to g_spawn_async_with_pipes_and_fds() but with `n_fds` set to zero, | ||
| 165 | // so no FD assignments are used. | 165 | // so no FD assignments are used. | ||
| 166 | - | func SpawnAsyncWithFds(WorkingDirectoryVar string, ArgvVar uintptr, EnvpVar uintptr, FlagsVar SpawnFlags, ChildSetupVar SpawnChildSetupFunc, UserDataVar uintptr, ChildPidVar *Pid, StdinFdVar int, StdoutFdVar int, StderrFdVar int) (bool, error) { | 166 | + | func SpawnAsyncWithFds(WorkingDirectoryVar string, ArgvVar uintptr, EnvpVar uintptr, FlagsVar SpawnFlags, ChildSetupVar *SpawnChildSetupFunc, UserDataVar uintptr, ChildPidVar *Pid, StdinFdVar int, StdoutFdVar int, StderrFdVar int) (bool, error) { |
| 167 | var cerr *Error | 167 | var cerr *Error | ||
| 168 | 168 | ||||
| 169 | - | cret := xSpawnAsyncWithFds(WorkingDirectoryVar, ArgvVar, EnvpVar, FlagsVar, purego.NewCallback(ChildSetupVar), UserDataVar, ChildPidVar, StdinFdVar, StdoutFdVar, StderrFdVar, &cerr) | 169 | + | cret := xSpawnAsyncWithFds(WorkingDirectoryVar, ArgvVar, EnvpVar, FlagsVar, NewCallback(ChildSetupVar), UserDataVar, ChildPidVar, StdinFdVar, StdoutFdVar, StderrFdVar, &cerr) |
| 170 | if cerr == nil { | 170 | if cerr == nil { | ||
| 171 | return cret, nil | 171 | return cret, nil | ||
| 172 | } | 172 | } | ||
| @@ -178,10 +178,10 @@ var xSpawnAsyncWithPipes func(string, uintptr, uintptr, SpawnFlags, uintptr, uin | |||||
| 178 | 178 | ||||
| 179 | // Identical to g_spawn_async_with_pipes_and_fds() but with `n_fds` set to zero, | 179 | // Identical to g_spawn_async_with_pipes_and_fds() but with `n_fds` set to zero, | ||
| 180 | // so no FD assignments are used. | 180 | // so no FD assignments are used. | ||
| 181 | - | func SpawnAsyncWithPipes(WorkingDirectoryVar string, ArgvVar uintptr, EnvpVar uintptr, FlagsVar SpawnFlags, ChildSetupVar SpawnChildSetupFunc, UserDataVar uintptr, ChildPidVar *Pid, StandardInputVar int, StandardOutputVar int, StandardErrorVar int) (bool, error) { | 181 | + | func SpawnAsyncWithPipes(WorkingDirectoryVar string, ArgvVar uintptr, EnvpVar uintptr, FlagsVar SpawnFlags, ChildSetupVar *SpawnChildSetupFunc, UserDataVar uintptr, ChildPidVar *Pid, StandardInputVar int, StandardOutputVar int, StandardErrorVar int) (bool, error) { |
| 182 | var cerr *Error | 182 | var cerr *Error | ||
| 183 | 183 | ||||
| 184 | - | cret := xSpawnAsyncWithPipes(WorkingDirectoryVar, ArgvVar, EnvpVar, FlagsVar, purego.NewCallback(ChildSetupVar), UserDataVar, ChildPidVar, StandardInputVar, StandardOutputVar, StandardErrorVar, &cerr) | 184 | + | cret := xSpawnAsyncWithPipes(WorkingDirectoryVar, ArgvVar, EnvpVar, FlagsVar, NewCallback(ChildSetupVar), UserDataVar, ChildPidVar, StandardInputVar, StandardOutputVar, StandardErrorVar, &cerr) |
| 185 | if cerr == nil { | 185 | if cerr == nil { | ||
| 186 | return cret, nil | 186 | return cret, nil | ||
| 187 | } | 187 | } | ||
| @@ -379,10 +379,10 @@ var xSpawnAsyncWithPipesAndFds func(string, uintptr, uintptr, SpawnFlags, uintpt | |||||
| 379 | // graphical application too, then to ensure that the spawned program opens its | 379 | // graphical application too, then to ensure that the spawned program opens its | ||
| 380 | // windows on the right screen, you may want to use #GdkAppLaunchContext, | 380 | // windows on the right screen, you may want to use #GdkAppLaunchContext, | ||
| 381 | // #GAppLaunchContext, or set the `DISPLAY` environment variable. | 381 | // #GAppLaunchContext, or set the `DISPLAY` environment variable. | ||
| 382 | - | func SpawnAsyncWithPipesAndFds(WorkingDirectoryVar string, ArgvVar uintptr, EnvpVar uintptr, FlagsVar SpawnFlags, ChildSetupVar SpawnChildSetupFunc, UserDataVar uintptr, StdinFdVar int, StdoutFdVar int, StderrFdVar int, SourceFdsVar uintptr, TargetFdsVar uintptr, NFdsVar uint, ChildPidOutVar *Pid, StdinPipeOutVar int, StdoutPipeOutVar int, StderrPipeOutVar int) (bool, error) { | 382 | + | func SpawnAsyncWithPipesAndFds(WorkingDirectoryVar string, ArgvVar uintptr, EnvpVar uintptr, FlagsVar SpawnFlags, ChildSetupVar *SpawnChildSetupFunc, UserDataVar uintptr, StdinFdVar int, StdoutFdVar int, StderrFdVar int, SourceFdsVar uintptr, TargetFdsVar uintptr, NFdsVar uint, ChildPidOutVar *Pid, StdinPipeOutVar int, StdoutPipeOutVar int, StderrPipeOutVar int) (bool, error) { |
| 383 | var cerr *Error | 383 | var cerr *Error | ||
| 384 | 384 | ||||
| 385 | - | cret := xSpawnAsyncWithPipesAndFds(WorkingDirectoryVar, ArgvVar, EnvpVar, FlagsVar, purego.NewCallback(ChildSetupVar), UserDataVar, StdinFdVar, StdoutFdVar, StderrFdVar, SourceFdsVar, TargetFdsVar, NFdsVar, ChildPidOutVar, StdinPipeOutVar, StdoutPipeOutVar, StderrPipeOutVar, &cerr) | 385 | + | cret := xSpawnAsyncWithPipesAndFds(WorkingDirectoryVar, ArgvVar, EnvpVar, FlagsVar, NewCallback(ChildSetupVar), UserDataVar, StdinFdVar, StdoutFdVar, StderrFdVar, SourceFdsVar, TargetFdsVar, NFdsVar, ChildPidOutVar, StdinPipeOutVar, StdoutPipeOutVar, StderrPipeOutVar, &cerr) |
| 386 | if cerr == nil { | 386 | if cerr == nil { | ||
| 387 | return cret, nil | 387 | return cret, nil | ||
| 388 | } | 388 | } | ||
| @@ -565,10 +565,10 @@ var xSpawnSync func(string, uintptr, uintptr, SpawnFlags, uintptr, uintptr, uint | |||||
| 565 | // This function calls g_spawn_async_with_pipes() internally; see that | 565 | // This function calls g_spawn_async_with_pipes() internally; see that | ||
| 566 | // function for full details on the other parameters and details on | 566 | // function for full details on the other parameters and details on | ||
| 567 | // how these functions work on Windows. | 567 | // how these functions work on Windows. | ||
| 568 | - | func SpawnSync(WorkingDirectoryVar string, ArgvVar uintptr, EnvpVar uintptr, FlagsVar SpawnFlags, ChildSetupVar SpawnChildSetupFunc, UserDataVar uintptr, StandardOutputVar uintptr, StandardErrorVar uintptr, WaitStatusVar int) (bool, error) { | 568 | + | func SpawnSync(WorkingDirectoryVar string, ArgvVar uintptr, EnvpVar uintptr, FlagsVar SpawnFlags, ChildSetupVar *SpawnChildSetupFunc, UserDataVar uintptr, StandardOutputVar uintptr, StandardErrorVar uintptr, WaitStatusVar int) (bool, error) { |
| 569 | var cerr *Error | 569 | var cerr *Error | ||
| 570 | 570 | ||||
| 571 | - | cret := xSpawnSync(WorkingDirectoryVar, ArgvVar, EnvpVar, FlagsVar, purego.NewCallback(ChildSetupVar), UserDataVar, StandardOutputVar, StandardErrorVar, WaitStatusVar, &cerr) | 571 | + | cret := xSpawnSync(WorkingDirectoryVar, ArgvVar, EnvpVar, FlagsVar, NewCallback(ChildSetupVar), UserDataVar, StandardOutputVar, StandardErrorVar, WaitStatusVar, &cerr) |
| 572 | if cerr == nil { | 572 | if cerr == nil { | ||
| 573 | return cret, nil | 573 | return cret, nil | ||
| 574 | } | 574 | } | ||
M v4/glib/gtestutils.go +14 -14
| @@ -377,9 +377,9 @@ var xTestAddDataFunc func(string, uintptr, uintptr) | |||||
| 377 | // No component of @testpath may start with a dot (`.`) if the | 377 | // No component of @testpath may start with a dot (`.`) if the | ||
| 378 | // %G_TEST_OPTION_ISOLATE_DIRS option is being used; and it is recommended to | 378 | // %G_TEST_OPTION_ISOLATE_DIRS option is being used; and it is recommended to | ||
| 379 | // do so even if it isn’t. | 379 | // do so even if it isn’t. | ||
| 380 | - | func TestAddDataFunc(TestpathVar string, TestDataVar uintptr, TestFuncVar TestDataFunc) { | 380 | + | func TestAddDataFunc(TestpathVar string, TestDataVar uintptr, TestFuncVar *TestDataFunc) { |
| 381 | 381 | ||||
| 382 | - | xTestAddDataFunc(TestpathVar, TestDataVar, purego.NewCallback(TestFuncVar)) | 382 | + | xTestAddDataFunc(TestpathVar, TestDataVar, NewCallback(TestFuncVar)) |
| 383 | 383 | ||||
| 384 | } | 384 | } | ||
| 385 | 385 | ||||
| @@ -387,9 +387,9 @@ var xTestAddDataFuncFull func(string, uintptr, uintptr, uintptr) | |||||
| 387 | 387 | ||||
| 388 | // Create a new test case, as with g_test_add_data_func(), but freeing | 388 | // Create a new test case, as with g_test_add_data_func(), but freeing | ||
| 389 | // @test_data after the test run is complete. | 389 | // @test_data after the test run is complete. | ||
| 390 | - | func TestAddDataFuncFull(TestpathVar string, TestDataVar uintptr, TestFuncVar TestDataFunc, DataFreeFuncVar DestroyNotify) { | 390 | + | func TestAddDataFuncFull(TestpathVar string, TestDataVar uintptr, TestFuncVar *TestDataFunc, DataFreeFuncVar *DestroyNotify) { |
| 391 | 391 | ||||
| 392 | - | xTestAddDataFuncFull(TestpathVar, TestDataVar, purego.NewCallback(TestFuncVar), purego.NewCallback(DataFreeFuncVar)) | 392 | + | xTestAddDataFuncFull(TestpathVar, TestDataVar, NewCallback(TestFuncVar), NewCallback(DataFreeFuncVar)) |
| 393 | 393 | ||||
| 394 | } | 394 | } | ||
| 395 | 395 | ||||
| @@ -407,17 +407,17 @@ var xTestAddFunc func(string, uintptr) | |||||
| 407 | // No component of @testpath may start with a dot (`.`) if the | 407 | // No component of @testpath may start with a dot (`.`) if the | ||
| 408 | // %G_TEST_OPTION_ISOLATE_DIRS option is being used; and it is recommended to | 408 | // %G_TEST_OPTION_ISOLATE_DIRS option is being used; and it is recommended to | ||
| 409 | // do so even if it isn’t. | 409 | // do so even if it isn’t. | ||
| 410 | - | func TestAddFunc(TestpathVar string, TestFuncVar TestFunc) { | 410 | + | func TestAddFunc(TestpathVar string, TestFuncVar *TestFunc) { |
| 411 | 411 | ||||
| 412 | - | xTestAddFunc(TestpathVar, purego.NewCallback(TestFuncVar)) | 412 | + | xTestAddFunc(TestpathVar, NewCallback(TestFuncVar)) |
| 413 | 413 | ||||
| 414 | } | 414 | } | ||
| 415 | 415 | ||||
| 416 | var xTestAddVtable func(string, uint, uintptr, uintptr, uintptr, uintptr) | 416 | var xTestAddVtable func(string, uint, uintptr, uintptr, uintptr, uintptr) | ||
| 417 | 417 | ||||
| 418 | - | func TestAddVtable(TestpathVar string, DataSizeVar uint, TestDataVar uintptr, DataSetupVar TestFixtureFunc, DataTestVar TestFixtureFunc, DataTeardownVar TestFixtureFunc) { | 418 | + | func TestAddVtable(TestpathVar string, DataSizeVar uint, TestDataVar uintptr, DataSetupVar *TestFixtureFunc, DataTestVar *TestFixtureFunc, DataTeardownVar *TestFixtureFunc) { |
| 419 | 419 | ||||
| 420 | - | xTestAddVtable(TestpathVar, DataSizeVar, TestDataVar, purego.NewCallback(DataSetupVar), purego.NewCallback(DataTestVar), purego.NewCallback(DataTeardownVar)) | 420 | + | xTestAddVtable(TestpathVar, DataSizeVar, TestDataVar, NewCallback(DataSetupVar), NewCallback(DataTestVar), NewCallback(DataTeardownVar)) |
| 421 | 421 | ||||
| 422 | } | 422 | } | ||
| 423 | 423 | ||||
| @@ -518,9 +518,9 @@ var xTestCreateCase func(string, uint, uintptr, uintptr, uintptr, uintptr) *Test | |||||
| 518 | // multiple tests. In this cases, g_test_create_case() will be | 518 | // multiple tests. In this cases, g_test_create_case() will be | ||
| 519 | // called with the same type of fixture (the @data_size argument), but varying | 519 | // called with the same type of fixture (the @data_size argument), but varying | ||
| 520 | // @test_name and @data_test arguments. | 520 | // @test_name and @data_test arguments. | ||
| 521 | - | func TestCreateCase(TestNameVar string, DataSizeVar uint, TestDataVar uintptr, DataSetupVar TestFixtureFunc, DataTestVar TestFixtureFunc, DataTeardownVar TestFixtureFunc) *TestCase { | 521 | + | func TestCreateCase(TestNameVar string, DataSizeVar uint, TestDataVar uintptr, DataSetupVar *TestFixtureFunc, DataTestVar *TestFixtureFunc, DataTeardownVar *TestFixtureFunc) *TestCase { |
| 522 | 522 | ||||
| 523 | - | cret := xTestCreateCase(TestNameVar, DataSizeVar, TestDataVar, purego.NewCallback(DataSetupVar), purego.NewCallback(DataTestVar), purego.NewCallback(DataTeardownVar)) | 523 | + | cret := xTestCreateCase(TestNameVar, DataSizeVar, TestDataVar, NewCallback(DataSetupVar), NewCallback(DataTestVar), NewCallback(DataTeardownVar)) |
| 524 | return cret | 524 | return cret | ||
| 525 | } | 525 | } | ||
| 526 | 526 | ||||
| @@ -798,9 +798,9 @@ var xTestLogSetFatalHandler func(uintptr, uintptr) | |||||
| 798 | // behaviour for specific log messages, programs must install a custom log | 798 | // behaviour for specific log messages, programs must install a custom log | ||
| 799 | // writer function using g_log_set_writer_func().See | 799 | // writer function using g_log_set_writer_func().See | ||
| 800 | // [Using Structured Logging][using-structured-logging]. | 800 | // [Using Structured Logging][using-structured-logging]. | ||
| 801 | - | func TestLogSetFatalHandler(LogFuncVar TestLogFatalFunc, UserDataVar uintptr) { | 801 | + | func TestLogSetFatalHandler(LogFuncVar *TestLogFatalFunc, UserDataVar uintptr) { |
| 802 | 802 | ||||
| 803 | - | xTestLogSetFatalHandler(purego.NewCallback(LogFuncVar), UserDataVar) | 803 | + | xTestLogSetFatalHandler(NewCallback(LogFuncVar), UserDataVar) |
| 804 | 804 | ||||
| 805 | } | 805 | } | ||
| 806 | 806 | ||||
| @@ -855,9 +855,9 @@ var xTestQueueDestroy func(uintptr, uintptr) | |||||
| 855 | // Resources are released in reverse queue order, that means enqueueing | 855 | // Resources are released in reverse queue order, that means enqueueing | ||
| 856 | // callback A before callback B will cause B() to be called before | 856 | // callback A before callback B will cause B() to be called before | ||
| 857 | // A() during teardown. | 857 | // A() during teardown. | ||
| 858 | - | func TestQueueDestroy(DestroyFuncVar DestroyNotify, DestroyDataVar uintptr) { | 858 | + | func TestQueueDestroy(DestroyFuncVar *DestroyNotify, DestroyDataVar uintptr) { |
| 859 | 859 | ||||
| 860 | - | xTestQueueDestroy(purego.NewCallback(DestroyFuncVar), DestroyDataVar) | 860 | + | xTestQueueDestroy(NewCallback(DestroyFuncVar), DestroyDataVar) |
| 861 | 861 | ||||
| 862 | } | 862 | } | ||
| 863 | 863 | ||||
M v4/glib/gthread.go +6 -6
| @@ -242,9 +242,9 @@ func (x *Once) GoPointer() uintptr { | |||||
| 242 | 242 | ||||
| 243 | var xOnceImpl func(uintptr, uintptr, uintptr) uintptr | 243 | var xOnceImpl func(uintptr, uintptr, uintptr) uintptr | ||
| 244 | 244 | ||||
| 245 | - | func (x *Once) Impl(FuncVar ThreadFunc, ArgVar uintptr) uintptr { | 245 | + | func (x *Once) Impl(FuncVar *ThreadFunc, ArgVar uintptr) uintptr { |
| 246 | 246 | ||||
| 247 | - | cret := xOnceImpl(x.GoPointer(), purego.NewCallback(FuncVar), ArgVar) | 247 | + | cret := xOnceImpl(x.GoPointer(), NewCallback(FuncVar), ArgVar) |
| 248 | return cret | 248 | return cret | ||
| 249 | } | 249 | } | ||
| 250 | 250 | ||||
| @@ -689,9 +689,9 @@ var xNewThread func(string, uintptr, uintptr) *Thread | |||||
| 689 | // inheriting the thread priority but were spawned with the default priority. | 689 | // inheriting the thread priority but were spawned with the default priority. | ||
| 690 | // Starting with GLib 2.64 the behaviour is now consistent between Windows and | 690 | // Starting with GLib 2.64 the behaviour is now consistent between Windows and | ||
| 691 | // POSIX and all threads inherit their parent thread's priority. | 691 | // POSIX and all threads inherit their parent thread's priority. | ||
| 692 | - | func NewThread(NameVar string, FuncVar ThreadFunc, DataVar uintptr) *Thread { | 692 | + | func NewThread(NameVar string, FuncVar *ThreadFunc, DataVar uintptr) *Thread { |
| 693 | 693 | ||||
| 694 | - | cret := xNewThread(NameVar, purego.NewCallback(FuncVar), DataVar) | 694 | + | cret := xNewThread(NameVar, NewCallback(FuncVar), DataVar) |
| 695 | return cret | 695 | return cret | ||
| 696 | } | 696 | } | ||
| 697 | 697 | ||||
| @@ -702,10 +702,10 @@ var xThreadTryNew func(string, uintptr, uintptr, **Error) *Thread | |||||
| 702 | // | 702 | // | ||
| 703 | // If a thread can not be created (due to resource limits), | 703 | // If a thread can not be created (due to resource limits), | ||
| 704 | // @error is set and %NULL is returned. | 704 | // @error is set and %NULL is returned. | ||
| 705 | - | func ThreadTryNew(NameVar string, FuncVar ThreadFunc, DataVar uintptr) (*Thread, error) { | 705 | + | func ThreadTryNew(NameVar string, FuncVar *ThreadFunc, DataVar uintptr) (*Thread, error) { |
| 706 | var cerr *Error | 706 | var cerr *Error | ||
| 707 | 707 | ||||
| 708 | - | cret := xThreadTryNew(NameVar, purego.NewCallback(FuncVar), DataVar, &cerr) | 708 | + | cret := xThreadTryNew(NameVar, NewCallback(FuncVar), DataVar, &cerr) |
| 709 | if cerr == nil { | 709 | if cerr == nil { | ||
| 710 | return cret, nil | 710 | return cret, nil | ||
| 711 | } | 711 | } | ||
M v4/glib/gthreadpool.go +2 -2
| @@ -144,9 +144,9 @@ var xThreadPoolSetSortFunction func(uintptr, uintptr, uintptr) | |||||
| 144 | // scheduled by the operating system and are executed at random. It | 144 | // scheduled by the operating system and are executed at random. It | ||
| 145 | // cannot be assumed that threads are executed in the order they are | 145 | // cannot be assumed that threads are executed in the order they are | ||
| 146 | // created. | 146 | // created. | ||
| 147 | - | func (x *ThreadPool) SetSortFunction(FuncVar CompareDataFunc, UserDataVar uintptr) { | 147 | + | func (x *ThreadPool) SetSortFunction(FuncVar *CompareDataFunc, UserDataVar uintptr) { |
| 148 | 148 | ||||
| 149 | - | xThreadPoolSetSortFunction(x.GoPointer(), purego.NewCallback(FuncVar), UserDataVar) | 149 | + | xThreadPoolSetSortFunction(x.GoPointer(), NewCallback(FuncVar), UserDataVar) |
| 150 | 150 | ||||
| 151 | } | 151 | } | ||
| 152 | 152 | ||||
M v4/glib/gtree.go +16 -16
| @@ -33,9 +33,9 @@ func (x *Tree) GoPointer() uintptr { | |||||
| 33 | var xNewTree func(uintptr) *Tree | 33 | var xNewTree func(uintptr) *Tree | ||
| 34 | 34 | ||||
| 35 | // Creates a new #GTree. | 35 | // Creates a new #GTree. | ||
| 36 | - | func NewTree(KeyCompareFuncVar CompareFunc) *Tree { | 36 | + | func NewTree(KeyCompareFuncVar *CompareFunc) *Tree { |
| 37 | 37 | ||||
| 38 | - | cret := xNewTree(purego.NewCallback(KeyCompareFuncVar)) | 38 | + | cret := xNewTree(NewCallback(KeyCompareFuncVar)) |
| 39 | return cret | 39 | return cret | ||
| 40 | } | 40 | } | ||
| 41 | 41 | ||||
| @@ -44,9 +44,9 @@ var xNewTreeFull func(uintptr, uintptr, uintptr, uintptr) *Tree | |||||
| 44 | // Creates a new #GTree like g_tree_new() and allows to specify functions | 44 | // Creates a new #GTree like g_tree_new() and allows to specify functions | ||
| 45 | // to free the memory allocated for the key and value that get called when | 45 | // to free the memory allocated for the key and value that get called when | ||
| 46 | // removing the entry from the #GTree. | 46 | // removing the entry from the #GTree. | ||
| 47 | - | func NewTreeFull(KeyCompareFuncVar CompareDataFunc, KeyCompareDataVar uintptr, KeyDestroyFuncVar DestroyNotify, ValueDestroyFuncVar DestroyNotify) *Tree { | 47 | + | func NewTreeFull(KeyCompareFuncVar *CompareDataFunc, KeyCompareDataVar uintptr, KeyDestroyFuncVar *DestroyNotify, ValueDestroyFuncVar *DestroyNotify) *Tree { |
| 48 | 48 | ||||
| 49 | - | cret := xNewTreeFull(purego.NewCallback(KeyCompareFuncVar), KeyCompareDataVar, purego.NewCallback(KeyDestroyFuncVar), purego.NewCallback(ValueDestroyFuncVar)) | 49 | + | cret := xNewTreeFull(NewCallback(KeyCompareFuncVar), KeyCompareDataVar, NewCallback(KeyDestroyFuncVar), NewCallback(ValueDestroyFuncVar)) |
| 50 | return cret | 50 | return cret | ||
| 51 | } | 51 | } | ||
| 52 | 52 | ||||
| @@ -54,9 +54,9 @@ var xNewTreeWithData func(uintptr, uintptr) *Tree | |||||
| 54 | 54 | ||||
| 55 | // Creates a new #GTree with a comparison function that accepts user data. | 55 | // Creates a new #GTree with a comparison function that accepts user data. | ||
| 56 | // See g_tree_new() for more details. | 56 | // See g_tree_new() for more details. | ||
| 57 | - | func NewTreeWithData(KeyCompareFuncVar CompareDataFunc, KeyCompareDataVar uintptr) *Tree { | 57 | + | func NewTreeWithData(KeyCompareFuncVar *CompareDataFunc, KeyCompareDataVar uintptr) *Tree { |
| 58 | 58 | ||||
| 59 | - | cret := xNewTreeWithData(purego.NewCallback(KeyCompareFuncVar), KeyCompareDataVar) | 59 | + | cret := xNewTreeWithData(NewCallback(KeyCompareFuncVar), KeyCompareDataVar) |
| 60 | return cret | 60 | return cret | ||
| 61 | } | 61 | } | ||
| 62 | 62 | ||||
| @@ -84,9 +84,9 @@ var xTreeForeach func(uintptr, uintptr, uintptr) | |||||
| 84 | // add/remove items). To remove all items matching a predicate, you need | 84 | // add/remove items). To remove all items matching a predicate, you need | ||
| 85 | // to add each item to a list in your #GTraverseFunc as you walk over | 85 | // to add each item to a list in your #GTraverseFunc as you walk over | ||
| 86 | // the tree, then walk the list and remove each item. | 86 | // the tree, then walk the list and remove each item. | ||
| 87 | - | func (x *Tree) Foreach(FuncVar TraverseFunc, UserDataVar uintptr) { | 87 | + | func (x *Tree) Foreach(FuncVar *TraverseFunc, UserDataVar uintptr) { |
| 88 | 88 | ||||
| 89 | - | xTreeForeach(x.GoPointer(), purego.NewCallback(FuncVar), UserDataVar) | 89 | + | xTreeForeach(x.GoPointer(), NewCallback(FuncVar), UserDataVar) |
| 90 | 90 | ||||
| 91 | } | 91 | } | ||
| 92 | 92 | ||||
| @@ -100,9 +100,9 @@ var xTreeForeachNode func(uintptr, uintptr, uintptr) | |||||
| 100 | // add/remove items). To remove all items matching a predicate, you need | 100 | // add/remove items). To remove all items matching a predicate, you need | ||
| 101 | // to add each item to a list in your #GTraverseFunc as you walk over | 101 | // to add each item to a list in your #GTraverseFunc as you walk over | ||
| 102 | // the tree, then walk the list and remove each item. | 102 | // the tree, then walk the list and remove each item. | ||
| 103 | - | func (x *Tree) ForeachNode(FuncVar TraverseNodeFunc, UserDataVar uintptr) { | 103 | + | func (x *Tree) ForeachNode(FuncVar *TraverseNodeFunc, UserDataVar uintptr) { |
| 104 | 104 | ||||
| 105 | - | xTreeForeachNode(x.GoPointer(), purego.NewCallback(FuncVar), UserDataVar) | 105 | + | xTreeForeachNode(x.GoPointer(), NewCallback(FuncVar), UserDataVar) |
| 106 | 106 | ||||
| 107 | } | 107 | } | ||
| 108 | 108 | ||||
| @@ -306,9 +306,9 @@ var xTreeSearch func(uintptr, uintptr, uintptr) uintptr | |||||
| 306 | // will proceed among the key/value pairs that have a smaller key; if | 306 | // will proceed among the key/value pairs that have a smaller key; if | ||
| 307 | // @search_func returns 1, searching will proceed among the key/value | 307 | // @search_func returns 1, searching will proceed among the key/value | ||
| 308 | // pairs that have a larger key. | 308 | // pairs that have a larger key. | ||
| 309 | - | func (x *Tree) Search(SearchFuncVar CompareFunc, UserDataVar uintptr) uintptr { | 309 | + | func (x *Tree) Search(SearchFuncVar *CompareFunc, UserDataVar uintptr) uintptr { |
| 310 | 310 | ||||
| 311 | - | cret := xTreeSearch(x.GoPointer(), purego.NewCallback(SearchFuncVar), UserDataVar) | 311 | + | cret := xTreeSearch(x.GoPointer(), NewCallback(SearchFuncVar), UserDataVar) |
| 312 | return cret | 312 | return cret | ||
| 313 | } | 313 | } | ||
| 314 | 314 | ||||
| @@ -323,9 +323,9 @@ var xTreeSearchNode func(uintptr, uintptr, uintptr) *TreeNode | |||||
| 323 | // will proceed among the key/value pairs that have a smaller key; if | 323 | // will proceed among the key/value pairs that have a smaller key; if | ||
| 324 | // @search_func returns 1, searching will proceed among the key/value | 324 | // @search_func returns 1, searching will proceed among the key/value | ||
| 325 | // pairs that have a larger key. | 325 | // pairs that have a larger key. | ||
| 326 | - | func (x *Tree) SearchNode(SearchFuncVar CompareFunc, UserDataVar uintptr) *TreeNode { | 326 | + | func (x *Tree) SearchNode(SearchFuncVar *CompareFunc, UserDataVar uintptr) *TreeNode { |
| 327 | 327 | ||||
| 328 | - | cret := xTreeSearchNode(x.GoPointer(), purego.NewCallback(SearchFuncVar), UserDataVar) | 328 | + | cret := xTreeSearchNode(x.GoPointer(), NewCallback(SearchFuncVar), UserDataVar) |
| 329 | return cret | 329 | return cret | ||
| 330 | } | 330 | } | ||
| 331 | 331 | ||||
| @@ -344,9 +344,9 @@ func (x *Tree) Steal(KeyVar uintptr) bool { | |||||
| 344 | var xTreeTraverse func(uintptr, uintptr, TraverseType, uintptr) | 344 | var xTreeTraverse func(uintptr, uintptr, TraverseType, uintptr) | ||
| 345 | 345 | ||||
| 346 | // Calls the given function for each node in the #GTree. | 346 | // Calls the given function for each node in the #GTree. | ||
| 347 | - | func (x *Tree) Traverse(TraverseFuncVar TraverseFunc, TraverseTypeVar TraverseType, UserDataVar uintptr) { | 347 | + | func (x *Tree) Traverse(TraverseFuncVar *TraverseFunc, TraverseTypeVar TraverseType, UserDataVar uintptr) { |
| 348 | 348 | ||||
| 349 | - | xTreeTraverse(x.GoPointer(), purego.NewCallback(TraverseFuncVar), TraverseTypeVar, UserDataVar) | 349 | + | xTreeTraverse(x.GoPointer(), NewCallback(TraverseFuncVar), TraverseTypeVar, UserDataVar) |
| 350 | 350 | ||||
| 351 | } | 351 | } | ||
| 352 | 352 | ||||
M v4/glib/gutils.go +2 -2
| @@ -108,9 +108,9 @@ var xAtexit func(uintptr) | |||||
| 108 | // As can be seen from the above, for portability it's best to avoid | 108 | // As can be seen from the above, for portability it's best to avoid | ||
| 109 | // calling g_atexit() (or atexit()) except in the main executable of a | 109 | // calling g_atexit() (or atexit()) except in the main executable of a | ||
| 110 | // program. | 110 | // program. | ||
| 111 | - | func Atexit(FuncVar VoidFunc) { | 111 | + | func Atexit(FuncVar *VoidFunc) { |
| 112 | 112 | ||||
| 113 | - | xAtexit(purego.NewCallback(FuncVar)) | 113 | + | xAtexit(NewCallback(FuncVar)) |
| 114 | 114 | ||||
| 115 | } | 115 | } | ||
| 116 | 116 | ||||
M v4/glib/gvariant.go +2 -2
| @@ -455,9 +455,9 @@ var xNewVariantFromData func(*VariantType, uintptr, uint, bool, uintptr, uintptr | |||||
| 455 | // @type being loaded. Otherwise this function will internally create a copy of | 455 | // @type being loaded. Otherwise this function will internally create a copy of | ||
| 456 | // the memory (since GLib 2.60) or (in older versions) fail and exit the | 456 | // the memory (since GLib 2.60) or (in older versions) fail and exit the | ||
| 457 | // process. | 457 | // process. | ||
| 458 | - | func NewVariantFromData(TypeVar *VariantType, DataVar uintptr, SizeVar uint, TrustedVar bool, NotifyVar DestroyNotify, UserDataVar uintptr) *Variant { | 458 | + | func NewVariantFromData(TypeVar *VariantType, DataVar uintptr, SizeVar uint, TrustedVar bool, NotifyVar *DestroyNotify, UserDataVar uintptr) *Variant { |
| 459 | 459 | ||||
| 460 | - | cret := xNewVariantFromData(TypeVar, DataVar, SizeVar, TrustedVar, purego.NewCallback(NotifyVar), UserDataVar) | 460 | + | cret := xNewVariantFromData(TypeVar, DataVar, SizeVar, TrustedVar, NewCallback(NotifyVar), UserDataVar) |
| 461 | return cret | 461 | return cret | ||
| 462 | } | 462 | } | ||
| 463 | 463 | ||||
M v4/glib/more.go +40 -0
| @@ -2,10 +2,50 @@ package glib | |||||
| 2 | 2 | ||||
| 3 | import ( | 3 | import ( | ||
| 4 | "fmt" | 4 | "fmt" | ||
| 5 | + | "sync" | |||
| 5 | 6 | ||||
| 7 | + | "github.com/jwijenbergh/purego" | |||
| 6 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 7 | ) | 9 | ) | ||
| 8 | 10 | ||||
| 11 | + | var callbacks = struct { | |||
| 12 | + | sync.RWMutex | |||
| 13 | + | refs map[uintptr]uintptr | |||
| 14 | + | }{ | |||
| 15 | + | refs: make(map[uintptr]uintptr), | |||
| 16 | + | } | |||
| 17 | + | ||||
| 18 | + | // GetCallback retrives a callback reference by value. | |||
| 19 | + | // Users should not need to call this. | |||
| 20 | + | func GetCallback(cbPtr uintptr) (uintptr, bool) { | |||
| 21 | + | callbacks.RLock() | |||
| 22 | + | defer callbacks.RUnlock() | |||
| 23 | + | refPtr, ok := callbacks.refs[cbPtr] | |||
| 24 | + | return refPtr, ok | |||
| 25 | + | } | |||
| 26 | + | ||||
| 27 | + | // SaveCallback saves a reference to the callback value. | |||
| 28 | + | // Users should not need to call this. | |||
| 29 | + | func SaveCallback(cbPtr uintptr, refPtr uintptr) { | |||
| 30 | + | callbacks.Lock() | |||
| 31 | + | callbacks.refs[cbPtr] = refPtr | |||
| 32 | + | callbacks.Unlock() | |||
| 33 | + | } | |||
| 34 | + | ||||
| 35 | + | // UnrefCallbackValue unreferences the provided callback by reflect.value to free a purego slot | |||
| 36 | + | // | |||
| 37 | + | // NOTE: Windows does not support unreferencing callbacks, so on that platform this operation is | |||
| 38 | + | // a NOOP, callback memory is never freed, and there is a limit on maximum total callbacks. | |||
| 39 | + | // See the purego documentation for further details. | |||
| 40 | + | func UnrefCallback(fnPtr interface{}) error { | |||
| 41 | + | return unrefCallback(fnPtr) | |||
| 42 | + | } | |||
| 43 | + | ||||
| 44 | + | // NewCallback is an alias to purego.NewCallback | |||
| 45 | + | func NewCallback(fnPtr interface{}) uintptr { | |||
| 46 | + | return purego.NewCallbackFnPtr(fnPtr) | |||
| 47 | + | } | |||
| 48 | + | ||||
| 9 | func (e *Error) Error() string { | 49 | func (e *Error) Error() string { | ||
| 10 | return fmt.Sprintf("Gtk reported an error with message: '%s', domain: '%v' and code: '%v'", e.MessageGo(), e.Domain, e.Code) | 50 | return fmt.Sprintf("Gtk reported an error with message: '%s', domain: '%v' and code: '%v'", e.MessageGo(), e.Domain, e.Code) | ||
| 11 | } | 51 | } | ||
A v4/glib/more_other.go +8 -0
| @@ -0,0 +1,8 @@ | |||||
| 1 | + | //go:build !windows && !darwin && !freebsd && (!linux || (!amd64 && !arm64)) | |||
| 2 | + | ||||
| 3 | + | package glib | |||
| 4 | + | ||||
| 5 | + | // unrefCallback on unsupported on other platforms | |||
| 6 | + | func unrefCallback(_ interface{}) error { | |||
| 7 | + | panic("glib.UnrefCallback is unsupported on this platform") | |||
| 8 | + | } | |||
A v4/glib/more_sysv.go +31 -0
| @@ -0,0 +1,31 @@ | |||||
| 1 | + | //go:build darwin || freebsd || (linux && (amd64 || arm64)) | |||
| 2 | + | ||||
| 3 | + | package glib | |||
| 4 | + | ||||
| 5 | + | import ( | |||
| 6 | + | "fmt" | |||
| 7 | + | "reflect" | |||
| 8 | + | ||||
| 9 | + | "github.com/jwijenbergh/purego" | |||
| 10 | + | ) | |||
| 11 | + | ||||
| 12 | + | func unrefCallback(fnPtr interface{}) error { | |||
| 13 | + | val := reflect.ValueOf(fnPtr) | |||
| 14 | + | if val.IsNil() { | |||
| 15 | + | return fmt.Errorf("function pointer must not be nil") | |||
| 16 | + | } | |||
| 17 | + | if val.Kind() != reflect.Ptr || val.Elem().Kind() != reflect.Func { | |||
| 18 | + | return fmt.Errorf("type must be a function pointer") | |||
| 19 | + | } | |||
| 20 | + | cbPtr := reflect.ValueOf(fnPtr).Pointer() | |||
| 21 | + | refPtr, ok := GetCallback(cbPtr) | |||
| 22 | + | if !ok { | |||
| 23 | + | return purego.UnrefCallbackFnPtr(fnPtr) | |||
| 24 | + | } | |||
| 25 | + | defer func() { | |||
| 26 | + | callbacks.Lock() | |||
| 27 | + | delete(callbacks.refs, cbPtr) | |||
| 28 | + | callbacks.Unlock() | |||
| 29 | + | }() | |||
| 30 | + | return purego.UnrefCallback(refPtr) | |||
| 31 | + | } | |||
A v4/glib/more_windows.go +6 -0
| @@ -0,0 +1,6 @@ | |||||
| 1 | + | package glib | |||
| 2 | + | ||||
| 3 | + | // unrefCallback on Windows is a NOOP. | |||
| 4 | + | func unrefCallback(_ interface{}) error { | |||
| 5 | + | return nil | |||
| 6 | + | } | |||
M v4/gobject/gboxed.go +3 -2
| @@ -4,6 +4,7 @@ package gobject | |||||
| 4 | import ( | 4 | import ( | ||
| 5 | "github.com/jwijenbergh/purego" | 5 | "github.com/jwijenbergh/purego" | ||
| 6 | "github.com/jwijenbergh/puregotk/internal/core" | 6 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 7 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 7 | ) | 8 | ) | ||
| 8 | 9 | ||||
| 9 | // This function is provided by the user and should produce a copy | 10 | // This function is provided by the user and should produce a copy | ||
| @@ -43,9 +44,9 @@ var xBoxedTypeRegisterStatic func(string, uintptr, uintptr) []interface{} | |||||
| 43 | // For the general case, it is recommended to use G_DEFINE_BOXED_TYPE() | 44 | // For the general case, it is recommended to use G_DEFINE_BOXED_TYPE() | ||
| 44 | // instead of calling g_boxed_type_register_static() directly. The macro | 45 | // instead of calling g_boxed_type_register_static() directly. The macro | ||
| 45 | // will create the appropriate `*_get_type()` function for the boxed type. | 46 | // will create the appropriate `*_get_type()` function for the boxed type. | ||
| 46 | - | func BoxedTypeRegisterStatic(NameVar string, BoxedCopyVar BoxedCopyFunc, BoxedFreeVar BoxedFreeFunc) []interface{} { | 47 | + | func BoxedTypeRegisterStatic(NameVar string, BoxedCopyVar *BoxedCopyFunc, BoxedFreeVar *BoxedFreeFunc) []interface{} { |
| 47 | 48 | ||||
| 48 | - | cret := xBoxedTypeRegisterStatic(NameVar, purego.NewCallback(BoxedCopyVar), purego.NewCallback(BoxedFreeVar)) | 49 | + | cret := xBoxedTypeRegisterStatic(NameVar, glib.NewCallback(BoxedCopyVar), glib.NewCallback(BoxedFreeVar)) |
| 49 | return cret | 50 | return cret | ||
| 50 | } | 51 | } | ||
| 51 | 52 | ||||
M v4/gobject/gclosure.go +19 -18
| @@ -6,6 +6,7 @@ import ( | |||||
| 6 | 6 | ||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 9 | ) | 10 | ) | ||
| 10 | 11 | ||||
| 11 | // The type used for callback functions in structure definitions and function | 12 | // The type used for callback functions in structure definitions and function | ||
| @@ -186,9 +187,9 @@ var xClosureAddFinalizeNotifier func(uintptr, uintptr, uintptr) | |||||
| 186 | // unspecified order. If a single call to g_closure_unref() results in | 187 | // unspecified order. If a single call to g_closure_unref() results in | ||
| 187 | // the closure being both invalidated and finalized, then the invalidate | 188 | // the closure being both invalidated and finalized, then the invalidate | ||
| 188 | // notifiers will be run before the finalize notifiers. | 189 | // notifiers will be run before the finalize notifiers. | ||
| 189 | - | func (x *Closure) AddFinalizeNotifier(NotifyDataVar uintptr, NotifyFuncVar ClosureNotify) { | 190 | + | func (x *Closure) AddFinalizeNotifier(NotifyDataVar uintptr, NotifyFuncVar *ClosureNotify) { |
| 190 | 191 | ||||
| 191 | - | xClosureAddFinalizeNotifier(x.GoPointer(), NotifyDataVar, purego.NewCallback(NotifyFuncVar)) | 192 | + | xClosureAddFinalizeNotifier(x.GoPointer(), NotifyDataVar, glib.NewCallback(NotifyFuncVar)) |
| 192 | 193 | ||||
| 193 | } | 194 | } | ||
| 194 | 195 | ||||
| @@ -199,9 +200,9 @@ var xClosureAddInvalidateNotifier func(uintptr, uintptr, uintptr) | |||||
| 199 | // | 200 | // | ||
| 200 | // Invalidation notifiers are invoked before finalization notifiers, | 201 | // Invalidation notifiers are invoked before finalization notifiers, | ||
| 201 | // in an unspecified order. | 202 | // in an unspecified order. | ||
| 202 | - | func (x *Closure) AddInvalidateNotifier(NotifyDataVar uintptr, NotifyFuncVar ClosureNotify) { | 203 | + | func (x *Closure) AddInvalidateNotifier(NotifyDataVar uintptr, NotifyFuncVar *ClosureNotify) { |
| 203 | 204 | ||||
| 204 | - | xClosureAddInvalidateNotifier(x.GoPointer(), NotifyDataVar, purego.NewCallback(NotifyFuncVar)) | 205 | + | xClosureAddInvalidateNotifier(x.GoPointer(), NotifyDataVar, glib.NewCallback(NotifyFuncVar)) |
| 205 | 206 | ||||
| 206 | } | 207 | } | ||
| 207 | 208 | ||||
| @@ -213,9 +214,9 @@ var xClosureAddMarshalGuards func(uintptr, uintptr, uintptr, uintptr, uintptr) | |||||
| 213 | // This is typically used to protect the extra arguments for the | 214 | // This is typically used to protect the extra arguments for the | ||
| 214 | // duration of the callback. See g_object_watch_closure() for an | 215 | // duration of the callback. See g_object_watch_closure() for an | ||
| 215 | // example of marshal guards. | 216 | // example of marshal guards. | ||
| 216 | - | func (x *Closure) AddMarshalGuards(PreMarshalDataVar uintptr, PreMarshalNotifyVar ClosureNotify, PostMarshalDataVar uintptr, PostMarshalNotifyVar ClosureNotify) { | 217 | + | func (x *Closure) AddMarshalGuards(PreMarshalDataVar uintptr, PreMarshalNotifyVar *ClosureNotify, PostMarshalDataVar uintptr, PostMarshalNotifyVar *ClosureNotify) { |
| 217 | 218 | ||||
| 218 | - | xClosureAddMarshalGuards(x.GoPointer(), PreMarshalDataVar, purego.NewCallback(PreMarshalNotifyVar), PostMarshalDataVar, purego.NewCallback(PostMarshalNotifyVar)) | 219 | + | xClosureAddMarshalGuards(x.GoPointer(), PreMarshalDataVar, glib.NewCallback(PreMarshalNotifyVar), PostMarshalDataVar, glib.NewCallback(PostMarshalNotifyVar)) |
| 219 | 220 | ||||
| 220 | } | 221 | } | ||
| 221 | 222 | ||||
| @@ -266,9 +267,9 @@ var xClosureRemoveFinalizeNotifier func(uintptr, uintptr, uintptr) | |||||
| 266 | // Removes a finalization notifier. | 267 | // Removes a finalization notifier. | ||
| 267 | // | 268 | // | ||
| 268 | // Notice that notifiers are automatically removed after they are run. | 269 | // Notice that notifiers are automatically removed after they are run. | ||
| 269 | - | func (x *Closure) RemoveFinalizeNotifier(NotifyDataVar uintptr, NotifyFuncVar ClosureNotify) { | 270 | + | func (x *Closure) RemoveFinalizeNotifier(NotifyDataVar uintptr, NotifyFuncVar *ClosureNotify) { |
| 270 | 271 | ||||
| 271 | - | xClosureRemoveFinalizeNotifier(x.GoPointer(), NotifyDataVar, purego.NewCallback(NotifyFuncVar)) | 272 | + | xClosureRemoveFinalizeNotifier(x.GoPointer(), NotifyDataVar, glib.NewCallback(NotifyFuncVar)) |
| 272 | 273 | ||||
| 273 | } | 274 | } | ||
| 274 | 275 | ||||
| @@ -277,9 +278,9 @@ var xClosureRemoveInvalidateNotifier func(uintptr, uintptr, uintptr) | |||||
| 277 | // Removes an invalidation notifier. | 278 | // Removes an invalidation notifier. | ||
| 278 | // | 279 | // | ||
| 279 | // Notice that notifiers are automatically removed after they are run. | 280 | // Notice that notifiers are automatically removed after they are run. | ||
| 280 | - | func (x *Closure) RemoveInvalidateNotifier(NotifyDataVar uintptr, NotifyFuncVar ClosureNotify) { | 281 | + | func (x *Closure) RemoveInvalidateNotifier(NotifyDataVar uintptr, NotifyFuncVar *ClosureNotify) { |
| 281 | 282 | ||||
| 282 | - | xClosureRemoveInvalidateNotifier(x.GoPointer(), NotifyDataVar, purego.NewCallback(NotifyFuncVar)) | 283 | + | xClosureRemoveInvalidateNotifier(x.GoPointer(), NotifyDataVar, glib.NewCallback(NotifyFuncVar)) |
| 283 | 284 | ||||
| 284 | } | 285 | } | ||
| 285 | 286 | ||||
| @@ -295,9 +296,9 @@ var xClosureSetMarshal func(uintptr, uintptr) | |||||
| 295 | // @closure->callback. | 296 | // @closure->callback. | ||
| 296 | // | 297 | // | ||
| 297 | // See also: g_closure_set_meta_marshal() | 298 | // See also: g_closure_set_meta_marshal() | ||
| 298 | - | func (x *Closure) SetMarshal(MarshalVar ClosureMarshal) { | 299 | + | func (x *Closure) SetMarshal(MarshalVar *ClosureMarshal) { |
| 299 | 300 | ||||
| 300 | - | xClosureSetMarshal(x.GoPointer(), purego.NewCallback(MarshalVar)) | 301 | + | xClosureSetMarshal(x.GoPointer(), glib.NewCallback(MarshalVar)) |
| 301 | 302 | ||||
| 302 | } | 303 | } | ||
| 303 | 304 | ||||
| @@ -320,9 +321,9 @@ var xClosureSetMetaMarshal func(uintptr, uintptr, uintptr) | |||||
| 320 | // fixed offset in the class structure. The meta marshaller retrieves | 321 | // fixed offset in the class structure. The meta marshaller retrieves | ||
| 321 | // the right callback and passes it to the marshaller as the | 322 | // the right callback and passes it to the marshaller as the | ||
| 322 | // @marshal_data argument. | 323 | // @marshal_data argument. | ||
| 323 | - | func (x *Closure) SetMetaMarshal(MarshalDataVar uintptr, MetaMarshalVar ClosureMarshal) { | 324 | + | func (x *Closure) SetMetaMarshal(MarshalDataVar uintptr, MetaMarshalVar *ClosureMarshal) { |
| 324 | 325 | ||||
| 325 | - | xClosureSetMetaMarshal(x.GoPointer(), MarshalDataVar, purego.NewCallback(MetaMarshalVar)) | 326 | + | xClosureSetMetaMarshal(x.GoPointer(), MarshalDataVar, glib.NewCallback(MetaMarshalVar)) |
| 326 | 327 | ||||
| 327 | } | 328 | } | ||
| 328 | 329 | ||||
| @@ -425,9 +426,9 @@ var xCclosureNew func(uintptr, uintptr, uintptr) *Closure | |||||
| 425 | // the last parameter. | 426 | // the last parameter. | ||
| 426 | // | 427 | // | ||
| 427 | // @destroy_data will be called as a finalize notifier on the #GClosure. | 428 | // @destroy_data will be called as a finalize notifier on the #GClosure. | ||
| 428 | - | func CclosureNew(CallbackFuncVar Callback, UserDataVar uintptr, DestroyDataVar ClosureNotify) *Closure { | 429 | + | func CclosureNew(CallbackFuncVar *Callback, UserDataVar uintptr, DestroyDataVar *ClosureNotify) *Closure { |
| 429 | 430 | ||||
| 430 | - | cret := xCclosureNew(purego.NewCallback(CallbackFuncVar), UserDataVar, purego.NewCallback(DestroyDataVar)) | 431 | + | cret := xCclosureNew(glib.NewCallback(CallbackFuncVar), UserDataVar, glib.NewCallback(DestroyDataVar)) |
| 431 | return cret | 432 | return cret | ||
| 432 | } | 433 | } | ||
| 433 | 434 | ||||
| @@ -437,9 +438,9 @@ var xCclosureNewSwap func(uintptr, uintptr, uintptr) *Closure | |||||
| 437 | // the first parameter. | 438 | // the first parameter. | ||
| 438 | // | 439 | // | ||
| 439 | // @destroy_data will be called as a finalize notifier on the #GClosure. | 440 | // @destroy_data will be called as a finalize notifier on the #GClosure. | ||
| 440 | - | func CclosureNewSwap(CallbackFuncVar Callback, UserDataVar uintptr, DestroyDataVar ClosureNotify) *Closure { | 441 | + | func CclosureNewSwap(CallbackFuncVar *Callback, UserDataVar uintptr, DestroyDataVar *ClosureNotify) *Closure { |
| 441 | 442 | ||||
| 442 | - | cret := xCclosureNewSwap(purego.NewCallback(CallbackFuncVar), UserDataVar, purego.NewCallback(DestroyDataVar)) | 443 | + | cret := xCclosureNewSwap(glib.NewCallback(CallbackFuncVar), UserDataVar, glib.NewCallback(DestroyDataVar)) |
| 443 | return cret | 444 | return cret | ||
| 444 | } | 445 | } | ||
| 445 | 446 | ||||
M v4/gobject/gobject-2.0.go +36 -18
| @@ -2,6 +2,8 @@ | |||||
| 2 | package gobject | 2 | package gobject | ||
| 3 | 3 | ||||
| 4 | import ( | 4 | import ( | ||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 5 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 6 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 7 | "github.com/jwijenbergh/puregotk/v4/glib" | 9 | "github.com/jwijenbergh/puregotk/v4/glib" | ||
| @@ -413,9 +415,9 @@ var xBindingGroupBindFull func(uintptr, string, uintptr, string, BindingFlags, u | |||||
| 413 | // %G_BINDING_SYNC_CREATE is automatically specified. | 415 | // %G_BINDING_SYNC_CREATE is automatically specified. | ||
| 414 | // | 416 | // | ||
| 415 | // See g_object_bind_property_full() for more information. | 417 | // See g_object_bind_property_full() for more information. | ||
| 416 | - | func (x *BindingGroup) BindFull(SourcePropertyVar string, TargetVar *Object, TargetPropertyVar string, FlagsVar BindingFlags, TransformToVar BindingTransformFunc, TransformFromVar BindingTransformFunc, UserDataVar uintptr, UserDataDestroyVar glib.DestroyNotify) { | 418 | + | func (x *BindingGroup) BindFull(SourcePropertyVar string, TargetVar *Object, TargetPropertyVar string, FlagsVar BindingFlags, TransformToVar *BindingTransformFunc, TransformFromVar *BindingTransformFunc, UserDataVar uintptr, UserDataDestroyVar *glib.DestroyNotify) { |
| 417 | 419 | ||||
| 418 | - | xBindingGroupBindFull(x.GoPointer(), SourcePropertyVar, TargetVar.GoPointer(), TargetPropertyVar, FlagsVar, purego.NewCallback(TransformToVar), purego.NewCallback(TransformFromVar), UserDataVar, purego.NewCallback(UserDataDestroyVar)) | 420 | + | xBindingGroupBindFull(x.GoPointer(), SourcePropertyVar, TargetVar.GoPointer(), TargetPropertyVar, FlagsVar, glib.NewCallback(TransformToVar), glib.NewCallback(TransformFromVar), UserDataVar, glib.NewCallback(UserDataDestroyVar)) |
| 419 | 421 | ||||
| 420 | } | 422 | } | ||
| 421 | 423 | ||||
| @@ -538,9 +540,9 @@ var xSignalGroupConnect func(uintptr, string, uintptr, uintptr) | |||||
| 538 | // on the target instance of @self. | 540 | // on the target instance of @self. | ||
| 539 | // | 541 | // | ||
| 540 | // You cannot connect a signal handler after #GSignalGroup:target has been set. | 542 | // You cannot connect a signal handler after #GSignalGroup:target has been set. | ||
| 541 | - | func (x *SignalGroup) Connect(DetailedSignalVar string, CHandlerVar Callback, DataVar uintptr) { | 543 | + | func (x *SignalGroup) Connect(DetailedSignalVar string, CHandlerVar *Callback, DataVar uintptr) { |
| 542 | 544 | ||||
| 543 | - | xSignalGroupConnect(x.GoPointer(), DetailedSignalVar, purego.NewCallback(CHandlerVar), DataVar) | 545 | + | xSignalGroupConnect(x.GoPointer(), DetailedSignalVar, glib.NewCallback(CHandlerVar), DataVar) |
| 544 | 546 | ||||
| 545 | } | 547 | } | ||
| 546 | 548 | ||||
| @@ -552,9 +554,9 @@ var xSignalGroupConnectAfter func(uintptr, string, uintptr, uintptr) | |||||
| 552 | // The @c_handler will be called after the default handler of the signal. | 554 | // The @c_handler will be called after the default handler of the signal. | ||
| 553 | // | 555 | // | ||
| 554 | // You cannot connect a signal handler after #GSignalGroup:target has been set. | 556 | // You cannot connect a signal handler after #GSignalGroup:target has been set. | ||
| 555 | - | func (x *SignalGroup) ConnectAfter(DetailedSignalVar string, CHandlerVar Callback, DataVar uintptr) { | 557 | + | func (x *SignalGroup) ConnectAfter(DetailedSignalVar string, CHandlerVar *Callback, DataVar uintptr) { |
| 556 | 558 | ||||
| 557 | - | xSignalGroupConnectAfter(x.GoPointer(), DetailedSignalVar, purego.NewCallback(CHandlerVar), DataVar) | 559 | + | xSignalGroupConnectAfter(x.GoPointer(), DetailedSignalVar, glib.NewCallback(CHandlerVar), DataVar) |
| 558 | 560 | ||||
| 559 | } | 561 | } | ||
| 560 | 562 | ||||
| @@ -564,9 +566,9 @@ var xSignalGroupConnectData func(uintptr, string, uintptr, uintptr, uintptr, Con | |||||
| 564 | // on the target instance of @self. | 566 | // on the target instance of @self. | ||
| 565 | // | 567 | // | ||
| 566 | // You cannot connect a signal handler after #GSignalGroup:target has been set. | 568 | // You cannot connect a signal handler after #GSignalGroup:target has been set. | ||
| 567 | - | func (x *SignalGroup) ConnectData(DetailedSignalVar string, CHandlerVar Callback, DataVar uintptr, NotifyVar ClosureNotify, FlagsVar ConnectFlags) { | 569 | + | func (x *SignalGroup) ConnectData(DetailedSignalVar string, CHandlerVar *Callback, DataVar uintptr, NotifyVar *ClosureNotify, FlagsVar ConnectFlags) { |
| 568 | 570 | ||||
| 569 | - | xSignalGroupConnectData(x.GoPointer(), DetailedSignalVar, purego.NewCallback(CHandlerVar), DataVar, purego.NewCallback(NotifyVar), FlagsVar) | 571 | + | xSignalGroupConnectData(x.GoPointer(), DetailedSignalVar, glib.NewCallback(CHandlerVar), DataVar, glib.NewCallback(NotifyVar), FlagsVar) |
| 570 | 572 | ||||
| 571 | } | 573 | } | ||
| 572 | 574 | ||||
| @@ -579,9 +581,9 @@ var xSignalGroupConnectObject func(uintptr, string, uintptr, uintptr, ConnectFla | |||||
| 579 | // the signal handler will automatically be removed. | 581 | // the signal handler will automatically be removed. | ||
| 580 | // | 582 | // | ||
| 581 | // You cannot connect a signal handler after #GSignalGroup:target has been set. | 583 | // You cannot connect a signal handler after #GSignalGroup:target has been set. | ||
| 582 | - | func (x *SignalGroup) ConnectObject(DetailedSignalVar string, CHandlerVar Callback, ObjectVar uintptr, FlagsVar ConnectFlags) { | 584 | + | func (x *SignalGroup) ConnectObject(DetailedSignalVar string, CHandlerVar *Callback, ObjectVar uintptr, FlagsVar ConnectFlags) { |
| 583 | 585 | ||||
| 584 | - | xSignalGroupConnectObject(x.GoPointer(), DetailedSignalVar, purego.NewCallback(CHandlerVar), ObjectVar, FlagsVar) | 586 | + | xSignalGroupConnectObject(x.GoPointer(), DetailedSignalVar, glib.NewCallback(CHandlerVar), ObjectVar, FlagsVar) |
| 585 | 587 | ||||
| 586 | } | 588 | } | ||
| 587 | 589 | ||||
| @@ -594,9 +596,9 @@ var xSignalGroupConnectSwapped func(uintptr, string, uintptr, uintptr) | |||||
| 594 | // will be swapped when calling @c_handler. | 596 | // will be swapped when calling @c_handler. | ||
| 595 | // | 597 | // | ||
| 596 | // You cannot connect a signal handler after #GSignalGroup:target has been set. | 598 | // You cannot connect a signal handler after #GSignalGroup:target has been set. | ||
| 597 | - | func (x *SignalGroup) ConnectSwapped(DetailedSignalVar string, CHandlerVar Callback, DataVar uintptr) { | 599 | + | func (x *SignalGroup) ConnectSwapped(DetailedSignalVar string, CHandlerVar *Callback, DataVar uintptr) { |
| 598 | 600 | ||||
| 599 | - | xSignalGroupConnectSwapped(x.GoPointer(), DetailedSignalVar, purego.NewCallback(CHandlerVar), DataVar) | 601 | + | xSignalGroupConnectSwapped(x.GoPointer(), DetailedSignalVar, glib.NewCallback(CHandlerVar), DataVar) |
| 600 | 602 | ||||
| 601 | } | 603 | } | ||
| 602 | 604 | ||||
| @@ -654,15 +656,23 @@ func (c *SignalGroup) SetGoPointer(ptr uintptr) { | |||||
| 654 | // other than %NULL. It is similar to #GObject::notify on `target` except it | 656 | // other than %NULL. It is similar to #GObject::notify on `target` except it | ||
| 655 | // will not emit when #GSignalGroup:target is %NULL and also allows for | 657 | // will not emit when #GSignalGroup:target is %NULL and also allows for | ||
| 656 | // receiving the #GObject without a data-race. | 658 | // receiving the #GObject without a data-race. | ||
| 657 | - | func (x *SignalGroup) ConnectBind(cb func(SignalGroup, uintptr)) uint32 { | 659 | + | func (x *SignalGroup) ConnectBind(cb *func(SignalGroup, uintptr)) uint32 { |
| 660 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 661 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 662 | + | return SignalConnect(x.GoPointer(), "bind", cbRefPtr) | |||
| 663 | + | } | |||
| 664 | + | ||||
| 658 | fcb := func(clsPtr uintptr, InstanceVarp uintptr) { | 665 | fcb := func(clsPtr uintptr, InstanceVarp uintptr) { | ||
| 659 | fa := SignalGroup{} | 666 | fa := SignalGroup{} | ||
| 660 | fa.Ptr = clsPtr | 667 | fa.Ptr = clsPtr | ||
| 668 | + | cbFn := *cb | |||
| 661 | 669 | ||||
| 662 | - | cb(fa, InstanceVarp) | 670 | + | cbFn(fa, InstanceVarp) |
| 663 | 671 | ||||
| 664 | } | 672 | } | ||
| 665 | - | return SignalConnect(x.GoPointer(), "bind", purego.NewCallback(fcb)) | 673 | + | cbRefPtr := purego.NewCallback(fcb) |
| 674 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 675 | + | return SignalConnect(x.GoPointer(), "bind", cbRefPtr) | |||
| 666 | } | 676 | } | ||
| 667 | 677 | ||||
| 668 | // This signal is emitted when the target instance of @self is set to a | 678 | // This signal is emitted when the target instance of @self is set to a | ||
| @@ -670,15 +680,23 @@ func (x *SignalGroup) ConnectBind(cb func(SignalGroup, uintptr)) uint32 { | |||||
| 670 | // | 680 | // | ||
| 671 | // This signal will only be emitted if the previous target of @self is | 681 | // This signal will only be emitted if the previous target of @self is | ||
| 672 | // non-%NULL. | 682 | // non-%NULL. | ||
| 673 | - | func (x *SignalGroup) ConnectUnbind(cb func(SignalGroup)) uint32 { | 683 | + | func (x *SignalGroup) ConnectUnbind(cb *func(SignalGroup)) uint32 { |
| 684 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 685 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 686 | + | return SignalConnect(x.GoPointer(), "unbind", cbRefPtr) | |||
| 687 | + | } | |||
| 688 | + | ||||
| 674 | fcb := func(clsPtr uintptr) { | 689 | fcb := func(clsPtr uintptr) { | ||
| 675 | fa := SignalGroup{} | 690 | fa := SignalGroup{} | ||
| 676 | fa.Ptr = clsPtr | 691 | fa.Ptr = clsPtr | ||
| 692 | + | cbFn := *cb | |||
| 677 | 693 | ||||
| 678 | - | cb(fa) | 694 | + | cbFn(fa) |
| 679 | 695 | ||||
| 680 | } | 696 | } | ||
| 681 | - | return SignalConnect(x.GoPointer(), "unbind", purego.NewCallback(fcb)) | 697 | + | cbRefPtr := purego.NewCallback(fcb) |
| 698 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 699 | + | return SignalConnect(x.GoPointer(), "unbind", cbRefPtr) | |||
| 682 | } | 700 | } | ||
| 683 | 701 | ||||
| 684 | func init() { | 702 | func init() { | ||
M v4/gobject/gobject.go +39 -31
| @@ -354,9 +354,9 @@ var xCclosureNewObject func(uintptr, uintptr) *Closure | |||||
| 354 | // closure. This function is useful when you have a callback closely | 354 | // closure. This function is useful when you have a callback closely | ||
| 355 | // associated with a #GObject, and want the callback to no longer run | 355 | // associated with a #GObject, and want the callback to no longer run | ||
| 356 | // after the object is is freed. | 356 | // after the object is is freed. | ||
| 357 | - | func CclosureNewObject(CallbackFuncVar Callback, ObjectVar *Object) *Closure { | 357 | + | func CclosureNewObject(CallbackFuncVar *Callback, ObjectVar *Object) *Closure { |
| 358 | 358 | ||||
| 359 | - | cret := xCclosureNewObject(purego.NewCallback(CallbackFuncVar), ObjectVar.GoPointer()) | 359 | + | cret := xCclosureNewObject(glib.NewCallback(CallbackFuncVar), ObjectVar.GoPointer()) |
| 360 | return cret | 360 | return cret | ||
| 361 | } | 361 | } | ||
| 362 | 362 | ||||
| @@ -367,9 +367,9 @@ var xCclosureNewObjectSwap func(uintptr, uintptr) *Closure | |||||
| 367 | // closure. This function is useful when you have a callback closely | 367 | // closure. This function is useful when you have a callback closely | ||
| 368 | // associated with a #GObject, and want the callback to no longer run | 368 | // associated with a #GObject, and want the callback to no longer run | ||
| 369 | // after the object is is freed. | 369 | // after the object is is freed. | ||
| 370 | - | func CclosureNewObjectSwap(CallbackFuncVar Callback, ObjectVar *Object) *Closure { | 370 | + | func CclosureNewObjectSwap(CallbackFuncVar *Callback, ObjectVar *Object) *Closure { |
| 371 | 371 | ||||
| 372 | - | cret := xCclosureNewObjectSwap(purego.NewCallback(CallbackFuncVar), ObjectVar.GoPointer()) | 372 | + | cret := xCclosureNewObjectSwap(glib.NewCallback(CallbackFuncVar), ObjectVar.GoPointer()) |
| 373 | return cret | 373 | return cret | ||
| 374 | } | 374 | } | ||
| 375 | 375 | ||||
| @@ -401,9 +401,9 @@ var xSignalConnectObject func(*TypeInstance, string, uintptr, uintptr, ConnectFl | |||||
| 401 | // disconnected. Note that this is not currently threadsafe (ie: | 401 | // disconnected. Note that this is not currently threadsafe (ie: | ||
| 402 | // emitting a signal while @gobject is being destroyed in another thread | 402 | // emitting a signal while @gobject is being destroyed in another thread | ||
| 403 | // is not safe). | 403 | // is not safe). | ||
| 404 | - | func SignalConnectObject(InstanceVar *TypeInstance, DetailedSignalVar string, CHandlerVar Callback, GobjectVar *Object, ConnectFlagsVar ConnectFlags) uint32 { | 404 | + | func SignalConnectObject(InstanceVar *TypeInstance, DetailedSignalVar string, CHandlerVar *Callback, GobjectVar *Object, ConnectFlagsVar ConnectFlags) uint32 { |
| 405 | 405 | ||||
| 406 | - | cret := xSignalConnectObject(InstanceVar, DetailedSignalVar, purego.NewCallback(CHandlerVar), GobjectVar.GoPointer(), ConnectFlagsVar) | 406 | + | cret := xSignalConnectObject(InstanceVar, DetailedSignalVar, glib.NewCallback(CHandlerVar), GobjectVar.GoPointer(), ConnectFlagsVar) |
| 407 | return cret | 407 | return cret | ||
| 408 | } | 408 | } | ||
| 409 | 409 | ||||
| @@ -581,9 +581,9 @@ var xObjectAddToggleRef func(uintptr, uintptr, uintptr) | |||||
| 581 | // of them will ever be notified until all but one are removed. For | 581 | // of them will ever be notified until all but one are removed. For | ||
| 582 | // this reason, you should only ever use a toggle reference if there | 582 | // this reason, you should only ever use a toggle reference if there | ||
| 583 | // is important state in the proxy object. | 583 | // is important state in the proxy object. | ||
| 584 | - | func (x *Object) AddToggleRef(NotifyVar ToggleNotify, DataVar uintptr) { | 584 | + | func (x *Object) AddToggleRef(NotifyVar *ToggleNotify, DataVar uintptr) { |
| 585 | 585 | ||||
| 586 | - | xObjectAddToggleRef(x.GoPointer(), purego.NewCallback(NotifyVar), DataVar) | 586 | + | xObjectAddToggleRef(x.GoPointer(), glib.NewCallback(NotifyVar), DataVar) |
| 587 | 587 | ||||
| 588 | } | 588 | } | ||
| 589 | 589 | ||||
| @@ -680,10 +680,10 @@ var xObjectBindPropertyFull func(uintptr, string, uintptr, string, BindingFlags, | |||||
| 680 | // be called once, when the binding is removed. If you need different data | 680 | // be called once, when the binding is removed. If you need different data | ||
| 681 | // for each transformation function, please use | 681 | // for each transformation function, please use | ||
| 682 | // g_object_bind_property_with_closures() instead. | 682 | // g_object_bind_property_with_closures() instead. | ||
| 683 | - | func (x *Object) BindPropertyFull(SourcePropertyVar string, TargetVar *Object, TargetPropertyVar string, FlagsVar BindingFlags, TransformToVar BindingTransformFunc, TransformFromVar BindingTransformFunc, UserDataVar uintptr, NotifyVar glib.DestroyNotify) *Binding { | 683 | + | func (x *Object) BindPropertyFull(SourcePropertyVar string, TargetVar *Object, TargetPropertyVar string, FlagsVar BindingFlags, TransformToVar *BindingTransformFunc, TransformFromVar *BindingTransformFunc, UserDataVar uintptr, NotifyVar *glib.DestroyNotify) *Binding { |
| 684 | var cls *Binding | 684 | var cls *Binding | ||
| 685 | 685 | ||||
| 686 | - | cret := xObjectBindPropertyFull(x.GoPointer(), SourcePropertyVar, TargetVar.GoPointer(), TargetPropertyVar, FlagsVar, purego.NewCallback(TransformToVar), purego.NewCallback(TransformFromVar), UserDataVar, purego.NewCallback(NotifyVar)) | 686 | + | cret := xObjectBindPropertyFull(x.GoPointer(), SourcePropertyVar, TargetVar.GoPointer(), TargetPropertyVar, FlagsVar, glib.NewCallback(TransformToVar), glib.NewCallback(TransformFromVar), UserDataVar, glib.NewCallback(NotifyVar)) |
| 687 | 687 | ||||
| 688 | if cret == 0 { | 688 | if cret == 0 { | ||
| 689 | return nil | 689 | return nil | ||
| @@ -788,9 +788,9 @@ var xObjectDupData func(uintptr, string, uintptr, uintptr) uintptr | |||||
| 788 | // This function can be useful to avoid races when multiple | 788 | // This function can be useful to avoid races when multiple | ||
| 789 | // threads are using object data on the same key on the same | 789 | // threads are using object data on the same key on the same | ||
| 790 | // object. | 790 | // object. | ||
| 791 | - | func (x *Object) DupData(KeyVar string, DupFuncVar glib.DuplicateFunc, UserDataVar uintptr) uintptr { | 791 | + | func (x *Object) DupData(KeyVar string, DupFuncVar *glib.DuplicateFunc, UserDataVar uintptr) uintptr { |
| 792 | 792 | ||||
| 793 | - | cret := xObjectDupData(x.GoPointer(), KeyVar, purego.NewCallback(DupFuncVar), UserDataVar) | 793 | + | cret := xObjectDupData(x.GoPointer(), KeyVar, glib.NewCallback(DupFuncVar), UserDataVar) |
| 794 | return cret | 794 | return cret | ||
| 795 | } | 795 | } | ||
| 796 | 796 | ||||
| @@ -810,9 +810,9 @@ var xObjectDupQdata func(uintptr, glib.Quark, uintptr, uintptr) uintptr | |||||
| 810 | // This function can be useful to avoid races when multiple | 810 | // This function can be useful to avoid races when multiple | ||
| 811 | // threads are using object data on the same key on the same | 811 | // threads are using object data on the same key on the same | ||
| 812 | // object. | 812 | // object. | ||
| 813 | - | func (x *Object) DupQdata(QuarkVar glib.Quark, DupFuncVar glib.DuplicateFunc, UserDataVar uintptr) uintptr { | 813 | + | func (x *Object) DupQdata(QuarkVar glib.Quark, DupFuncVar *glib.DuplicateFunc, UserDataVar uintptr) uintptr { |
| 814 | 814 | ||||
| 815 | - | cret := xObjectDupQdata(x.GoPointer(), QuarkVar, purego.NewCallback(DupFuncVar), UserDataVar) | 815 | + | cret := xObjectDupQdata(x.GoPointer(), QuarkVar, glib.NewCallback(DupFuncVar), UserDataVar) |
| 816 | return cret | 816 | return cret | ||
| 817 | } | 817 | } | ||
| 818 | 818 | ||||
| @@ -1081,9 +1081,9 @@ var xObjectRemoveToggleRef func(uintptr, uintptr, uintptr) | |||||
| 1081 | 1081 | ||||
| 1082 | // Removes a reference added with g_object_add_toggle_ref(). The | 1082 | // Removes a reference added with g_object_add_toggle_ref(). The | ||
| 1083 | // reference count of the object is decreased by one. | 1083 | // reference count of the object is decreased by one. | ||
| 1084 | - | func (x *Object) RemoveToggleRef(NotifyVar ToggleNotify, DataVar uintptr) { | 1084 | + | func (x *Object) RemoveToggleRef(NotifyVar *ToggleNotify, DataVar uintptr) { |
| 1085 | 1085 | ||||
| 1086 | - | xObjectRemoveToggleRef(x.GoPointer(), purego.NewCallback(NotifyVar), DataVar) | 1086 | + | xObjectRemoveToggleRef(x.GoPointer(), glib.NewCallback(NotifyVar), DataVar) |
| 1087 | 1087 | ||||
| 1088 | } | 1088 | } | ||
| 1089 | 1089 | ||||
| @@ -1116,9 +1116,9 @@ var xObjectReplaceData func(uintptr, string, uintptr, uintptr, uintptr, uintptr) | |||||
| 1116 | // | 1116 | // | ||
| 1117 | // See g_object_set_data() for guidance on using a small, bounded set of values | 1117 | // See g_object_set_data() for guidance on using a small, bounded set of values | ||
| 1118 | // for @key. | 1118 | // for @key. | ||
| 1119 | - | func (x *Object) ReplaceData(KeyVar string, OldvalVar uintptr, NewvalVar uintptr, DestroyVar glib.DestroyNotify, OldDestroyVar glib.DestroyNotify) bool { | 1119 | + | func (x *Object) ReplaceData(KeyVar string, OldvalVar uintptr, NewvalVar uintptr, DestroyVar *glib.DestroyNotify, OldDestroyVar *glib.DestroyNotify) bool { |
| 1120 | 1120 | ||||
| 1121 | - | cret := xObjectReplaceData(x.GoPointer(), KeyVar, OldvalVar, NewvalVar, purego.NewCallback(DestroyVar), purego.NewCallback(OldDestroyVar)) | 1121 | + | cret := xObjectReplaceData(x.GoPointer(), KeyVar, OldvalVar, NewvalVar, glib.NewCallback(DestroyVar), glib.NewCallback(OldDestroyVar)) |
| 1122 | return cret | 1122 | return cret | ||
| 1123 | } | 1123 | } | ||
| 1124 | 1124 | ||||
| @@ -1137,9 +1137,9 @@ var xObjectReplaceQdata func(uintptr, glib.Quark, uintptr, uintptr, uintptr, uin | |||||
| 1137 | // It’s up to the caller to free this as needed, which may | 1137 | // It’s up to the caller to free this as needed, which may | ||
| 1138 | // or may not include using @old_destroy as sometimes replacement | 1138 | // or may not include using @old_destroy as sometimes replacement | ||
| 1139 | // should not destroy the object in the normal way. | 1139 | // should not destroy the object in the normal way. | ||
| 1140 | - | func (x *Object) ReplaceQdata(QuarkVar glib.Quark, OldvalVar uintptr, NewvalVar uintptr, DestroyVar glib.DestroyNotify, OldDestroyVar glib.DestroyNotify) bool { | 1140 | + | func (x *Object) ReplaceQdata(QuarkVar glib.Quark, OldvalVar uintptr, NewvalVar uintptr, DestroyVar *glib.DestroyNotify, OldDestroyVar *glib.DestroyNotify) bool { |
| 1141 | 1141 | ||||
| 1142 | - | cret := xObjectReplaceQdata(x.GoPointer(), QuarkVar, OldvalVar, NewvalVar, purego.NewCallback(DestroyVar), purego.NewCallback(OldDestroyVar)) | 1142 | + | cret := xObjectReplaceQdata(x.GoPointer(), QuarkVar, OldvalVar, NewvalVar, glib.NewCallback(DestroyVar), glib.NewCallback(OldDestroyVar)) |
| 1143 | return cret | 1143 | return cret | ||
| 1144 | } | 1144 | } | ||
| 1145 | 1145 | ||||
| @@ -1198,9 +1198,9 @@ var xObjectSetDataFull func(uintptr, string, uintptr, uintptr) | |||||
| 1198 | // to a different value or when the object is destroyed. | 1198 | // to a different value or when the object is destroyed. | ||
| 1199 | // | 1199 | // | ||
| 1200 | // Note that the @destroy callback is not called if @data is %NULL. | 1200 | // Note that the @destroy callback is not called if @data is %NULL. | ||
| 1201 | - | func (x *Object) SetDataFull(KeyVar string, DataVar uintptr, DestroyVar glib.DestroyNotify) { | 1201 | + | func (x *Object) SetDataFull(KeyVar string, DataVar uintptr, DestroyVar *glib.DestroyNotify) { |
| 1202 | 1202 | ||||
| 1203 | - | xObjectSetDataFull(x.GoPointer(), KeyVar, DataVar, purego.NewCallback(DestroyVar)) | 1203 | + | xObjectSetDataFull(x.GoPointer(), KeyVar, DataVar, glib.NewCallback(DestroyVar)) |
| 1204 | 1204 | ||||
| 1205 | } | 1205 | } | ||
| 1206 | 1206 | ||||
| @@ -1236,9 +1236,9 @@ var xObjectSetQdataFull func(uintptr, glib.Quark, uintptr, uintptr) | |||||
| 1236 | // called with @data as argument when the @object is finalized, or | 1236 | // called with @data as argument when the @object is finalized, or | ||
| 1237 | // the data is being overwritten by a call to g_object_set_qdata() | 1237 | // the data is being overwritten by a call to g_object_set_qdata() | ||
| 1238 | // with the same @quark. | 1238 | // with the same @quark. | ||
| 1239 | - | func (x *Object) SetQdataFull(QuarkVar glib.Quark, DataVar uintptr, DestroyVar glib.DestroyNotify) { | 1239 | + | func (x *Object) SetQdataFull(QuarkVar glib.Quark, DataVar uintptr, DestroyVar *glib.DestroyNotify) { |
| 1240 | 1240 | ||||
| 1241 | - | xObjectSetQdataFull(x.GoPointer(), QuarkVar, DataVar, purego.NewCallback(DestroyVar)) | 1241 | + | xObjectSetQdataFull(x.GoPointer(), QuarkVar, DataVar, glib.NewCallback(DestroyVar)) |
| 1242 | 1242 | ||||
| 1243 | } | 1243 | } | ||
| 1244 | 1244 | ||||
| @@ -1432,18 +1432,18 @@ var xObjectWeakRef func(uintptr, uintptr, uintptr) | |||||
| 1432 | // thread-safe: they cannot safely be used in one thread if the | 1432 | // thread-safe: they cannot safely be used in one thread if the | ||
| 1433 | // object's last g_object_unref() might happen in another thread. | 1433 | // object's last g_object_unref() might happen in another thread. | ||
| 1434 | // Use #GWeakRef if thread-safety is required. | 1434 | // Use #GWeakRef if thread-safety is required. | ||
| 1435 | - | func (x *Object) WeakRef(NotifyVar WeakNotify, DataVar uintptr) { | 1435 | + | func (x *Object) WeakRef(NotifyVar *WeakNotify, DataVar uintptr) { |
| 1436 | 1436 | ||||
| 1437 | - | xObjectWeakRef(x.GoPointer(), purego.NewCallback(NotifyVar), DataVar) | 1437 | + | xObjectWeakRef(x.GoPointer(), glib.NewCallback(NotifyVar), DataVar) |
| 1438 | 1438 | ||||
| 1439 | } | 1439 | } | ||
| 1440 | 1440 | ||||
| 1441 | var xObjectWeakUnref func(uintptr, uintptr, uintptr) | 1441 | var xObjectWeakUnref func(uintptr, uintptr, uintptr) | ||
| 1442 | 1442 | ||||
| 1443 | // Removes a weak reference callback to an object. | 1443 | // Removes a weak reference callback to an object. | ||
| 1444 | - | func (x *Object) WeakUnref(NotifyVar WeakNotify, DataVar uintptr) { | 1444 | + | func (x *Object) WeakUnref(NotifyVar *WeakNotify, DataVar uintptr) { |
| 1445 | 1445 | ||||
| 1446 | - | xObjectWeakUnref(x.GoPointer(), purego.NewCallback(NotifyVar), DataVar) | 1446 | + | xObjectWeakUnref(x.GoPointer(), glib.NewCallback(NotifyVar), DataVar) |
| 1447 | 1447 | ||||
| 1448 | } | 1448 | } | ||
| 1449 | 1449 | ||||
| @@ -1482,15 +1482,23 @@ func (c *Object) SetGoPointer(ptr uintptr) { | |||||
| 1482 | // It is important to note that you must use | 1482 | // It is important to note that you must use | ||
| 1483 | // [canonical parameter names][canonical-parameter-names] as | 1483 | // [canonical parameter names][canonical-parameter-names] as | ||
| 1484 | // detail strings for the notify signal. | 1484 | // detail strings for the notify signal. | ||
| 1485 | - | func (x *Object) ConnectNotify(cb func(Object, uintptr)) uint32 { | 1485 | + | func (x *Object) ConnectNotify(cb *func(Object, uintptr)) uint32 { |
| 1486 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1487 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1488 | + | return SignalConnect(x.GoPointer(), "notify", cbRefPtr) | |||
| 1489 | + | } | |||
| 1490 | + | ||||
| 1486 | fcb := func(clsPtr uintptr, PspecVarp uintptr) { | 1491 | fcb := func(clsPtr uintptr, PspecVarp uintptr) { | ||
| 1487 | fa := Object{} | 1492 | fa := Object{} | ||
| 1488 | fa.Ptr = clsPtr | 1493 | fa.Ptr = clsPtr | ||
| 1494 | + | cbFn := *cb | |||
| 1489 | 1495 | ||||
| 1490 | - | cb(fa, PspecVarp) | 1496 | + | cbFn(fa, PspecVarp) |
| 1491 | 1497 | ||||
| 1492 | } | 1498 | } | ||
| 1493 | - | return SignalConnect(x.GoPointer(), "notify", purego.NewCallback(fcb)) | 1499 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1500 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1501 | + | return SignalConnect(x.GoPointer(), "notify", cbRefPtr) | |||
| 1494 | } | 1502 | } | ||
| 1495 | 1503 | ||||
| 1496 | var xObjectCompatControl func(uint, uintptr) uint | 1504 | var xObjectCompatControl func(uint, uintptr) uint | ||
M v4/gobject/gparam.go +2 -2
| @@ -415,9 +415,9 @@ var xParamSpecSetQdataFull func(uintptr, glib.Quark, uintptr, uintptr) | |||||
| 415 | // specified which is called with @data as argument when the @pspec is | 415 | // specified which is called with @data as argument when the @pspec is | ||
| 416 | // finalized, or the data is being overwritten by a call to | 416 | // finalized, or the data is being overwritten by a call to | ||
| 417 | // g_param_spec_set_qdata() with the same @quark. | 417 | // g_param_spec_set_qdata() with the same @quark. | ||
| 418 | - | func (x *ParamSpec) SetQdataFull(QuarkVar glib.Quark, DataVar uintptr, DestroyVar glib.DestroyNotify) { | 418 | + | func (x *ParamSpec) SetQdataFull(QuarkVar glib.Quark, DataVar uintptr, DestroyVar *glib.DestroyNotify) { |
| 419 | 419 | ||||
| 420 | - | xParamSpecSetQdataFull(x.GoPointer(), QuarkVar, DataVar, purego.NewCallback(DestroyVar)) | 420 | + | xParamSpecSetQdataFull(x.GoPointer(), QuarkVar, DataVar, glib.NewCallback(DestroyVar)) |
| 421 | 421 | ||||
| 422 | } | 422 | } | ||
| 423 | 423 | ||||
M v4/gobject/gsignal.go +14 -14
| @@ -214,9 +214,9 @@ var xSignalAddEmissionHook func(uint, glib.Quark, uintptr, uintptr, uintptr) uin | |||||
| 214 | // Adds an emission hook for a signal, which will get called for any emission | 214 | // Adds an emission hook for a signal, which will get called for any emission | ||
| 215 | // of that signal, independent of the instance. This is possible only | 215 | // of that signal, independent of the instance. This is possible only | ||
| 216 | // for signals which don't have %G_SIGNAL_NO_HOOKS flag set. | 216 | // for signals which don't have %G_SIGNAL_NO_HOOKS flag set. | ||
| 217 | - | func SignalAddEmissionHook(SignalIdVar uint, DetailVar glib.Quark, HookFuncVar SignalEmissionHook, HookDataVar uintptr, DataDestroyVar glib.DestroyNotify) uint32 { | 217 | + | func SignalAddEmissionHook(SignalIdVar uint, DetailVar glib.Quark, HookFuncVar *SignalEmissionHook, HookDataVar uintptr, DataDestroyVar *glib.DestroyNotify) uint32 { |
| 218 | 218 | ||||
| 219 | - | cret := xSignalAddEmissionHook(SignalIdVar, DetailVar, purego.NewCallback(HookFuncVar), HookDataVar, purego.NewCallback(DataDestroyVar)) | 219 | + | cret := xSignalAddEmissionHook(SignalIdVar, DetailVar, glib.NewCallback(HookFuncVar), HookDataVar, glib.NewCallback(DataDestroyVar)) |
| 220 | return cret | 220 | return cret | ||
| 221 | } | 221 | } | ||
| 222 | 222 | ||||
| @@ -269,9 +269,9 @@ var xSignalConnectData func(uintptr, string, uintptr, uintptr, uintptr, ConnectF | |||||
| 269 | // which will be called when the signal handler is disconnected and no longer | 269 | // which will be called when the signal handler is disconnected and no longer | ||
| 270 | // used. Specify @connect_flags if you need `..._after()` or | 270 | // used. Specify @connect_flags if you need `..._after()` or | ||
| 271 | // `..._swapped()` variants of this function. | 271 | // `..._swapped()` variants of this function. | ||
| 272 | - | func SignalConnectData(InstanceVar *Object, DetailedSignalVar string, CHandlerVar Callback, DataVar uintptr, DestroyDataVar ClosureNotify, ConnectFlagsVar ConnectFlags) uint32 { | 272 | + | func SignalConnectData(InstanceVar *Object, DetailedSignalVar string, CHandlerVar *Callback, DataVar uintptr, DestroyDataVar *ClosureNotify, ConnectFlagsVar ConnectFlags) uint32 { |
| 273 | 273 | ||||
| 274 | - | cret := xSignalConnectData(InstanceVar.GoPointer(), DetailedSignalVar, purego.NewCallback(CHandlerVar), DataVar, purego.NewCallback(DestroyDataVar), ConnectFlagsVar) | 274 | + | cret := xSignalConnectData(InstanceVar.GoPointer(), DetailedSignalVar, glib.NewCallback(CHandlerVar), DataVar, glib.NewCallback(DestroyDataVar), ConnectFlagsVar) |
| 275 | return cret | 275 | return cret | ||
| 276 | } | 276 | } | ||
| 277 | 277 | ||||
| @@ -572,9 +572,9 @@ var xSignalNew func(string, []interface{}, SignalFlags, uint, uintptr, uintptr, | |||||
| 572 | // If @c_marshaller is non-%NULL, you need to also specify a va_marshaller | 572 | // If @c_marshaller is non-%NULL, you need to also specify a va_marshaller | ||
| 573 | // using g_signal_set_va_marshaller() or the generic va_marshaller will | 573 | // using g_signal_set_va_marshaller() or the generic va_marshaller will | ||
| 574 | // be used. | 574 | // be used. | ||
| 575 | - | func SignalNew(SignalNameVar string, ItypeVar []interface{}, SignalFlagsVar SignalFlags, ClassOffsetVar uint, AccumulatorVar SignalAccumulator, AccuDataVar uintptr, CMarshallerVar SignalCMarshaller, ReturnTypeVar []interface{}, NParamsVar uint, varArgs ...interface{}) uint { | 575 | + | func SignalNew(SignalNameVar string, ItypeVar []interface{}, SignalFlagsVar SignalFlags, ClassOffsetVar uint, AccumulatorVar *SignalAccumulator, AccuDataVar uintptr, CMarshallerVar SignalCMarshaller, ReturnTypeVar []interface{}, NParamsVar uint, varArgs ...interface{}) uint { |
| 576 | 576 | ||||
| 577 | - | cret := xSignalNew(SignalNameVar, ItypeVar, SignalFlagsVar, ClassOffsetVar, purego.NewCallback(AccumulatorVar), AccuDataVar, CMarshallerVar, ReturnTypeVar, NParamsVar, varArgs...) | 577 | + | cret := xSignalNew(SignalNameVar, ItypeVar, SignalFlagsVar, ClassOffsetVar, glib.NewCallback(AccumulatorVar), AccuDataVar, CMarshallerVar, ReturnTypeVar, NParamsVar, varArgs...) |
| 578 | return cret | 578 | return cret | ||
| 579 | } | 579 | } | ||
| 580 | 580 | ||||
| @@ -596,9 +596,9 @@ var xSignalNewClassHandler func(string, []interface{}, SignalFlags, uintptr, uin | |||||
| 596 | // | 596 | // | ||
| 597 | // If c_marshaller is %NULL, g_cclosure_marshal_generic() will be used as | 597 | // If c_marshaller is %NULL, g_cclosure_marshal_generic() will be used as | ||
| 598 | // the marshaller for this signal. | 598 | // the marshaller for this signal. | ||
| 599 | - | func SignalNewClassHandler(SignalNameVar string, ItypeVar []interface{}, SignalFlagsVar SignalFlags, ClassHandlerVar Callback, AccumulatorVar SignalAccumulator, AccuDataVar uintptr, CMarshallerVar SignalCMarshaller, ReturnTypeVar []interface{}, NParamsVar uint, varArgs ...interface{}) uint { | 599 | + | func SignalNewClassHandler(SignalNameVar string, ItypeVar []interface{}, SignalFlagsVar SignalFlags, ClassHandlerVar *Callback, AccumulatorVar *SignalAccumulator, AccuDataVar uintptr, CMarshallerVar SignalCMarshaller, ReturnTypeVar []interface{}, NParamsVar uint, varArgs ...interface{}) uint { |
| 600 | 600 | ||||
| 601 | - | cret := xSignalNewClassHandler(SignalNameVar, ItypeVar, SignalFlagsVar, purego.NewCallback(ClassHandlerVar), purego.NewCallback(AccumulatorVar), AccuDataVar, CMarshallerVar, ReturnTypeVar, NParamsVar, varArgs...) | 601 | + | cret := xSignalNewClassHandler(SignalNameVar, ItypeVar, SignalFlagsVar, glib.NewCallback(ClassHandlerVar), glib.NewCallback(AccumulatorVar), AccuDataVar, CMarshallerVar, ReturnTypeVar, NParamsVar, varArgs...) |
| 602 | return cret | 602 | return cret | ||
| 603 | } | 603 | } | ||
| 604 | 604 | ||||
| @@ -610,9 +610,9 @@ var xSignalNewValist func(string, []interface{}, SignalFlags, *Closure, uintptr, | |||||
| 610 | // | 610 | // | ||
| 611 | // If c_marshaller is %NULL, g_cclosure_marshal_generic() will be used as | 611 | // If c_marshaller is %NULL, g_cclosure_marshal_generic() will be used as | ||
| 612 | // the marshaller for this signal. | 612 | // the marshaller for this signal. | ||
| 613 | - | func SignalNewValist(SignalNameVar string, ItypeVar []interface{}, SignalFlagsVar SignalFlags, ClassClosureVar *Closure, AccumulatorVar SignalAccumulator, AccuDataVar uintptr, CMarshallerVar SignalCMarshaller, ReturnTypeVar []interface{}, NParamsVar uint, ArgsVar []interface{}) uint { | 613 | + | func SignalNewValist(SignalNameVar string, ItypeVar []interface{}, SignalFlagsVar SignalFlags, ClassClosureVar *Closure, AccumulatorVar *SignalAccumulator, AccuDataVar uintptr, CMarshallerVar SignalCMarshaller, ReturnTypeVar []interface{}, NParamsVar uint, ArgsVar []interface{}) uint { |
| 614 | 614 | ||||
| 615 | - | cret := xSignalNewValist(SignalNameVar, ItypeVar, SignalFlagsVar, ClassClosureVar, purego.NewCallback(AccumulatorVar), AccuDataVar, CMarshallerVar, ReturnTypeVar, NParamsVar, ArgsVar) | 615 | + | cret := xSignalNewValist(SignalNameVar, ItypeVar, SignalFlagsVar, ClassClosureVar, glib.NewCallback(AccumulatorVar), AccuDataVar, CMarshallerVar, ReturnTypeVar, NParamsVar, ArgsVar) |
| 616 | return cret | 616 | return cret | ||
| 617 | } | 617 | } | ||
| 618 | 618 | ||||
| @@ -624,9 +624,9 @@ var xSignalNewv func(string, []interface{}, SignalFlags, *Closure, uintptr, uint | |||||
| 624 | // | 624 | // | ||
| 625 | // If c_marshaller is %NULL, g_cclosure_marshal_generic() will be used as | 625 | // If c_marshaller is %NULL, g_cclosure_marshal_generic() will be used as | ||
| 626 | // the marshaller for this signal. | 626 | // the marshaller for this signal. | ||
| 627 | - | func SignalNewv(SignalNameVar string, ItypeVar []interface{}, SignalFlagsVar SignalFlags, ClassClosureVar *Closure, AccumulatorVar SignalAccumulator, AccuDataVar uintptr, CMarshallerVar SignalCMarshaller, ReturnTypeVar []interface{}, NParamsVar uint, ParamTypesVar uintptr) uint { | 627 | + | func SignalNewv(SignalNameVar string, ItypeVar []interface{}, SignalFlagsVar SignalFlags, ClassClosureVar *Closure, AccumulatorVar *SignalAccumulator, AccuDataVar uintptr, CMarshallerVar SignalCMarshaller, ReturnTypeVar []interface{}, NParamsVar uint, ParamTypesVar uintptr) uint { |
| 628 | 628 | ||||
| 629 | - | cret := xSignalNewv(SignalNameVar, ItypeVar, SignalFlagsVar, ClassClosureVar, purego.NewCallback(AccumulatorVar), AccuDataVar, CMarshallerVar, ReturnTypeVar, NParamsVar, ParamTypesVar) | 629 | + | cret := xSignalNewv(SignalNameVar, ItypeVar, SignalFlagsVar, ClassClosureVar, glib.NewCallback(AccumulatorVar), AccuDataVar, CMarshallerVar, ReturnTypeVar, NParamsVar, ParamTypesVar) |
| 630 | return cret | 630 | return cret | ||
| 631 | } | 631 | } | ||
| 632 | 632 | ||||
| @@ -655,9 +655,9 @@ var xSignalOverrideClassHandler func(string, []interface{}, uintptr) | |||||
| 655 | // See g_signal_chain_from_overridden() and | 655 | // See g_signal_chain_from_overridden() and | ||
| 656 | // g_signal_chain_from_overridden_handler() for how to chain up to the | 656 | // g_signal_chain_from_overridden_handler() for how to chain up to the | ||
| 657 | // parent class closure from inside the overridden one. | 657 | // parent class closure from inside the overridden one. | ||
| 658 | - | func SignalOverrideClassHandler(SignalNameVar string, InstanceTypeVar []interface{}, ClassHandlerVar Callback) { | 658 | + | func SignalOverrideClassHandler(SignalNameVar string, InstanceTypeVar []interface{}, ClassHandlerVar *Callback) { |
| 659 | 659 | ||||
| 660 | - | xSignalOverrideClassHandler(SignalNameVar, InstanceTypeVar, purego.NewCallback(ClassHandlerVar)) | 660 | + | xSignalOverrideClassHandler(SignalNameVar, InstanceTypeVar, glib.NewCallback(ClassHandlerVar)) |
| 661 | 661 | ||||
| 662 | } | 662 | } | ||
| 663 | 663 | ||||
M v4/gobject/gtype.go +10 -10
| @@ -571,9 +571,9 @@ var xTypeAddClassCacheFunc func(uintptr, uintptr) | |||||
| 571 | // passed in to figure whether they actually want to cache the class of this | 571 | // passed in to figure whether they actually want to cache the class of this | ||
| 572 | // type, since all classes are routed through the same #GTypeClassCacheFunc | 572 | // type, since all classes are routed through the same #GTypeClassCacheFunc | ||
| 573 | // chain. | 573 | // chain. | ||
| 574 | - | func TypeAddClassCacheFunc(CacheDataVar uintptr, CacheFuncVar TypeClassCacheFunc) { | 574 | + | func TypeAddClassCacheFunc(CacheDataVar uintptr, CacheFuncVar *TypeClassCacheFunc) { |
| 575 | 575 | ||||
| 576 | - | xTypeAddClassCacheFunc(CacheDataVar, purego.NewCallback(CacheFuncVar)) | 576 | + | xTypeAddClassCacheFunc(CacheDataVar, glib.NewCallback(CacheFuncVar)) |
| 577 | 577 | ||||
| 578 | } | 578 | } | ||
| 579 | 579 | ||||
| @@ -614,9 +614,9 @@ var xTypeAddInterfaceCheck func(uintptr, uintptr) | |||||
| 614 | // implementation of #GObject uses this facility to check that an | 614 | // implementation of #GObject uses this facility to check that an | ||
| 615 | // object implements all of the properties that are defined on its | 615 | // object implements all of the properties that are defined on its | ||
| 616 | // interfaces. | 616 | // interfaces. | ||
| 617 | - | func TypeAddInterfaceCheck(CheckDataVar uintptr, CheckFuncVar TypeInterfaceCheckFunc) { | 617 | + | func TypeAddInterfaceCheck(CheckDataVar uintptr, CheckFuncVar *TypeInterfaceCheckFunc) { |
| 618 | 618 | ||||
| 619 | - | xTypeAddInterfaceCheck(CheckDataVar, purego.NewCallback(CheckFuncVar)) | 619 | + | xTypeAddInterfaceCheck(CheckDataVar, glib.NewCallback(CheckFuncVar)) |
| 620 | 620 | ||||
| 621 | } | 621 | } | ||
| 622 | 622 | ||||
| @@ -1202,9 +1202,9 @@ var xTypeRegisterStaticSimple func([]interface{}, string, uint, uintptr, uint, u | |||||
| 1202 | // @parent_type. The value of @flags determines the nature (e.g. | 1202 | // @parent_type. The value of @flags determines the nature (e.g. | ||
| 1203 | // abstract or not) of the type. It works by filling a #GTypeInfo | 1203 | // abstract or not) of the type. It works by filling a #GTypeInfo | ||
| 1204 | // struct and calling g_type_register_static(). | 1204 | // struct and calling g_type_register_static(). | ||
| 1205 | - | func TypeRegisterStaticSimple(ParentTypeVar []interface{}, TypeNameVar string, ClassSizeVar uint, ClassInitVar ClassInitFunc, InstanceSizeVar uint, InstanceInitVar InstanceInitFunc, FlagsVar TypeFlags) []interface{} { | 1205 | + | func TypeRegisterStaticSimple(ParentTypeVar []interface{}, TypeNameVar string, ClassSizeVar uint, ClassInitVar *ClassInitFunc, InstanceSizeVar uint, InstanceInitVar *InstanceInitFunc, FlagsVar TypeFlags) []interface{} { |
| 1206 | 1206 | ||||
| 1207 | - | cret := xTypeRegisterStaticSimple(ParentTypeVar, TypeNameVar, ClassSizeVar, purego.NewCallback(ClassInitVar), InstanceSizeVar, purego.NewCallback(InstanceInitVar), FlagsVar) | 1207 | + | cret := xTypeRegisterStaticSimple(ParentTypeVar, TypeNameVar, ClassSizeVar, glib.NewCallback(ClassInitVar), InstanceSizeVar, glib.NewCallback(InstanceInitVar), FlagsVar) |
| 1208 | return cret | 1208 | return cret | ||
| 1209 | } | 1209 | } | ||
| 1210 | 1210 | ||||
| @@ -1213,9 +1213,9 @@ var xTypeRemoveClassCacheFunc func(uintptr, uintptr) | |||||
| 1213 | // Removes a previously installed #GTypeClassCacheFunc. The cache | 1213 | // Removes a previously installed #GTypeClassCacheFunc. The cache | ||
| 1214 | // maintained by @cache_func has to be empty when calling | 1214 | // maintained by @cache_func has to be empty when calling | ||
| 1215 | // g_type_remove_class_cache_func() to avoid leaks. | 1215 | // g_type_remove_class_cache_func() to avoid leaks. | ||
| 1216 | - | func TypeRemoveClassCacheFunc(CacheDataVar uintptr, CacheFuncVar TypeClassCacheFunc) { | 1216 | + | func TypeRemoveClassCacheFunc(CacheDataVar uintptr, CacheFuncVar *TypeClassCacheFunc) { |
| 1217 | 1217 | ||||
| 1218 | - | xTypeRemoveClassCacheFunc(CacheDataVar, purego.NewCallback(CacheFuncVar)) | 1218 | + | xTypeRemoveClassCacheFunc(CacheDataVar, glib.NewCallback(CacheFuncVar)) |
| 1219 | 1219 | ||||
| 1220 | } | 1220 | } | ||
| 1221 | 1221 | ||||
| @@ -1223,9 +1223,9 @@ var xTypeRemoveInterfaceCheck func(uintptr, uintptr) | |||||
| 1223 | 1223 | ||||
| 1224 | // Removes an interface check function added with | 1224 | // Removes an interface check function added with | ||
| 1225 | // g_type_add_interface_check(). | 1225 | // g_type_add_interface_check(). | ||
| 1226 | - | func TypeRemoveInterfaceCheck(CheckDataVar uintptr, CheckFuncVar TypeInterfaceCheckFunc) { | 1226 | + | func TypeRemoveInterfaceCheck(CheckDataVar uintptr, CheckFuncVar *TypeInterfaceCheckFunc) { |
| 1227 | 1227 | ||||
| 1228 | - | xTypeRemoveInterfaceCheck(CheckDataVar, purego.NewCallback(CheckFuncVar)) | 1228 | + | xTypeRemoveInterfaceCheck(CheckDataVar, glib.NewCallback(CheckFuncVar)) |
| 1229 | 1229 | ||||
| 1230 | } | 1230 | } | ||
| 1231 | 1231 | ||||
M v4/gobject/gvalue.go +2 -2
| @@ -765,9 +765,9 @@ var xValueRegisterTransformFunc func([]interface{}, []interface{}, uintptr) | |||||
| 765 | // Registers a value transformation function for use in g_value_transform(). | 765 | // Registers a value transformation function for use in g_value_transform(). | ||
| 766 | // A previously registered transformation function for @src_type and @dest_type | 766 | // A previously registered transformation function for @src_type and @dest_type | ||
| 767 | // will be replaced. | 767 | // will be replaced. | ||
| 768 | - | func ValueRegisterTransformFunc(SrcTypeVar []interface{}, DestTypeVar []interface{}, TransformFuncVar ValueTransform) { | 768 | + | func ValueRegisterTransformFunc(SrcTypeVar []interface{}, DestTypeVar []interface{}, TransformFuncVar *ValueTransform) { |
| 769 | 769 | ||||
| 770 | - | xValueRegisterTransformFunc(SrcTypeVar, DestTypeVar, purego.NewCallback(TransformFuncVar)) | 770 | + | xValueRegisterTransformFunc(SrcTypeVar, DestTypeVar, glib.NewCallback(TransformFuncVar)) |
| 771 | 771 | ||||
| 772 | } | 772 | } | ||
| 773 | 773 | ||||
M v4/gobject/gvaluearray.go +4 -4
| @@ -107,9 +107,9 @@ var xValueArraySort func(uintptr, uintptr) *ValueArray | |||||
| 107 | // | 107 | // | ||
| 108 | // The current implementation uses the same sorting algorithm as standard | 108 | // The current implementation uses the same sorting algorithm as standard | ||
| 109 | // C qsort() function. | 109 | // C qsort() function. | ||
| 110 | - | func (x *ValueArray) Sort(CompareFuncVar glib.CompareFunc) *ValueArray { | 110 | + | func (x *ValueArray) Sort(CompareFuncVar *glib.CompareFunc) *ValueArray { |
| 111 | 111 | ||||
| 112 | - | cret := xValueArraySort(x.GoPointer(), purego.NewCallback(CompareFuncVar)) | 112 | + | cret := xValueArraySort(x.GoPointer(), glib.NewCallback(CompareFuncVar)) |
| 113 | return cret | 113 | return cret | ||
| 114 | } | 114 | } | ||
| 115 | 115 | ||||
| @@ -120,9 +120,9 @@ var xValueArraySortWithData func(uintptr, uintptr, uintptr) *ValueArray | |||||
| 120 | // | 120 | // | ||
| 121 | // The current implementation uses the same sorting algorithm as standard | 121 | // The current implementation uses the same sorting algorithm as standard | ||
| 122 | // C qsort() function. | 122 | // C qsort() function. | ||
| 123 | - | func (x *ValueArray) SortWithData(CompareFuncVar glib.CompareDataFunc, UserDataVar uintptr) *ValueArray { | 123 | + | func (x *ValueArray) SortWithData(CompareFuncVar *glib.CompareDataFunc, UserDataVar uintptr) *ValueArray { |
| 124 | 124 | ||||
| 125 | - | cret := xValueArraySortWithData(x.GoPointer(), purego.NewCallback(CompareFuncVar), UserDataVar) | 125 | + | cret := xValueArraySortWithData(x.GoPointer(), glib.NewCallback(CompareFuncVar), UserDataVar) |
| 126 | return cret | 126 | return cret | ||
| 127 | } | 127 | } | ||
| 128 | 128 | ||||
M v4/gobject/more.go +3 -8
| @@ -3,7 +3,7 @@ package gobject | |||||
| 3 | import ( | 3 | import ( | ||
| 4 | "reflect" | 4 | "reflect" | ||
| 5 | 5 | ||||
| 6 | - | "github.com/jwijenbergh/purego" | 6 | + | "github.com/jwijenbergh/puregotk/v4/glib" |
| 7 | ) | 7 | ) | ||
| 8 | 8 | ||||
| 9 | type Ptr interface { | 9 | type Ptr interface { | ||
| @@ -36,19 +36,14 @@ func (o Object) Cast(v Ptr) { | |||||
| 36 | v.SetGoPointer(o.GoPointer()) | 36 | v.SetGoPointer(o.GoPointer()) | ||
| 37 | } | 37 | } | ||
| 38 | 38 | ||||
| 39 | - | func (o Object) ConnectSignal(signal string, cb func()) uint32 { | 39 | + | func (o Object) ConnectSignal(signal string, cb *func()) uint32 { |
| 40 | - | return SignalConnect(o.GoPointer(), signal, purego.NewCallback(cb)) | 40 | + | return SignalConnect(o.GoPointer(), signal, glib.NewCallback(cb)) |
| 41 | } | 41 | } | ||
| 42 | 42 | ||||
| 43 | func (o Object) DisconnectSignal(handler uint32) { | 43 | func (o Object) DisconnectSignal(handler uint32) { | ||
| 44 | SignalHandlerDisconnect(&o, handler) | 44 | SignalHandlerDisconnect(&o, handler) | ||
| 45 | } | 45 | } | ||
| 46 | 46 | ||||
| 47 | - | // NewCallback is an alias to purego.NewCallback | |||
| 48 | - | func NewCallback(fn interface{}) uintptr { | |||
| 49 | - | return purego.NewCallback(fn) | |||
| 50 | - | } | |||
| 51 | - | ||||
| 52 | // types | 47 | // types | ||
| 53 | const ( | 48 | const ( | ||
| 54 | TypeInvalidVal Type = 0 | 49 | TypeInvalidVal Type = 0 | ||
M v4/gsk/gskrendernode.go +2 -2
| @@ -252,10 +252,10 @@ var xRenderNodeDeserialize func(*glib.Bytes, uintptr, uintptr) uintptr | |||||
| 252 | // Loads data previously created via [method@Gsk.RenderNode.serialize]. | 252 | // Loads data previously created via [method@Gsk.RenderNode.serialize]. | ||
| 253 | // | 253 | // | ||
| 254 | // For a discussion of the supported format, see that function. | 254 | // For a discussion of the supported format, see that function. | ||
| 255 | - | func RenderNodeDeserialize(BytesVar *glib.Bytes, ErrorFuncVar ParseErrorFunc, UserDataVar uintptr) *RenderNode { | 255 | + | func RenderNodeDeserialize(BytesVar *glib.Bytes, ErrorFuncVar *ParseErrorFunc, UserDataVar uintptr) *RenderNode { |
| 256 | var cls *RenderNode | 256 | var cls *RenderNode | ||
| 257 | 257 | ||||
| 258 | - | cret := xRenderNodeDeserialize(BytesVar, purego.NewCallback(ErrorFuncVar), UserDataVar) | 258 | + | cret := xRenderNodeDeserialize(BytesVar, glib.NewCallback(ErrorFuncVar), UserDataVar) |
| 259 | 259 | ||||
| 260 | if cret == 0 { | 260 | if cret == 0 { | ||
| 261 | return nil | 261 | return nil | ||
M v4/gtk/gtkaboutdialog.go +14 -3
| @@ -2,9 +2,12 @@ | |||||
| 2 | package gtk | 2 | package gtk | ||
| 3 | 3 | ||||
| 4 | import ( | 4 | import ( | ||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 5 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 6 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 7 | "github.com/jwijenbergh/puregotk/v4/gdk" | 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | ||
| 10 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 8 | "github.com/jwijenbergh/puregotk/v4/gobject" | 11 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 9 | "github.com/jwijenbergh/puregotk/v4/gsk" | 12 | "github.com/jwijenbergh/puregotk/v4/gsk" | ||
| 10 | ) | 13 | ) | ||
| @@ -508,15 +511,23 @@ func (c *AboutDialog) SetGoPointer(ptr uintptr) { | |||||
| 508 | // | 511 | // | ||
| 509 | // Applications may connect to it to override the default behaviour, | 512 | // Applications may connect to it to override the default behaviour, | ||
| 510 | // which is to call [func@Gtk.show_uri]. | 513 | // which is to call [func@Gtk.show_uri]. | ||
| 511 | - | func (x *AboutDialog) ConnectActivateLink(cb func(AboutDialog, string) bool) uint32 { | 514 | + | func (x *AboutDialog) ConnectActivateLink(cb *func(AboutDialog, string) bool) uint32 { |
| 515 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 516 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 517 | + | return gobject.SignalConnect(x.GoPointer(), "activate-link", cbRefPtr) | |||
| 518 | + | } | |||
| 519 | + | ||||
| 512 | fcb := func(clsPtr uintptr, UriVarp string) bool { | 520 | fcb := func(clsPtr uintptr, UriVarp string) bool { | ||
| 513 | fa := AboutDialog{} | 521 | fa := AboutDialog{} | ||
| 514 | fa.Ptr = clsPtr | 522 | fa.Ptr = clsPtr | ||
| 523 | + | cbFn := *cb | |||
| 515 | 524 | ||||
| 516 | - | return cb(fa, UriVarp) | 525 | + | return cbFn(fa, UriVarp) |
| 517 | 526 | ||||
| 518 | } | 527 | } | ||
| 519 | - | return gobject.SignalConnect(x.GoPointer(), "activate-link", purego.NewCallback(fcb)) | 528 | + | cbRefPtr := purego.NewCallback(fcb) |
| 529 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 530 | + | return gobject.SignalConnect(x.GoPointer(), "activate-link", cbRefPtr) | |||
| 520 | } | 531 | } | ||
| 521 | 532 | ||||
| 522 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 533 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/gtk/gtkadjustment.go +23 -6
| @@ -6,6 +6,7 @@ import ( | |||||
| 6 | 6 | ||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 9 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 10 | ) | 11 | ) | ||
| 11 | 12 | ||||
| @@ -256,27 +257,43 @@ func (c *Adjustment) SetGoPointer(ptr uintptr) { | |||||
| 256 | // | 257 | // | ||
| 257 | // Note that the [property@Gtk.Adjustment:value] property is | 258 | // Note that the [property@Gtk.Adjustment:value] property is | ||
| 258 | // covered by the [signal@Gtk.Adjustment::value-changed] signal. | 259 | // covered by the [signal@Gtk.Adjustment::value-changed] signal. | ||
| 259 | - | func (x *Adjustment) ConnectChanged(cb func(Adjustment)) uint32 { | 260 | + | func (x *Adjustment) ConnectChanged(cb *func(Adjustment)) uint32 { |
| 261 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 262 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 263 | + | return gobject.SignalConnect(x.GoPointer(), "changed", cbRefPtr) | |||
| 264 | + | } | |||
| 265 | + | ||||
| 260 | fcb := func(clsPtr uintptr) { | 266 | fcb := func(clsPtr uintptr) { | ||
| 261 | fa := Adjustment{} | 267 | fa := Adjustment{} | ||
| 262 | fa.Ptr = clsPtr | 268 | fa.Ptr = clsPtr | ||
| 269 | + | cbFn := *cb | |||
| 263 | 270 | ||||
| 264 | - | cb(fa) | 271 | + | cbFn(fa) |
| 265 | 272 | ||||
| 266 | } | 273 | } | ||
| 267 | - | return gobject.SignalConnect(x.GoPointer(), "changed", purego.NewCallback(fcb)) | 274 | + | cbRefPtr := purego.NewCallback(fcb) |
| 275 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 276 | + | return gobject.SignalConnect(x.GoPointer(), "changed", cbRefPtr) | |||
| 268 | } | 277 | } | ||
| 269 | 278 | ||||
| 270 | // Emitted when the value has been changed. | 279 | // Emitted when the value has been changed. | ||
| 271 | - | func (x *Adjustment) ConnectValueChanged(cb func(Adjustment)) uint32 { | 280 | + | func (x *Adjustment) ConnectValueChanged(cb *func(Adjustment)) uint32 { |
| 281 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 282 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 283 | + | return gobject.SignalConnect(x.GoPointer(), "value-changed", cbRefPtr) | |||
| 284 | + | } | |||
| 285 | + | ||||
| 272 | fcb := func(clsPtr uintptr) { | 286 | fcb := func(clsPtr uintptr) { | ||
| 273 | fa := Adjustment{} | 287 | fa := Adjustment{} | ||
| 274 | fa.Ptr = clsPtr | 288 | fa.Ptr = clsPtr | ||
| 289 | + | cbFn := *cb | |||
| 275 | 290 | ||||
| 276 | - | cb(fa) | 291 | + | cbFn(fa) |
| 277 | 292 | ||||
| 278 | } | 293 | } | ||
| 279 | - | return gobject.SignalConnect(x.GoPointer(), "value-changed", purego.NewCallback(fcb)) | 294 | + | cbRefPtr := purego.NewCallback(fcb) |
| 295 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 296 | + | return gobject.SignalConnect(x.GoPointer(), "value-changed", cbRefPtr) | |||
| 280 | } | 297 | } | ||
| 281 | 298 | ||||
| 282 | func init() { | 299 | func init() { | ||
M v4/gtk/gtkappchooserbutton.go +36 -9
| @@ -2,9 +2,12 @@ | |||||
| 2 | package gtk | 2 | package gtk | ||
| 3 | 3 | ||||
| 4 | import ( | 4 | import ( | ||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 5 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 6 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 7 | "github.com/jwijenbergh/puregotk/v4/gio" | 9 | "github.com/jwijenbergh/puregotk/v4/gio" | ||
| 10 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 8 | "github.com/jwijenbergh/puregotk/v4/gobject" | 11 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 9 | ) | 12 | ) | ||
| 10 | 13 | ||||
| @@ -194,42 +197,66 @@ func (c *AppChooserButton) SetGoPointer(ptr uintptr) { | |||||
| 194 | // | 197 | // | ||
| 195 | // The `::activate` signal on `GtkAppChooserButton` is an action signal and | 198 | // The `::activate` signal on `GtkAppChooserButton` is an action signal and | ||
| 196 | // emitting it causes the button to pop up its dialog. | 199 | // emitting it causes the button to pop up its dialog. | ||
| 197 | - | func (x *AppChooserButton) ConnectActivate(cb func(AppChooserButton)) uint32 { | 200 | + | func (x *AppChooserButton) ConnectActivate(cb *func(AppChooserButton)) uint32 { |
| 201 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 202 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 203 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 204 | + | } | |||
| 205 | + | ||||
| 198 | fcb := func(clsPtr uintptr) { | 206 | fcb := func(clsPtr uintptr) { | ||
| 199 | fa := AppChooserButton{} | 207 | fa := AppChooserButton{} | ||
| 200 | fa.Ptr = clsPtr | 208 | fa.Ptr = clsPtr | ||
| 209 | + | cbFn := *cb | |||
| 201 | 210 | ||||
| 202 | - | cb(fa) | 211 | + | cbFn(fa) |
| 203 | 212 | ||||
| 204 | } | 213 | } | ||
| 205 | - | return gobject.SignalConnect(x.GoPointer(), "activate", purego.NewCallback(fcb)) | 214 | + | cbRefPtr := purego.NewCallback(fcb) |
| 215 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 216 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 206 | } | 217 | } | ||
| 207 | 218 | ||||
| 208 | // Emitted when the active application changes. | 219 | // Emitted when the active application changes. | ||
| 209 | - | func (x *AppChooserButton) ConnectChanged(cb func(AppChooserButton)) uint32 { | 220 | + | func (x *AppChooserButton) ConnectChanged(cb *func(AppChooserButton)) uint32 { |
| 221 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 222 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 223 | + | return gobject.SignalConnect(x.GoPointer(), "changed", cbRefPtr) | |||
| 224 | + | } | |||
| 225 | + | ||||
| 210 | fcb := func(clsPtr uintptr) { | 226 | fcb := func(clsPtr uintptr) { | ||
| 211 | fa := AppChooserButton{} | 227 | fa := AppChooserButton{} | ||
| 212 | fa.Ptr = clsPtr | 228 | fa.Ptr = clsPtr | ||
| 229 | + | cbFn := *cb | |||
| 213 | 230 | ||||
| 214 | - | cb(fa) | 231 | + | cbFn(fa) |
| 215 | 232 | ||||
| 216 | } | 233 | } | ||
| 217 | - | return gobject.SignalConnect(x.GoPointer(), "changed", purego.NewCallback(fcb)) | 234 | + | cbRefPtr := purego.NewCallback(fcb) |
| 235 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 236 | + | return gobject.SignalConnect(x.GoPointer(), "changed", cbRefPtr) | |||
| 218 | } | 237 | } | ||
| 219 | 238 | ||||
| 220 | // Emitted when a custom item is activated. | 239 | // Emitted when a custom item is activated. | ||
| 221 | // | 240 | // | ||
| 222 | // Use [method@Gtk.AppChooserButton.append_custom_item], | 241 | // Use [method@Gtk.AppChooserButton.append_custom_item], | ||
| 223 | // to add custom items. | 242 | // to add custom items. | ||
| 224 | - | func (x *AppChooserButton) ConnectCustomItemActivated(cb func(AppChooserButton, string)) uint32 { | 243 | + | func (x *AppChooserButton) ConnectCustomItemActivated(cb *func(AppChooserButton, string)) uint32 { |
| 244 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 245 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 246 | + | return gobject.SignalConnect(x.GoPointer(), "custom-item-activated", cbRefPtr) | |||
| 247 | + | } | |||
| 248 | + | ||||
| 225 | fcb := func(clsPtr uintptr, ItemNameVarp string) { | 249 | fcb := func(clsPtr uintptr, ItemNameVarp string) { | ||
| 226 | fa := AppChooserButton{} | 250 | fa := AppChooserButton{} | ||
| 227 | fa.Ptr = clsPtr | 251 | fa.Ptr = clsPtr | ||
| 252 | + | cbFn := *cb | |||
| 228 | 253 | ||||
| 229 | - | cb(fa, ItemNameVarp) | 254 | + | cbFn(fa, ItemNameVarp) |
| 230 | 255 | ||||
| 231 | } | 256 | } | ||
| 232 | - | return gobject.SignalConnect(x.GoPointer(), "custom-item-activated", purego.NewCallback(fcb)) | 257 | + | cbRefPtr := purego.NewCallback(fcb) |
| 258 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 259 | + | return gobject.SignalConnect(x.GoPointer(), "custom-item-activated", cbRefPtr) | |||
| 233 | } | 260 | } | ||
| 234 | 261 | ||||
| 235 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 262 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/gtk/gtkappchooserwidget.go +25 -6
| @@ -2,9 +2,12 @@ | |||||
| 2 | package gtk | 2 | package gtk | ||
| 3 | 3 | ||||
| 4 | import ( | 4 | import ( | ||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 5 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 6 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 7 | "github.com/jwijenbergh/puregotk/v4/gio" | 9 | "github.com/jwijenbergh/puregotk/v4/gio" | ||
| 10 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 8 | "github.com/jwijenbergh/puregotk/v4/gobject" | 11 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 9 | ) | 12 | ) | ||
| 10 | 13 | ||||
| @@ -192,27 +195,43 @@ func (c *AppChooserWidget) SetGoPointer(ptr uintptr) { | |||||
| 192 | // This usually happens when the user double clicks an item, or an item | 195 | // This usually happens when the user double clicks an item, or an item | ||
| 193 | // is selected and the user presses one of the keys Space, Shift+Space, | 196 | // is selected and the user presses one of the keys Space, Shift+Space, | ||
| 194 | // Return or Enter. | 197 | // Return or Enter. | ||
| 195 | - | func (x *AppChooserWidget) ConnectApplicationActivated(cb func(AppChooserWidget, uintptr)) uint32 { | 198 | + | func (x *AppChooserWidget) ConnectApplicationActivated(cb *func(AppChooserWidget, uintptr)) uint32 { |
| 199 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 200 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 201 | + | return gobject.SignalConnect(x.GoPointer(), "application-activated", cbRefPtr) | |||
| 202 | + | } | |||
| 203 | + | ||||
| 196 | fcb := func(clsPtr uintptr, ApplicationVarp uintptr) { | 204 | fcb := func(clsPtr uintptr, ApplicationVarp uintptr) { | ||
| 197 | fa := AppChooserWidget{} | 205 | fa := AppChooserWidget{} | ||
| 198 | fa.Ptr = clsPtr | 206 | fa.Ptr = clsPtr | ||
| 207 | + | cbFn := *cb | |||
| 199 | 208 | ||||
| 200 | - | cb(fa, ApplicationVarp) | 209 | + | cbFn(fa, ApplicationVarp) |
| 201 | 210 | ||||
| 202 | } | 211 | } | ||
| 203 | - | return gobject.SignalConnect(x.GoPointer(), "application-activated", purego.NewCallback(fcb)) | 212 | + | cbRefPtr := purego.NewCallback(fcb) |
| 213 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 214 | + | return gobject.SignalConnect(x.GoPointer(), "application-activated", cbRefPtr) | |||
| 204 | } | 215 | } | ||
| 205 | 216 | ||||
| 206 | // Emitted when an application item is selected from the widget's list. | 217 | // Emitted when an application item is selected from the widget's list. | ||
| 207 | - | func (x *AppChooserWidget) ConnectApplicationSelected(cb func(AppChooserWidget, uintptr)) uint32 { | 218 | + | func (x *AppChooserWidget) ConnectApplicationSelected(cb *func(AppChooserWidget, uintptr)) uint32 { |
| 219 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 220 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 221 | + | return gobject.SignalConnect(x.GoPointer(), "application-selected", cbRefPtr) | |||
| 222 | + | } | |||
| 223 | + | ||||
| 208 | fcb := func(clsPtr uintptr, ApplicationVarp uintptr) { | 224 | fcb := func(clsPtr uintptr, ApplicationVarp uintptr) { | ||
| 209 | fa := AppChooserWidget{} | 225 | fa := AppChooserWidget{} | ||
| 210 | fa.Ptr = clsPtr | 226 | fa.Ptr = clsPtr | ||
| 227 | + | cbFn := *cb | |||
| 211 | 228 | ||||
| 212 | - | cb(fa, ApplicationVarp) | 229 | + | cbFn(fa, ApplicationVarp) |
| 213 | 230 | ||||
| 214 | } | 231 | } | ||
| 215 | - | return gobject.SignalConnect(x.GoPointer(), "application-selected", purego.NewCallback(fcb)) | 232 | + | cbRefPtr := purego.NewCallback(fcb) |
| 233 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 234 | + | return gobject.SignalConnect(x.GoPointer(), "application-selected", cbRefPtr) | |||
| 216 | } | 235 | } | ||
| 217 | 236 | ||||
| 218 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 237 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/gtk/gtkapplication.go +33 -9
| @@ -432,43 +432,67 @@ func (c *Application) SetGoPointer(ptr uintptr) { | |||||
| 432 | // is `TRUE`. Applications can connect to this signal and call | 432 | // is `TRUE`. Applications can connect to this signal and call | ||
| 433 | // [method@Gtk.Application.inhibit] with `GTK_APPLICATION_INHIBIT_LOGOUT` | 433 | // [method@Gtk.Application.inhibit] with `GTK_APPLICATION_INHIBIT_LOGOUT` | ||
| 434 | // to delay the end of the session until state has been saved. | 434 | // to delay the end of the session until state has been saved. | ||
| 435 | - | func (x *Application) ConnectQueryEnd(cb func(Application)) uint32 { | 435 | + | func (x *Application) ConnectQueryEnd(cb *func(Application)) uint32 { |
| 436 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 437 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 438 | + | return gobject.SignalConnect(x.GoPointer(), "query-end", cbRefPtr) | |||
| 439 | + | } | |||
| 440 | + | ||||
| 436 | fcb := func(clsPtr uintptr) { | 441 | fcb := func(clsPtr uintptr) { | ||
| 437 | fa := Application{} | 442 | fa := Application{} | ||
| 438 | fa.Ptr = clsPtr | 443 | fa.Ptr = clsPtr | ||
| 444 | + | cbFn := *cb | |||
| 439 | 445 | ||||
| 440 | - | cb(fa) | 446 | + | cbFn(fa) |
| 441 | 447 | ||||
| 442 | } | 448 | } | ||
| 443 | - | return gobject.SignalConnect(x.GoPointer(), "query-end", purego.NewCallback(fcb)) | 449 | + | cbRefPtr := purego.NewCallback(fcb) |
| 450 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 451 | + | return gobject.SignalConnect(x.GoPointer(), "query-end", cbRefPtr) | |||
| 444 | } | 452 | } | ||
| 445 | 453 | ||||
| 446 | // Emitted when a [class@Gtk.Window] is added to `application` through | 454 | // Emitted when a [class@Gtk.Window] is added to `application` through | ||
| 447 | // [method@Gtk.Application.add_window]. | 455 | // [method@Gtk.Application.add_window]. | ||
| 448 | - | func (x *Application) ConnectWindowAdded(cb func(Application, uintptr)) uint32 { | 456 | + | func (x *Application) ConnectWindowAdded(cb *func(Application, uintptr)) uint32 { |
| 457 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 458 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 459 | + | return gobject.SignalConnect(x.GoPointer(), "window-added", cbRefPtr) | |||
| 460 | + | } | |||
| 461 | + | ||||
| 449 | fcb := func(clsPtr uintptr, WindowVarp uintptr) { | 462 | fcb := func(clsPtr uintptr, WindowVarp uintptr) { | ||
| 450 | fa := Application{} | 463 | fa := Application{} | ||
| 451 | fa.Ptr = clsPtr | 464 | fa.Ptr = clsPtr | ||
| 465 | + | cbFn := *cb | |||
| 452 | 466 | ||||
| 453 | - | cb(fa, WindowVarp) | 467 | + | cbFn(fa, WindowVarp) |
| 454 | 468 | ||||
| 455 | } | 469 | } | ||
| 456 | - | return gobject.SignalConnect(x.GoPointer(), "window-added", purego.NewCallback(fcb)) | 470 | + | cbRefPtr := purego.NewCallback(fcb) |
| 471 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 472 | + | return gobject.SignalConnect(x.GoPointer(), "window-added", cbRefPtr) | |||
| 457 | } | 473 | } | ||
| 458 | 474 | ||||
| 459 | // Emitted when a [class@Gtk.Window] is removed from `application`. | 475 | // Emitted when a [class@Gtk.Window] is removed from `application`. | ||
| 460 | // | 476 | // | ||
| 461 | // This can happen as a side-effect of the window being destroyed | 477 | // This can happen as a side-effect of the window being destroyed | ||
| 462 | // or explicitly through [method@Gtk.Application.remove_window]. | 478 | // or explicitly through [method@Gtk.Application.remove_window]. | ||
| 463 | - | func (x *Application) ConnectWindowRemoved(cb func(Application, uintptr)) uint32 { | 479 | + | func (x *Application) ConnectWindowRemoved(cb *func(Application, uintptr)) uint32 { |
| 480 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 481 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 482 | + | return gobject.SignalConnect(x.GoPointer(), "window-removed", cbRefPtr) | |||
| 483 | + | } | |||
| 484 | + | ||||
| 464 | fcb := func(clsPtr uintptr, WindowVarp uintptr) { | 485 | fcb := func(clsPtr uintptr, WindowVarp uintptr) { | ||
| 465 | fa := Application{} | 486 | fa := Application{} | ||
| 466 | fa.Ptr = clsPtr | 487 | fa.Ptr = clsPtr | ||
| 488 | + | cbFn := *cb | |||
| 467 | 489 | ||||
| 468 | - | cb(fa, WindowVarp) | 490 | + | cbFn(fa, WindowVarp) |
| 469 | 491 | ||||
| 470 | } | 492 | } | ||
| 471 | - | return gobject.SignalConnect(x.GoPointer(), "window-removed", purego.NewCallback(fcb)) | 493 | + | cbRefPtr := purego.NewCallback(fcb) |
| 494 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 495 | + | return gobject.SignalConnect(x.GoPointer(), "window-removed", cbRefPtr) | |||
| 472 | } | 496 | } | ||
| 473 | 497 | ||||
| 474 | // Emits the #GActionGroup::action-added signal on @action_group. | 498 | // Emits the #GActionGroup::action-added signal on @action_group. | ||
M v4/gtk/gtkassistant.go +59 -17
| @@ -2,6 +2,8 @@ | |||||
| 2 | package gtk | 2 | package gtk | ||
| 3 | 3 | ||||
| 4 | import ( | 4 | import ( | ||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 5 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 6 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 7 | "github.com/jwijenbergh/puregotk/v4/gdk" | 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | ||
| @@ -338,9 +340,9 @@ var xAssistantSetForwardPageFunc func(uintptr, uintptr, uintptr, uintptr) | |||||
| 338 | // Setting @page_func to %NULL will make the assistant to | 340 | // Setting @page_func to %NULL will make the assistant to | ||
| 339 | // use the default forward function, which just goes to the | 341 | // use the default forward function, which just goes to the | ||
| 340 | // next visible page. | 342 | // next visible page. | ||
| 341 | - | func (x *Assistant) SetForwardPageFunc(PageFuncVar AssistantPageFunc, DataVar uintptr, DestroyVar glib.DestroyNotify) { | 343 | + | func (x *Assistant) SetForwardPageFunc(PageFuncVar *AssistantPageFunc, DataVar uintptr, DestroyVar *glib.DestroyNotify) { |
| 342 | 344 | ||||
| 343 | - | xAssistantSetForwardPageFunc(x.GoPointer(), purego.NewCallback(PageFuncVar), DataVar, purego.NewCallback(DestroyVar)) | 345 | + | xAssistantSetForwardPageFunc(x.GoPointer(), glib.NewCallback(PageFuncVar), DataVar, glib.NewCallback(DestroyVar)) |
| 344 | 346 | ||||
| 345 | } | 347 | } | ||
| 346 | 348 | ||||
| @@ -415,53 +417,85 @@ func (c *Assistant) SetGoPointer(ptr uintptr) { | |||||
| 415 | // %GTK_ASSISTANT_PAGE_PROGRESS after the confirmation page and handle | 417 | // %GTK_ASSISTANT_PAGE_PROGRESS after the confirmation page and handle | ||
| 416 | // this operation within the [signal@Gtk.Assistant::prepare] signal of | 418 | // this operation within the [signal@Gtk.Assistant::prepare] signal of | ||
| 417 | // the progress page. | 419 | // the progress page. | ||
| 418 | - | func (x *Assistant) ConnectApply(cb func(Assistant)) uint32 { | 420 | + | func (x *Assistant) ConnectApply(cb *func(Assistant)) uint32 { |
| 421 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 422 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 423 | + | return gobject.SignalConnect(x.GoPointer(), "apply", cbRefPtr) | |||
| 424 | + | } | |||
| 425 | + | ||||
| 419 | fcb := func(clsPtr uintptr) { | 426 | fcb := func(clsPtr uintptr) { | ||
| 420 | fa := Assistant{} | 427 | fa := Assistant{} | ||
| 421 | fa.Ptr = clsPtr | 428 | fa.Ptr = clsPtr | ||
| 429 | + | cbFn := *cb | |||
| 422 | 430 | ||||
| 423 | - | cb(fa) | 431 | + | cbFn(fa) |
| 424 | 432 | ||||
| 425 | } | 433 | } | ||
| 426 | - | return gobject.SignalConnect(x.GoPointer(), "apply", purego.NewCallback(fcb)) | 434 | + | cbRefPtr := purego.NewCallback(fcb) |
| 435 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 436 | + | return gobject.SignalConnect(x.GoPointer(), "apply", cbRefPtr) | |||
| 427 | } | 437 | } | ||
| 428 | 438 | ||||
| 429 | // Emitted when then the cancel button is clicked. | 439 | // Emitted when then the cancel button is clicked. | ||
| 430 | - | func (x *Assistant) ConnectCancel(cb func(Assistant)) uint32 { | 440 | + | func (x *Assistant) ConnectCancel(cb *func(Assistant)) uint32 { |
| 441 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 442 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 443 | + | return gobject.SignalConnect(x.GoPointer(), "cancel", cbRefPtr) | |||
| 444 | + | } | |||
| 445 | + | ||||
| 431 | fcb := func(clsPtr uintptr) { | 446 | fcb := func(clsPtr uintptr) { | ||
| 432 | fa := Assistant{} | 447 | fa := Assistant{} | ||
| 433 | fa.Ptr = clsPtr | 448 | fa.Ptr = clsPtr | ||
| 449 | + | cbFn := *cb | |||
| 434 | 450 | ||||
| 435 | - | cb(fa) | 451 | + | cbFn(fa) |
| 436 | 452 | ||||
| 437 | } | 453 | } | ||
| 438 | - | return gobject.SignalConnect(x.GoPointer(), "cancel", purego.NewCallback(fcb)) | 454 | + | cbRefPtr := purego.NewCallback(fcb) |
| 455 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 456 | + | return gobject.SignalConnect(x.GoPointer(), "cancel", cbRefPtr) | |||
| 439 | } | 457 | } | ||
| 440 | 458 | ||||
| 441 | // Emitted either when the close button of a summary page is clicked, | 459 | // Emitted either when the close button of a summary page is clicked, | ||
| 442 | // or when the apply button in the last page in the flow (of type | 460 | // or when the apply button in the last page in the flow (of type | ||
| 443 | // %GTK_ASSISTANT_PAGE_CONFIRM) is clicked. | 461 | // %GTK_ASSISTANT_PAGE_CONFIRM) is clicked. | ||
| 444 | - | func (x *Assistant) ConnectClose(cb func(Assistant)) uint32 { | 462 | + | func (x *Assistant) ConnectClose(cb *func(Assistant)) uint32 { |
| 463 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 464 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 465 | + | return gobject.SignalConnect(x.GoPointer(), "close", cbRefPtr) | |||
| 466 | + | } | |||
| 467 | + | ||||
| 445 | fcb := func(clsPtr uintptr) { | 468 | fcb := func(clsPtr uintptr) { | ||
| 446 | fa := Assistant{} | 469 | fa := Assistant{} | ||
| 447 | fa.Ptr = clsPtr | 470 | fa.Ptr = clsPtr | ||
| 471 | + | cbFn := *cb | |||
| 448 | 472 | ||||
| 449 | - | cb(fa) | 473 | + | cbFn(fa) |
| 450 | 474 | ||||
| 451 | } | 475 | } | ||
| 452 | - | return gobject.SignalConnect(x.GoPointer(), "close", purego.NewCallback(fcb)) | 476 | + | cbRefPtr := purego.NewCallback(fcb) |
| 477 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 478 | + | return gobject.SignalConnect(x.GoPointer(), "close", cbRefPtr) | |||
| 453 | } | 479 | } | ||
| 454 | 480 | ||||
| 455 | // The action signal for the Escape binding. | 481 | // The action signal for the Escape binding. | ||
| 456 | - | func (x *Assistant) ConnectEscape(cb func(Assistant)) uint32 { | 482 | + | func (x *Assistant) ConnectEscape(cb *func(Assistant)) uint32 { |
| 483 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 484 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 485 | + | return gobject.SignalConnect(x.GoPointer(), "escape", cbRefPtr) | |||
| 486 | + | } | |||
| 487 | + | ||||
| 457 | fcb := func(clsPtr uintptr) { | 488 | fcb := func(clsPtr uintptr) { | ||
| 458 | fa := Assistant{} | 489 | fa := Assistant{} | ||
| 459 | fa.Ptr = clsPtr | 490 | fa.Ptr = clsPtr | ||
| 491 | + | cbFn := *cb | |||
| 460 | 492 | ||||
| 461 | - | cb(fa) | 493 | + | cbFn(fa) |
| 462 | 494 | ||||
| 463 | } | 495 | } | ||
| 464 | - | return gobject.SignalConnect(x.GoPointer(), "escape", purego.NewCallback(fcb)) | 496 | + | cbRefPtr := purego.NewCallback(fcb) |
| 497 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 498 | + | return gobject.SignalConnect(x.GoPointer(), "escape", cbRefPtr) | |||
| 465 | } | 499 | } | ||
| 466 | 500 | ||||
| 467 | // Emitted when a new page is set as the assistant's current page, | 501 | // Emitted when a new page is set as the assistant's current page, | ||
| @@ -469,15 +503,23 @@ func (x *Assistant) ConnectEscape(cb func(Assistant)) uint32 { | |||||
| 469 | // | 503 | // | ||
| 470 | // A handler for this signal can do any preparations which are | 504 | // A handler for this signal can do any preparations which are | ||
| 471 | // necessary before showing @page. | 505 | // necessary before showing @page. | ||
| 472 | - | func (x *Assistant) ConnectPrepare(cb func(Assistant, uintptr)) uint32 { | 506 | + | func (x *Assistant) ConnectPrepare(cb *func(Assistant, uintptr)) uint32 { |
| 507 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 508 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 509 | + | return gobject.SignalConnect(x.GoPointer(), "prepare", cbRefPtr) | |||
| 510 | + | } | |||
| 511 | + | ||||
| 473 | fcb := func(clsPtr uintptr, PageVarp uintptr) { | 512 | fcb := func(clsPtr uintptr, PageVarp uintptr) { | ||
| 474 | fa := Assistant{} | 513 | fa := Assistant{} | ||
| 475 | fa.Ptr = clsPtr | 514 | fa.Ptr = clsPtr | ||
| 515 | + | cbFn := *cb | |||
| 476 | 516 | ||||
| 477 | - | cb(fa, PageVarp) | 517 | + | cbFn(fa, PageVarp) |
| 478 | 518 | ||||
| 479 | } | 519 | } | ||
| 480 | - | return gobject.SignalConnect(x.GoPointer(), "prepare", purego.NewCallback(fcb)) | 520 | + | cbRefPtr := purego.NewCallback(fcb) |
| 521 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 522 | + | return gobject.SignalConnect(x.GoPointer(), "prepare", cbRefPtr) | |||
| 481 | } | 523 | } | ||
| 482 | 524 | ||||
| 483 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 525 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/gtk/gtkatcontext.go +12 -3
| @@ -7,6 +7,7 @@ import ( | |||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | ||
| 10 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | 11 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 11 | ) | 12 | ) | ||
| 12 | 13 | ||||
| @@ -89,15 +90,23 @@ func (c *ATContext) SetGoPointer(ptr uintptr) { | |||||
| 89 | 90 | ||||
| 90 | // Emitted when the attributes of the accessible for the | 91 | // Emitted when the attributes of the accessible for the | ||
| 91 | // `GtkATContext` instance change. | 92 | // `GtkATContext` instance change. | ||
| 92 | - | func (x *ATContext) ConnectStateChange(cb func(ATContext)) uint32 { | 93 | + | func (x *ATContext) ConnectStateChange(cb *func(ATContext)) uint32 { |
| 94 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 95 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 96 | + | return gobject.SignalConnect(x.GoPointer(), "state-change", cbRefPtr) | |||
| 97 | + | } | |||
| 98 | + | ||||
| 93 | fcb := func(clsPtr uintptr) { | 99 | fcb := func(clsPtr uintptr) { | ||
| 94 | fa := ATContext{} | 100 | fa := ATContext{} | ||
| 95 | fa.Ptr = clsPtr | 101 | fa.Ptr = clsPtr | ||
| 102 | + | cbFn := *cb | |||
| 96 | 103 | ||||
| 97 | - | cb(fa) | 104 | + | cbFn(fa) |
| 98 | 105 | ||||
| 99 | } | 106 | } | ||
| 100 | - | return gobject.SignalConnect(x.GoPointer(), "state-change", purego.NewCallback(fcb)) | 107 | + | cbRefPtr := purego.NewCallback(fcb) |
| 108 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 109 | + | return gobject.SignalConnect(x.GoPointer(), "state-change", cbRefPtr) | |||
| 101 | } | 110 | } | ||
| 102 | 111 | ||||
| 103 | func init() { | 112 | func init() { | ||
M v4/gtk/gtkbuilderscope.go +5 -4
| @@ -6,6 +6,7 @@ import ( | |||||
| 6 | 6 | ||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 9 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 10 | ) | 11 | ) | ||
| 11 | 12 | ||||
| @@ -129,9 +130,9 @@ var xBuilderCScopeAddCallbackSymbol func(uintptr, string, uintptr) | |||||
| 129 | // are added. Using this method allows for better encapsulation as it | 130 | // are added. Using this method allows for better encapsulation as it | ||
| 130 | // does not require that callback symbols be declared in the global | 131 | // does not require that callback symbols be declared in the global | ||
| 131 | // namespace. | 132 | // namespace. | ||
| 132 | - | func (x *BuilderCScope) AddCallbackSymbol(CallbackNameVar string, CallbackSymbolVar gobject.Callback) { | 133 | + | func (x *BuilderCScope) AddCallbackSymbol(CallbackNameVar string, CallbackSymbolVar *gobject.Callback) { |
| 133 | 134 | ||||
| 134 | - | xBuilderCScopeAddCallbackSymbol(x.GoPointer(), CallbackNameVar, purego.NewCallback(CallbackSymbolVar)) | 135 | + | xBuilderCScopeAddCallbackSymbol(x.GoPointer(), CallbackNameVar, glib.NewCallback(CallbackSymbolVar)) |
| 135 | 136 | ||||
| 136 | } | 137 | } | ||
| 137 | 138 | ||||
| @@ -141,9 +142,9 @@ var xBuilderCScopeAddCallbackSymbols func(uintptr, string, uintptr, ...interface | |||||
| 141 | // | 142 | // | ||
| 142 | // This is equivalent to calling [method@Gtk.BuilderCScope.add_callback_symbol] | 143 | // This is equivalent to calling [method@Gtk.BuilderCScope.add_callback_symbol] | ||
| 143 | // for each symbol. | 144 | // for each symbol. | ||
| 144 | - | func (x *BuilderCScope) AddCallbackSymbols(FirstCallbackNameVar string, FirstCallbackSymbolVar gobject.Callback, varArgs ...interface{}) { | 145 | + | func (x *BuilderCScope) AddCallbackSymbols(FirstCallbackNameVar string, FirstCallbackSymbolVar *gobject.Callback, varArgs ...interface{}) { |
| 145 | 146 | ||||
| 146 | - | xBuilderCScopeAddCallbackSymbols(x.GoPointer(), FirstCallbackNameVar, purego.NewCallback(FirstCallbackSymbolVar), varArgs...) | 147 | + | xBuilderCScopeAddCallbackSymbols(x.GoPointer(), FirstCallbackNameVar, glib.NewCallback(FirstCallbackSymbolVar), varArgs...) |
| 147 | 148 | ||||
| 148 | } | 149 | } | ||
| 149 | 150 | ||||
M v4/gtk/gtkbutton.go +22 -6
| @@ -282,27 +282,43 @@ func (c *Button) SetGoPointer(ptr uintptr) { | |||||
| 282 | // | 282 | // | ||
| 283 | // This is an action signal. Applications should never connect | 283 | // This is an action signal. Applications should never connect | ||
| 284 | // to this signal, but use the [signal@Gtk.Button::clicked] signal. | 284 | // to this signal, but use the [signal@Gtk.Button::clicked] signal. | ||
| 285 | - | func (x *Button) ConnectActivate(cb func(Button)) uint32 { | 285 | + | func (x *Button) ConnectActivate(cb *func(Button)) uint32 { |
| 286 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 287 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 288 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 289 | + | } | |||
| 290 | + | ||||
| 286 | fcb := func(clsPtr uintptr) { | 291 | fcb := func(clsPtr uintptr) { | ||
| 287 | fa := Button{} | 292 | fa := Button{} | ||
| 288 | fa.Ptr = clsPtr | 293 | fa.Ptr = clsPtr | ||
| 294 | + | cbFn := *cb | |||
| 289 | 295 | ||||
| 290 | - | cb(fa) | 296 | + | cbFn(fa) |
| 291 | 297 | ||||
| 292 | } | 298 | } | ||
| 293 | - | return gobject.SignalConnect(x.GoPointer(), "activate", purego.NewCallback(fcb)) | 299 | + | cbRefPtr := purego.NewCallback(fcb) |
| 300 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 301 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 294 | } | 302 | } | ||
| 295 | 303 | ||||
| 296 | // Emitted when the button has been activated (pressed and released). | 304 | // Emitted when the button has been activated (pressed and released). | ||
| 297 | - | func (x *Button) ConnectClicked(cb func(Button)) uint32 { | 305 | + | func (x *Button) ConnectClicked(cb *func(Button)) uint32 { |
| 306 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 307 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 308 | + | return gobject.SignalConnect(x.GoPointer(), "clicked", cbRefPtr) | |||
| 309 | + | } | |||
| 310 | + | ||||
| 298 | fcb := func(clsPtr uintptr) { | 311 | fcb := func(clsPtr uintptr) { | ||
| 299 | fa := Button{} | 312 | fa := Button{} | ||
| 300 | fa.Ptr = clsPtr | 313 | fa.Ptr = clsPtr | ||
| 314 | + | cbFn := *cb | |||
| 301 | 315 | ||||
| 302 | - | cb(fa) | 316 | + | cbFn(fa) |
| 303 | 317 | ||||
| 304 | } | 318 | } | ||
| 305 | - | return gobject.SignalConnect(x.GoPointer(), "clicked", purego.NewCallback(fcb)) | 319 | + | cbRefPtr := purego.NewCallback(fcb) |
| 320 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 321 | + | return gobject.SignalConnect(x.GoPointer(), "clicked", cbRefPtr) | |||
| 306 | } | 322 | } | ||
| 307 | 323 | ||||
| 308 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 324 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/gtk/gtkcalendar.go +57 -15
| @@ -2,6 +2,8 @@ | |||||
| 2 | package gtk | 2 | package gtk | ||
| 3 | 3 | ||||
| 4 | import ( | 4 | import ( | ||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 5 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 6 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 7 | "github.com/jwijenbergh/puregotk/v4/glib" | 9 | "github.com/jwijenbergh/puregotk/v4/glib" | ||
| @@ -220,63 +222,103 @@ func (c *Calendar) SetGoPointer(ptr uintptr) { | |||||
| 220 | } | 222 | } | ||
| 221 | 223 | ||||
| 222 | // Emitted when the user selects a day. | 224 | // Emitted when the user selects a day. | ||
| 223 | - | func (x *Calendar) ConnectDaySelected(cb func(Calendar)) uint32 { | 225 | + | func (x *Calendar) ConnectDaySelected(cb *func(Calendar)) uint32 { |
| 226 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 227 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 228 | + | return gobject.SignalConnect(x.GoPointer(), "day-selected", cbRefPtr) | |||
| 229 | + | } | |||
| 230 | + | ||||
| 224 | fcb := func(clsPtr uintptr) { | 231 | fcb := func(clsPtr uintptr) { | ||
| 225 | fa := Calendar{} | 232 | fa := Calendar{} | ||
| 226 | fa.Ptr = clsPtr | 233 | fa.Ptr = clsPtr | ||
| 234 | + | cbFn := *cb | |||
| 227 | 235 | ||||
| 228 | - | cb(fa) | 236 | + | cbFn(fa) |
| 229 | 237 | ||||
| 230 | } | 238 | } | ||
| 231 | - | return gobject.SignalConnect(x.GoPointer(), "day-selected", purego.NewCallback(fcb)) | 239 | + | cbRefPtr := purego.NewCallback(fcb) |
| 240 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 241 | + | return gobject.SignalConnect(x.GoPointer(), "day-selected", cbRefPtr) | |||
| 232 | } | 242 | } | ||
| 233 | 243 | ||||
| 234 | // Emitted when the user switched to the next month. | 244 | // Emitted when the user switched to the next month. | ||
| 235 | - | func (x *Calendar) ConnectNextMonth(cb func(Calendar)) uint32 { | 245 | + | func (x *Calendar) ConnectNextMonth(cb *func(Calendar)) uint32 { |
| 246 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 247 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 248 | + | return gobject.SignalConnect(x.GoPointer(), "next-month", cbRefPtr) | |||
| 249 | + | } | |||
| 250 | + | ||||
| 236 | fcb := func(clsPtr uintptr) { | 251 | fcb := func(clsPtr uintptr) { | ||
| 237 | fa := Calendar{} | 252 | fa := Calendar{} | ||
| 238 | fa.Ptr = clsPtr | 253 | fa.Ptr = clsPtr | ||
| 254 | + | cbFn := *cb | |||
| 239 | 255 | ||||
| 240 | - | cb(fa) | 256 | + | cbFn(fa) |
| 241 | 257 | ||||
| 242 | } | 258 | } | ||
| 243 | - | return gobject.SignalConnect(x.GoPointer(), "next-month", purego.NewCallback(fcb)) | 259 | + | cbRefPtr := purego.NewCallback(fcb) |
| 260 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 261 | + | return gobject.SignalConnect(x.GoPointer(), "next-month", cbRefPtr) | |||
| 244 | } | 262 | } | ||
| 245 | 263 | ||||
| 246 | // Emitted when user switched to the next year. | 264 | // Emitted when user switched to the next year. | ||
| 247 | - | func (x *Calendar) ConnectNextYear(cb func(Calendar)) uint32 { | 265 | + | func (x *Calendar) ConnectNextYear(cb *func(Calendar)) uint32 { |
| 266 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 267 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 268 | + | return gobject.SignalConnect(x.GoPointer(), "next-year", cbRefPtr) | |||
| 269 | + | } | |||
| 270 | + | ||||
| 248 | fcb := func(clsPtr uintptr) { | 271 | fcb := func(clsPtr uintptr) { | ||
| 249 | fa := Calendar{} | 272 | fa := Calendar{} | ||
| 250 | fa.Ptr = clsPtr | 273 | fa.Ptr = clsPtr | ||
| 274 | + | cbFn := *cb | |||
| 251 | 275 | ||||
| 252 | - | cb(fa) | 276 | + | cbFn(fa) |
| 253 | 277 | ||||
| 254 | } | 278 | } | ||
| 255 | - | return gobject.SignalConnect(x.GoPointer(), "next-year", purego.NewCallback(fcb)) | 279 | + | cbRefPtr := purego.NewCallback(fcb) |
| 280 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 281 | + | return gobject.SignalConnect(x.GoPointer(), "next-year", cbRefPtr) | |||
| 256 | } | 282 | } | ||
| 257 | 283 | ||||
| 258 | // Emitted when the user switched to the previous month. | 284 | // Emitted when the user switched to the previous month. | ||
| 259 | - | func (x *Calendar) ConnectPrevMonth(cb func(Calendar)) uint32 { | 285 | + | func (x *Calendar) ConnectPrevMonth(cb *func(Calendar)) uint32 { |
| 286 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 287 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 288 | + | return gobject.SignalConnect(x.GoPointer(), "prev-month", cbRefPtr) | |||
| 289 | + | } | |||
| 290 | + | ||||
| 260 | fcb := func(clsPtr uintptr) { | 291 | fcb := func(clsPtr uintptr) { | ||
| 261 | fa := Calendar{} | 292 | fa := Calendar{} | ||
| 262 | fa.Ptr = clsPtr | 293 | fa.Ptr = clsPtr | ||
| 294 | + | cbFn := *cb | |||
| 263 | 295 | ||||
| 264 | - | cb(fa) | 296 | + | cbFn(fa) |
| 265 | 297 | ||||
| 266 | } | 298 | } | ||
| 267 | - | return gobject.SignalConnect(x.GoPointer(), "prev-month", purego.NewCallback(fcb)) | 299 | + | cbRefPtr := purego.NewCallback(fcb) |
| 300 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 301 | + | return gobject.SignalConnect(x.GoPointer(), "prev-month", cbRefPtr) | |||
| 268 | } | 302 | } | ||
| 269 | 303 | ||||
| 270 | // Emitted when user switched to the previous year. | 304 | // Emitted when user switched to the previous year. | ||
| 271 | - | func (x *Calendar) ConnectPrevYear(cb func(Calendar)) uint32 { | 305 | + | func (x *Calendar) ConnectPrevYear(cb *func(Calendar)) uint32 { |
| 306 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 307 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 308 | + | return gobject.SignalConnect(x.GoPointer(), "prev-year", cbRefPtr) | |||
| 309 | + | } | |||
| 310 | + | ||||
| 272 | fcb := func(clsPtr uintptr) { | 311 | fcb := func(clsPtr uintptr) { | ||
| 273 | fa := Calendar{} | 312 | fa := Calendar{} | ||
| 274 | fa.Ptr = clsPtr | 313 | fa.Ptr = clsPtr | ||
| 314 | + | cbFn := *cb | |||
| 275 | 315 | ||||
| 276 | - | cb(fa) | 316 | + | cbFn(fa) |
| 277 | 317 | ||||
| 278 | } | 318 | } | ||
| 279 | - | return gobject.SignalConnect(x.GoPointer(), "prev-year", purego.NewCallback(fcb)) | 319 | + | cbRefPtr := purego.NewCallback(fcb) |
| 320 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 321 | + | return gobject.SignalConnect(x.GoPointer(), "prev-year", cbRefPtr) | |||
| 280 | } | 322 | } | ||
| 281 | 323 | ||||
| 282 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 324 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/gtk/gtkcellarea.go +50 -18
| @@ -624,9 +624,9 @@ func (x *CellArea) Focus(DirectionVar DirectionType) bool { | |||||
| 624 | var xCellAreaForeach func(uintptr, uintptr, uintptr) | 624 | var xCellAreaForeach func(uintptr, uintptr, uintptr) | ||
| 625 | 625 | ||||
| 626 | // Calls @callback for every `GtkCellRenderer` in @area. | 626 | // Calls @callback for every `GtkCellRenderer` in @area. | ||
| 627 | - | func (x *CellArea) Foreach(CallbackVar CellCallback, CallbackDataVar uintptr) { | 627 | + | func (x *CellArea) Foreach(CallbackVar *CellCallback, CallbackDataVar uintptr) { |
| 628 | 628 | ||||
| 629 | - | xCellAreaForeach(x.GoPointer(), purego.NewCallback(CallbackVar), CallbackDataVar) | 629 | + | xCellAreaForeach(x.GoPointer(), glib.NewCallback(CallbackVar), CallbackDataVar) |
| 630 | 630 | ||||
| 631 | } | 631 | } | ||
| 632 | 632 | ||||
| @@ -634,9 +634,9 @@ var xCellAreaForeachAlloc func(uintptr, uintptr, uintptr, *gdk.Rectangle, *gdk.R | |||||
| 634 | 634 | ||||
| 635 | // Calls @callback for every `GtkCellRenderer` in @area with the | 635 | // Calls @callback for every `GtkCellRenderer` in @area with the | ||
| 636 | // allocated rectangle inside @cell_area. | 636 | // allocated rectangle inside @cell_area. | ||
| 637 | - | func (x *CellArea) ForeachAlloc(ContextVar *CellAreaContext, WidgetVar *Widget, CellAreaVar *gdk.Rectangle, BackgroundAreaVar *gdk.Rectangle, CallbackVar CellAllocCallback, CallbackDataVar uintptr) { | 637 | + | func (x *CellArea) ForeachAlloc(ContextVar *CellAreaContext, WidgetVar *Widget, CellAreaVar *gdk.Rectangle, BackgroundAreaVar *gdk.Rectangle, CallbackVar *CellAllocCallback, CallbackDataVar uintptr) { |
| 638 | 638 | ||||
| 639 | - | xCellAreaForeachAlloc(x.GoPointer(), ContextVar.GoPointer(), WidgetVar.GoPointer(), CellAreaVar, BackgroundAreaVar, purego.NewCallback(CallbackVar), CallbackDataVar) | 639 | + | xCellAreaForeachAlloc(x.GoPointer(), ContextVar.GoPointer(), WidgetVar.GoPointer(), CellAreaVar, BackgroundAreaVar, glib.NewCallback(CallbackVar), CallbackDataVar) |
| 640 | 640 | ||||
| 641 | } | 641 | } | ||
| 642 | 642 | ||||
| @@ -972,27 +972,43 @@ func (c *CellArea) SetGoPointer(ptr uintptr) { | |||||
| 972 | 972 | ||||
| 973 | // Indicates that editing has started on @renderer and that @editable | 973 | // Indicates that editing has started on @renderer and that @editable | ||
| 974 | // should be added to the owning cell-layouting widget at @cell_area. | 974 | // should be added to the owning cell-layouting widget at @cell_area. | ||
| 975 | - | func (x *CellArea) ConnectAddEditable(cb func(CellArea, uintptr, uintptr, uintptr, string)) uint32 { | 975 | + | func (x *CellArea) ConnectAddEditable(cb *func(CellArea, uintptr, uintptr, uintptr, string)) uint32 { |
| 976 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 977 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 978 | + | return gobject.SignalConnect(x.GoPointer(), "add-editable", cbRefPtr) | |||
| 979 | + | } | |||
| 980 | + | ||||
| 976 | fcb := func(clsPtr uintptr, RendererVarp uintptr, EditableVarp uintptr, CellAreaVarp uintptr, PathVarp string) { | 981 | fcb := func(clsPtr uintptr, RendererVarp uintptr, EditableVarp uintptr, CellAreaVarp uintptr, PathVarp string) { | ||
| 977 | fa := CellArea{} | 982 | fa := CellArea{} | ||
| 978 | fa.Ptr = clsPtr | 983 | fa.Ptr = clsPtr | ||
| 984 | + | cbFn := *cb | |||
| 979 | 985 | ||||
| 980 | - | cb(fa, RendererVarp, EditableVarp, CellAreaVarp, PathVarp) | 986 | + | cbFn(fa, RendererVarp, EditableVarp, CellAreaVarp, PathVarp) |
| 981 | 987 | ||||
| 982 | } | 988 | } | ||
| 983 | - | return gobject.SignalConnect(x.GoPointer(), "add-editable", purego.NewCallback(fcb)) | 989 | + | cbRefPtr := purego.NewCallback(fcb) |
| 990 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 991 | + | return gobject.SignalConnect(x.GoPointer(), "add-editable", cbRefPtr) | |||
| 984 | } | 992 | } | ||
| 985 | 993 | ||||
| 986 | // This signal is emitted whenever applying attributes to @area from @model | 994 | // This signal is emitted whenever applying attributes to @area from @model | ||
| 987 | - | func (x *CellArea) ConnectApplyAttributes(cb func(CellArea, uintptr, uintptr, bool, bool)) uint32 { | 995 | + | func (x *CellArea) ConnectApplyAttributes(cb *func(CellArea, uintptr, uintptr, bool, bool)) uint32 { |
| 996 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 997 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 998 | + | return gobject.SignalConnect(x.GoPointer(), "apply-attributes", cbRefPtr) | |||
| 999 | + | } | |||
| 1000 | + | ||||
| 988 | fcb := func(clsPtr uintptr, ModelVarp uintptr, IterVarp uintptr, IsExpanderVarp bool, IsExpandedVarp bool) { | 1001 | fcb := func(clsPtr uintptr, ModelVarp uintptr, IterVarp uintptr, IsExpanderVarp bool, IsExpandedVarp bool) { | ||
| 989 | fa := CellArea{} | 1002 | fa := CellArea{} | ||
| 990 | fa.Ptr = clsPtr | 1003 | fa.Ptr = clsPtr | ||
| 1004 | + | cbFn := *cb | |||
| 991 | 1005 | ||||
| 992 | - | cb(fa, ModelVarp, IterVarp, IsExpanderVarp, IsExpandedVarp) | 1006 | + | cbFn(fa, ModelVarp, IterVarp, IsExpanderVarp, IsExpandedVarp) |
| 993 | 1007 | ||||
| 994 | } | 1008 | } | ||
| 995 | - | return gobject.SignalConnect(x.GoPointer(), "apply-attributes", purego.NewCallback(fcb)) | 1009 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1010 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1011 | + | return gobject.SignalConnect(x.GoPointer(), "apply-attributes", cbRefPtr) | |||
| 996 | } | 1012 | } | ||
| 997 | 1013 | ||||
| 998 | // Indicates that focus changed on this @area. This signal | 1014 | // Indicates that focus changed on this @area. This signal | ||
| @@ -1003,28 +1019,44 @@ func (x *CellArea) ConnectApplyAttributes(cb func(CellArea, uintptr, uintptr, bo | |||||
| 1003 | // currently focused renderer did not change, this is | 1019 | // currently focused renderer did not change, this is | ||
| 1004 | // because focus may change to the same renderer in the | 1020 | // because focus may change to the same renderer in the | ||
| 1005 | // same cell area for a different row of data. | 1021 | // same cell area for a different row of data. | ||
| 1006 | - | func (x *CellArea) ConnectFocusChanged(cb func(CellArea, uintptr, string)) uint32 { | 1022 | + | func (x *CellArea) ConnectFocusChanged(cb *func(CellArea, uintptr, string)) uint32 { |
| 1023 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1024 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1025 | + | return gobject.SignalConnect(x.GoPointer(), "focus-changed", cbRefPtr) | |||
| 1026 | + | } | |||
| 1027 | + | ||||
| 1007 | fcb := func(clsPtr uintptr, RendererVarp uintptr, PathVarp string) { | 1028 | fcb := func(clsPtr uintptr, RendererVarp uintptr, PathVarp string) { | ||
| 1008 | fa := CellArea{} | 1029 | fa := CellArea{} | ||
| 1009 | fa.Ptr = clsPtr | 1030 | fa.Ptr = clsPtr | ||
| 1031 | + | cbFn := *cb | |||
| 1010 | 1032 | ||||
| 1011 | - | cb(fa, RendererVarp, PathVarp) | 1033 | + | cbFn(fa, RendererVarp, PathVarp) |
| 1012 | 1034 | ||||
| 1013 | } | 1035 | } | ||
| 1014 | - | return gobject.SignalConnect(x.GoPointer(), "focus-changed", purego.NewCallback(fcb)) | 1036 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1037 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1038 | + | return gobject.SignalConnect(x.GoPointer(), "focus-changed", cbRefPtr) | |||
| 1015 | } | 1039 | } | ||
| 1016 | 1040 | ||||
| 1017 | // Indicates that editing finished on @renderer and that @editable | 1041 | // Indicates that editing finished on @renderer and that @editable | ||
| 1018 | // should be removed from the owning cell-layouting widget. | 1042 | // should be removed from the owning cell-layouting widget. | ||
| 1019 | - | func (x *CellArea) ConnectRemoveEditable(cb func(CellArea, uintptr, uintptr)) uint32 { | 1043 | + | func (x *CellArea) ConnectRemoveEditable(cb *func(CellArea, uintptr, uintptr)) uint32 { |
| 1044 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1045 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1046 | + | return gobject.SignalConnect(x.GoPointer(), "remove-editable", cbRefPtr) | |||
| 1047 | + | } | |||
| 1048 | + | ||||
| 1020 | fcb := func(clsPtr uintptr, RendererVarp uintptr, EditableVarp uintptr) { | 1049 | fcb := func(clsPtr uintptr, RendererVarp uintptr, EditableVarp uintptr) { | ||
| 1021 | fa := CellArea{} | 1050 | fa := CellArea{} | ||
| 1022 | fa.Ptr = clsPtr | 1051 | fa.Ptr = clsPtr | ||
| 1052 | + | cbFn := *cb | |||
| 1023 | 1053 | ||||
| 1024 | - | cb(fa, RendererVarp, EditableVarp) | 1054 | + | cbFn(fa, RendererVarp, EditableVarp) |
| 1025 | 1055 | ||||
| 1026 | } | 1056 | } | ||
| 1027 | - | return gobject.SignalConnect(x.GoPointer(), "remove-editable", purego.NewCallback(fcb)) | 1057 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1058 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1059 | + | return gobject.SignalConnect(x.GoPointer(), "remove-editable", cbRefPtr) | |||
| 1028 | } | 1060 | } | ||
| 1029 | 1061 | ||||
| 1030 | // Gets the ID of the @buildable object. | 1062 | // Gets the ID of the @buildable object. | ||
| @@ -1143,9 +1175,9 @@ func (x *CellArea) SetAttributes(CellVar *CellRenderer, varArgs ...interface{}) | |||||
| 1143 | // cell renderer(s) as appropriate. | 1175 | // cell renderer(s) as appropriate. | ||
| 1144 | // | 1176 | // | ||
| 1145 | // @func may be %NULL to remove a previously set function. | 1177 | // @func may be %NULL to remove a previously set function. | ||
| 1146 | - | func (x *CellArea) SetCellDataFunc(CellVar *CellRenderer, FuncVar CellLayoutDataFunc, FuncDataVar uintptr, DestroyVar glib.DestroyNotify) { | 1178 | + | func (x *CellArea) SetCellDataFunc(CellVar *CellRenderer, FuncVar *CellLayoutDataFunc, FuncDataVar uintptr, DestroyVar *glib.DestroyNotify) { |
| 1147 | 1179 | ||||
| 1148 | - | XGtkCellLayoutSetCellDataFunc(x.GoPointer(), CellVar.GoPointer(), purego.NewCallback(FuncVar), FuncDataVar, purego.NewCallback(DestroyVar)) | 1180 | + | XGtkCellLayoutSetCellDataFunc(x.GoPointer(), CellVar.GoPointer(), glib.NewCallback(FuncVar), FuncDataVar, glib.NewCallback(DestroyVar)) |
| 1149 | 1181 | ||||
| 1150 | } | 1182 | } | ||
| 1151 | 1183 | ||||
M v4/gtk/gtkcellareabox.go +2 -2
| @@ -198,9 +198,9 @@ func (x *CellAreaBox) SetAttributes(CellVar *CellRenderer, varArgs ...interface{ | |||||
| 198 | // cell renderer(s) as appropriate. | 198 | // cell renderer(s) as appropriate. | ||
| 199 | // | 199 | // | ||
| 200 | // @func may be %NULL to remove a previously set function. | 200 | // @func may be %NULL to remove a previously set function. | ||
| 201 | - | func (x *CellAreaBox) SetCellDataFunc(CellVar *CellRenderer, FuncVar CellLayoutDataFunc, FuncDataVar uintptr, DestroyVar glib.DestroyNotify) { | 201 | + | func (x *CellAreaBox) SetCellDataFunc(CellVar *CellRenderer, FuncVar *CellLayoutDataFunc, FuncDataVar uintptr, DestroyVar *glib.DestroyNotify) { |
| 202 | 202 | ||||
| 203 | - | XGtkCellLayoutSetCellDataFunc(x.GoPointer(), CellVar.GoPointer(), purego.NewCallback(FuncVar), FuncDataVar, purego.NewCallback(DestroyVar)) | 203 | + | XGtkCellLayoutSetCellDataFunc(x.GoPointer(), CellVar.GoPointer(), glib.NewCallback(FuncVar), FuncDataVar, glib.NewCallback(DestroyVar)) |
| 204 | 204 | ||||
| 205 | } | 205 | } | ||
| 206 | 206 | ||||
M v4/gtk/gtkcelllayout.go +3 -3
| @@ -151,7 +151,7 @@ type CellLayout interface { | |||||
| 151 | PackStart(CellVar *CellRenderer, ExpandVar bool) | 151 | PackStart(CellVar *CellRenderer, ExpandVar bool) | ||
| 152 | Reorder(CellVar *CellRenderer, PositionVar int) | 152 | Reorder(CellVar *CellRenderer, PositionVar int) | ||
| 153 | SetAttributes(CellVar *CellRenderer, varArgs ...interface{}) | 153 | SetAttributes(CellVar *CellRenderer, varArgs ...interface{}) | ||
| 154 | - | SetCellDataFunc(CellVar *CellRenderer, FuncVar CellLayoutDataFunc, FuncDataVar uintptr, DestroyVar glib.DestroyNotify) | 154 | + | SetCellDataFunc(CellVar *CellRenderer, FuncVar *CellLayoutDataFunc, FuncDataVar uintptr, DestroyVar *glib.DestroyNotify) |
| 155 | } | 155 | } | ||
| 156 | type CellLayoutBase struct { | 156 | type CellLayoutBase struct { | ||
| 157 | Ptr uintptr | 157 | Ptr uintptr | ||
| @@ -271,9 +271,9 @@ func (x *CellLayoutBase) SetAttributes(CellVar *CellRenderer, varArgs ...interfa | |||||
| 271 | // cell renderer(s) as appropriate. | 271 | // cell renderer(s) as appropriate. | ||
| 272 | // | 272 | // | ||
| 273 | // @func may be %NULL to remove a previously set function. | 273 | // @func may be %NULL to remove a previously set function. | ||
| 274 | - | func (x *CellLayoutBase) SetCellDataFunc(CellVar *CellRenderer, FuncVar CellLayoutDataFunc, FuncDataVar uintptr, DestroyVar glib.DestroyNotify) { | 274 | + | func (x *CellLayoutBase) SetCellDataFunc(CellVar *CellRenderer, FuncVar *CellLayoutDataFunc, FuncDataVar uintptr, DestroyVar *glib.DestroyNotify) { |
| 275 | 275 | ||||
| 276 | - | XGtkCellLayoutSetCellDataFunc(x.GoPointer(), CellVar.GoPointer(), purego.NewCallback(FuncVar), FuncDataVar, purego.NewCallback(DestroyVar)) | 276 | + | XGtkCellLayoutSetCellDataFunc(x.GoPointer(), CellVar.GoPointer(), glib.NewCallback(FuncVar), FuncDataVar, glib.NewCallback(DestroyVar)) |
| 277 | 277 | ||||
| 278 | } | 278 | } | ||
| 279 | 279 | ||||
M v4/gtk/gtkcellrenderer.go +23 -6
| @@ -7,6 +7,7 @@ import ( | |||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | ||
| 10 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | 11 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 11 | ) | 12 | ) | ||
| 12 | 13 | ||||
| @@ -405,15 +406,23 @@ func (c *CellRenderer) SetGoPointer(ptr uintptr) { | |||||
| 405 | // editing when the user presses Escape. | 406 | // editing when the user presses Escape. | ||
| 406 | // | 407 | // | ||
| 407 | // See also: gtk_cell_renderer_stop_editing(). | 408 | // See also: gtk_cell_renderer_stop_editing(). | ||
| 408 | - | func (x *CellRenderer) ConnectEditingCanceled(cb func(CellRenderer)) uint32 { | 409 | + | func (x *CellRenderer) ConnectEditingCanceled(cb *func(CellRenderer)) uint32 { |
| 410 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 411 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 412 | + | return gobject.SignalConnect(x.GoPointer(), "editing-canceled", cbRefPtr) | |||
| 413 | + | } | |||
| 414 | + | ||||
| 409 | fcb := func(clsPtr uintptr) { | 415 | fcb := func(clsPtr uintptr) { | ||
| 410 | fa := CellRenderer{} | 416 | fa := CellRenderer{} | ||
| 411 | fa.Ptr = clsPtr | 417 | fa.Ptr = clsPtr | ||
| 418 | + | cbFn := *cb | |||
| 412 | 419 | ||||
| 413 | - | cb(fa) | 420 | + | cbFn(fa) |
| 414 | 421 | ||||
| 415 | } | 422 | } | ||
| 416 | - | return gobject.SignalConnect(x.GoPointer(), "editing-canceled", purego.NewCallback(fcb)) | 423 | + | cbRefPtr := purego.NewCallback(fcb) |
| 424 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 425 | + | return gobject.SignalConnect(x.GoPointer(), "editing-canceled", cbRefPtr) | |||
| 417 | } | 426 | } | ||
| 418 | 427 | ||||
| 419 | // This signal gets emitted when a cell starts to be edited. | 428 | // This signal gets emitted when a cell starts to be edited. | ||
| @@ -448,15 +457,23 @@ func (x *CellRenderer) ConnectEditingCanceled(cb func(CellRenderer)) uint32 { | |||||
| 448 | // } | 457 | // } | ||
| 449 | // | 458 | // | ||
| 450 | // ]| | 459 | // ]| | ||
| 451 | - | func (x *CellRenderer) ConnectEditingStarted(cb func(CellRenderer, uintptr, string)) uint32 { | 460 | + | func (x *CellRenderer) ConnectEditingStarted(cb *func(CellRenderer, uintptr, string)) uint32 { |
| 461 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 462 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 463 | + | return gobject.SignalConnect(x.GoPointer(), "editing-started", cbRefPtr) | |||
| 464 | + | } | |||
| 465 | + | ||||
| 452 | fcb := func(clsPtr uintptr, EditableVarp uintptr, PathVarp string) { | 466 | fcb := func(clsPtr uintptr, EditableVarp uintptr, PathVarp string) { | ||
| 453 | fa := CellRenderer{} | 467 | fa := CellRenderer{} | ||
| 454 | fa.Ptr = clsPtr | 468 | fa.Ptr = clsPtr | ||
| 469 | + | cbFn := *cb | |||
| 455 | 470 | ||||
| 456 | - | cb(fa, EditableVarp, PathVarp) | 471 | + | cbFn(fa, EditableVarp, PathVarp) |
| 457 | 472 | ||||
| 458 | } | 473 | } | ||
| 459 | - | return gobject.SignalConnect(x.GoPointer(), "editing-started", purego.NewCallback(fcb)) | 474 | + | cbRefPtr := purego.NewCallback(fcb) |
| 475 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 476 | + | return gobject.SignalConnect(x.GoPointer(), "editing-started", cbRefPtr) | |||
| 460 | } | 477 | } | ||
| 461 | 478 | ||||
| 462 | func init() { | 479 | func init() { | ||
M v4/gtk/gtkcellrendereraccel.go +25 -6
| @@ -2,9 +2,12 @@ | |||||
| 2 | package gtk | 2 | package gtk | ||
| 3 | 3 | ||||
| 4 | import ( | 4 | import ( | ||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 5 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 6 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 7 | "github.com/jwijenbergh/puregotk/v4/gdk" | 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | ||
| 10 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 8 | "github.com/jwijenbergh/puregotk/v4/gobject" | 11 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 9 | ) | 12 | ) | ||
| 10 | 13 | ||||
| @@ -60,27 +63,43 @@ func (c *CellRendererAccel) SetGoPointer(ptr uintptr) { | |||||
| 60 | } | 63 | } | ||
| 61 | 64 | ||||
| 62 | // Gets emitted when the user has removed the accelerator. | 65 | // Gets emitted when the user has removed the accelerator. | ||
| 63 | - | func (x *CellRendererAccel) ConnectAccelCleared(cb func(CellRendererAccel, string)) uint32 { | 66 | + | func (x *CellRendererAccel) ConnectAccelCleared(cb *func(CellRendererAccel, string)) uint32 { |
| 67 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 68 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 69 | + | return gobject.SignalConnect(x.GoPointer(), "accel-cleared", cbRefPtr) | |||
| 70 | + | } | |||
| 71 | + | ||||
| 64 | fcb := func(clsPtr uintptr, PathStringVarp string) { | 72 | fcb := func(clsPtr uintptr, PathStringVarp string) { | ||
| 65 | fa := CellRendererAccel{} | 73 | fa := CellRendererAccel{} | ||
| 66 | fa.Ptr = clsPtr | 74 | fa.Ptr = clsPtr | ||
| 75 | + | cbFn := *cb | |||
| 67 | 76 | ||||
| 68 | - | cb(fa, PathStringVarp) | 77 | + | cbFn(fa, PathStringVarp) |
| 69 | 78 | ||||
| 70 | } | 79 | } | ||
| 71 | - | return gobject.SignalConnect(x.GoPointer(), "accel-cleared", purego.NewCallback(fcb)) | 80 | + | cbRefPtr := purego.NewCallback(fcb) |
| 81 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 82 | + | return gobject.SignalConnect(x.GoPointer(), "accel-cleared", cbRefPtr) | |||
| 72 | } | 83 | } | ||
| 73 | 84 | ||||
| 74 | // Gets emitted when the user has selected a new accelerator. | 85 | // Gets emitted when the user has selected a new accelerator. | ||
| 75 | - | func (x *CellRendererAccel) ConnectAccelEdited(cb func(CellRendererAccel, string, uint, gdk.ModifierType, uint)) uint32 { | 86 | + | func (x *CellRendererAccel) ConnectAccelEdited(cb *func(CellRendererAccel, string, uint, gdk.ModifierType, uint)) uint32 { |
| 87 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 88 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 89 | + | return gobject.SignalConnect(x.GoPointer(), "accel-edited", cbRefPtr) | |||
| 90 | + | } | |||
| 91 | + | ||||
| 76 | fcb := func(clsPtr uintptr, PathStringVarp string, AccelKeyVarp uint, AccelModsVarp gdk.ModifierType, HardwareKeycodeVarp uint) { | 92 | fcb := func(clsPtr uintptr, PathStringVarp string, AccelKeyVarp uint, AccelModsVarp gdk.ModifierType, HardwareKeycodeVarp uint) { | ||
| 77 | fa := CellRendererAccel{} | 93 | fa := CellRendererAccel{} | ||
| 78 | fa.Ptr = clsPtr | 94 | fa.Ptr = clsPtr | ||
| 95 | + | cbFn := *cb | |||
| 79 | 96 | ||||
| 80 | - | cb(fa, PathStringVarp, AccelKeyVarp, AccelModsVarp, HardwareKeycodeVarp) | 97 | + | cbFn(fa, PathStringVarp, AccelKeyVarp, AccelModsVarp, HardwareKeycodeVarp) |
| 81 | 98 | ||||
| 82 | } | 99 | } | ||
| 83 | - | return gobject.SignalConnect(x.GoPointer(), "accel-edited", purego.NewCallback(fcb)) | 100 | + | cbRefPtr := purego.NewCallback(fcb) |
| 101 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 102 | + | return gobject.SignalConnect(x.GoPointer(), "accel-edited", cbRefPtr) | |||
| 84 | } | 103 | } | ||
| 85 | 104 | ||||
| 86 | func init() { | 105 | func init() { | ||
M v4/gtk/gtkcellrenderercombo.go +14 -3
| @@ -2,8 +2,11 @@ | |||||
| 2 | package gtk | 2 | package gtk | ||
| 3 | 3 | ||||
| 4 | import ( | 4 | import ( | ||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 5 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 6 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 7 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 8 | ) | 11 | ) | ||
| 9 | 12 | ||||
| @@ -71,15 +74,23 @@ func (c *CellRendererCombo) SetGoPointer(ptr uintptr) { | |||||
| 71 | // the tree view will immediately cease the editing operating. This | 74 | // the tree view will immediately cease the editing operating. This | ||
| 72 | // means that you most probably want to refrain from changing the model | 75 | // means that you most probably want to refrain from changing the model | ||
| 73 | // until the combo cell renderer emits the edited or editing_canceled signal. | 76 | // until the combo cell renderer emits the edited or editing_canceled signal. | ||
| 74 | - | func (x *CellRendererCombo) ConnectChanged(cb func(CellRendererCombo, string, uintptr)) uint32 { | 77 | + | func (x *CellRendererCombo) ConnectChanged(cb *func(CellRendererCombo, string, uintptr)) uint32 { |
| 78 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 79 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 80 | + | return gobject.SignalConnect(x.GoPointer(), "changed", cbRefPtr) | |||
| 81 | + | } | |||
| 82 | + | ||||
| 75 | fcb := func(clsPtr uintptr, PathStringVarp string, NewIterVarp uintptr) { | 83 | fcb := func(clsPtr uintptr, PathStringVarp string, NewIterVarp uintptr) { | ||
| 76 | fa := CellRendererCombo{} | 84 | fa := CellRendererCombo{} | ||
| 77 | fa.Ptr = clsPtr | 85 | fa.Ptr = clsPtr | ||
| 86 | + | cbFn := *cb | |||
| 78 | 87 | ||||
| 79 | - | cb(fa, PathStringVarp, NewIterVarp) | 88 | + | cbFn(fa, PathStringVarp, NewIterVarp) |
| 80 | 89 | ||||
| 81 | } | 90 | } | ||
| 82 | - | return gobject.SignalConnect(x.GoPointer(), "changed", purego.NewCallback(fcb)) | 91 | + | cbRefPtr := purego.NewCallback(fcb) |
| 92 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 93 | + | return gobject.SignalConnect(x.GoPointer(), "changed", cbRefPtr) | |||
| 83 | } | 94 | } | ||
| 84 | 95 | ||||
| 85 | func init() { | 96 | func init() { | ||
M v4/gtk/gtkcellrenderertext.go +12 -3
| @@ -6,6 +6,7 @@ import ( | |||||
| 6 | 6 | ||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 9 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 10 | ) | 11 | ) | ||
| 11 | 12 | ||||
| @@ -87,15 +88,23 @@ func (c *CellRendererText) SetGoPointer(ptr uintptr) { | |||||
| 87 | // | 88 | // | ||
| 88 | // It is the responsibility of the application to update the model | 89 | // It is the responsibility of the application to update the model | ||
| 89 | // and store @new_text at the position indicated by @path. | 90 | // and store @new_text at the position indicated by @path. | ||
| 90 | - | func (x *CellRendererText) ConnectEdited(cb func(CellRendererText, string, string)) uint32 { | 91 | + | func (x *CellRendererText) ConnectEdited(cb *func(CellRendererText, string, string)) uint32 { |
| 92 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 93 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 94 | + | return gobject.SignalConnect(x.GoPointer(), "edited", cbRefPtr) | |||
| 95 | + | } | |||
| 96 | + | ||||
| 91 | fcb := func(clsPtr uintptr, PathVarp string, NewTextVarp string) { | 97 | fcb := func(clsPtr uintptr, PathVarp string, NewTextVarp string) { | ||
| 92 | fa := CellRendererText{} | 98 | fa := CellRendererText{} | ||
| 93 | fa.Ptr = clsPtr | 99 | fa.Ptr = clsPtr | ||
| 100 | + | cbFn := *cb | |||
| 94 | 101 | ||||
| 95 | - | cb(fa, PathVarp, NewTextVarp) | 102 | + | cbFn(fa, PathVarp, NewTextVarp) |
| 96 | 103 | ||||
| 97 | } | 104 | } | ||
| 98 | - | return gobject.SignalConnect(x.GoPointer(), "edited", purego.NewCallback(fcb)) | 105 | + | cbRefPtr := purego.NewCallback(fcb) |
| 106 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 107 | + | return gobject.SignalConnect(x.GoPointer(), "edited", cbRefPtr) | |||
| 99 | } | 108 | } | ||
| 100 | 109 | ||||
| 101 | func init() { | 110 | func init() { | ||
M v4/gtk/gtkcellrenderertoggle.go +14 -3
| @@ -2,8 +2,11 @@ | |||||
| 2 | package gtk | 2 | package gtk | ||
| 3 | 3 | ||||
| 4 | import ( | 4 | import ( | ||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 5 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 6 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 7 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 8 | ) | 11 | ) | ||
| 9 | 12 | ||||
| @@ -121,15 +124,23 @@ func (c *CellRendererToggle) SetGoPointer(ptr uintptr) { | |||||
| 121 | // It is the responsibility of the application to update the model | 124 | // It is the responsibility of the application to update the model | ||
| 122 | // with the correct value to store at @path. Often this is simply the | 125 | // with the correct value to store at @path. Often this is simply the | ||
| 123 | // opposite of the value currently stored at @path. | 126 | // opposite of the value currently stored at @path. | ||
| 124 | - | func (x *CellRendererToggle) ConnectToggled(cb func(CellRendererToggle, string)) uint32 { | 127 | + | func (x *CellRendererToggle) ConnectToggled(cb *func(CellRendererToggle, string)) uint32 { |
| 128 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 129 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 130 | + | return gobject.SignalConnect(x.GoPointer(), "toggled", cbRefPtr) | |||
| 131 | + | } | |||
| 132 | + | ||||
| 125 | fcb := func(clsPtr uintptr, PathVarp string) { | 133 | fcb := func(clsPtr uintptr, PathVarp string) { | ||
| 126 | fa := CellRendererToggle{} | 134 | fa := CellRendererToggle{} | ||
| 127 | fa.Ptr = clsPtr | 135 | fa.Ptr = clsPtr | ||
| 136 | + | cbFn := *cb | |||
| 128 | 137 | ||||
| 129 | - | cb(fa, PathVarp) | 138 | + | cbFn(fa, PathVarp) |
| 130 | 139 | ||||
| 131 | } | 140 | } | ||
| 132 | - | return gobject.SignalConnect(x.GoPointer(), "toggled", purego.NewCallback(fcb)) | 141 | + | cbRefPtr := purego.NewCallback(fcb) |
| 142 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 143 | + | return gobject.SignalConnect(x.GoPointer(), "toggled", cbRefPtr) | |||
| 133 | } | 144 | } | ||
| 134 | 145 | ||||
| 135 | func init() { | 146 | func init() { | ||
M v4/gtk/gtkcellview.go +2 -2
| @@ -489,9 +489,9 @@ func (x *CellView) SetAttributes(CellVar *CellRenderer, varArgs ...interface{}) | |||||
| 489 | // cell renderer(s) as appropriate. | 489 | // cell renderer(s) as appropriate. | ||
| 490 | // | 490 | // | ||
| 491 | // @func may be %NULL to remove a previously set function. | 491 | // @func may be %NULL to remove a previously set function. | ||
| 492 | - | func (x *CellView) SetCellDataFunc(CellVar *CellRenderer, FuncVar CellLayoutDataFunc, FuncDataVar uintptr, DestroyVar glib.DestroyNotify) { | 492 | + | func (x *CellView) SetCellDataFunc(CellVar *CellRenderer, FuncVar *CellLayoutDataFunc, FuncDataVar uintptr, DestroyVar *glib.DestroyNotify) { |
| 493 | 493 | ||||
| 494 | - | XGtkCellLayoutSetCellDataFunc(x.GoPointer(), CellVar.GoPointer(), purego.NewCallback(FuncVar), FuncDataVar, purego.NewCallback(DestroyVar)) | 494 | + | XGtkCellLayoutSetCellDataFunc(x.GoPointer(), CellVar.GoPointer(), glib.NewCallback(FuncVar), FuncDataVar, glib.NewCallback(DestroyVar)) |
| 495 | 495 | ||||
| 496 | } | 496 | } | ||
| 497 | 497 | ||||
M v4/gtk/gtkcheckbutton.go +22 -6
| @@ -286,28 +286,44 @@ func (c *CheckButton) SetGoPointer(ptr uintptr) { | |||||
| 286 | // | 286 | // | ||
| 287 | // Applications should never connect to this signal, but use the | 287 | // Applications should never connect to this signal, but use the | ||
| 288 | // [signal@Gtk.CheckButton::toggled] signal. | 288 | // [signal@Gtk.CheckButton::toggled] signal. | ||
| 289 | - | func (x *CheckButton) ConnectActivate(cb func(CheckButton)) uint32 { | 289 | + | func (x *CheckButton) ConnectActivate(cb *func(CheckButton)) uint32 { |
| 290 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 291 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 292 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 293 | + | } | |||
| 294 | + | ||||
| 290 | fcb := func(clsPtr uintptr) { | 295 | fcb := func(clsPtr uintptr) { | ||
| 291 | fa := CheckButton{} | 296 | fa := CheckButton{} | ||
| 292 | fa.Ptr = clsPtr | 297 | fa.Ptr = clsPtr | ||
| 298 | + | cbFn := *cb | |||
| 293 | 299 | ||||
| 294 | - | cb(fa) | 300 | + | cbFn(fa) |
| 295 | 301 | ||||
| 296 | } | 302 | } | ||
| 297 | - | return gobject.SignalConnect(x.GoPointer(), "activate", purego.NewCallback(fcb)) | 303 | + | cbRefPtr := purego.NewCallback(fcb) |
| 304 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 305 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 298 | } | 306 | } | ||
| 299 | 307 | ||||
| 300 | // Emitted when the buttons's [property@Gtk.CheckButton:active] | 308 | // Emitted when the buttons's [property@Gtk.CheckButton:active] | ||
| 301 | // property changes. | 309 | // property changes. | ||
| 302 | - | func (x *CheckButton) ConnectToggled(cb func(CheckButton)) uint32 { | 310 | + | func (x *CheckButton) ConnectToggled(cb *func(CheckButton)) uint32 { |
| 311 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 312 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 313 | + | return gobject.SignalConnect(x.GoPointer(), "toggled", cbRefPtr) | |||
| 314 | + | } | |||
| 315 | + | ||||
| 303 | fcb := func(clsPtr uintptr) { | 316 | fcb := func(clsPtr uintptr) { | ||
| 304 | fa := CheckButton{} | 317 | fa := CheckButton{} | ||
| 305 | fa.Ptr = clsPtr | 318 | fa.Ptr = clsPtr | ||
| 319 | + | cbFn := *cb | |||
| 306 | 320 | ||||
| 307 | - | cb(fa) | 321 | + | cbFn(fa) |
| 308 | 322 | ||||
| 309 | } | 323 | } | ||
| 310 | - | return gobject.SignalConnect(x.GoPointer(), "toggled", purego.NewCallback(fcb)) | 324 | + | cbRefPtr := purego.NewCallback(fcb) |
| 325 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 326 | + | return gobject.SignalConnect(x.GoPointer(), "toggled", cbRefPtr) | |||
| 311 | } | 327 | } | ||
| 312 | 328 | ||||
| 313 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 329 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/gtk/gtkcolorbutton.go +25 -6
| @@ -2,9 +2,12 @@ | |||||
| 2 | package gtk | 2 | package gtk | ||
| 3 | 3 | ||||
| 4 | import ( | 4 | import ( | ||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 5 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 6 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 7 | "github.com/jwijenbergh/puregotk/v4/gdk" | 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | ||
| 10 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 8 | "github.com/jwijenbergh/puregotk/v4/gobject" | 11 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 9 | ) | 12 | ) | ||
| 10 | 13 | ||||
| @@ -126,15 +129,23 @@ func (c *ColorButton) SetGoPointer(ptr uintptr) { | |||||
| 126 | // | 129 | // | ||
| 127 | // The `::activate` signal on `GtkMenuButton` is an action signal and | 130 | // The `::activate` signal on `GtkMenuButton` is an action signal and | ||
| 128 | // emitting it causes the button to pop up its dialog. | 131 | // emitting it causes the button to pop up its dialog. | ||
| 129 | - | func (x *ColorButton) ConnectActivate(cb func(ColorButton)) uint32 { | 132 | + | func (x *ColorButton) ConnectActivate(cb *func(ColorButton)) uint32 { |
| 133 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 134 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 135 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 136 | + | } | |||
| 137 | + | ||||
| 130 | fcb := func(clsPtr uintptr) { | 138 | fcb := func(clsPtr uintptr) { | ||
| 131 | fa := ColorButton{} | 139 | fa := ColorButton{} | ||
| 132 | fa.Ptr = clsPtr | 140 | fa.Ptr = clsPtr | ||
| 141 | + | cbFn := *cb | |||
| 133 | 142 | ||||
| 134 | - | cb(fa) | 143 | + | cbFn(fa) |
| 135 | 144 | ||||
| 136 | } | 145 | } | ||
| 137 | - | return gobject.SignalConnect(x.GoPointer(), "activate", purego.NewCallback(fcb)) | 146 | + | cbRefPtr := purego.NewCallback(fcb) |
| 147 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 148 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 138 | } | 149 | } | ||
| 139 | 150 | ||||
| 140 | // Emitted when the user selects a color. | 151 | // Emitted when the user selects a color. | ||
| @@ -145,15 +156,23 @@ func (x *ColorButton) ConnectActivate(cb func(ColorButton)) uint32 { | |||||
| 145 | // Note that this signal is only emitted when the user changes the color. | 156 | // Note that this signal is only emitted when the user changes the color. | ||
| 146 | // If you need to react to programmatic color changes as well, use | 157 | // If you need to react to programmatic color changes as well, use | ||
| 147 | // the notify::rgba signal. | 158 | // the notify::rgba signal. | ||
| 148 | - | func (x *ColorButton) ConnectColorSet(cb func(ColorButton)) uint32 { | 159 | + | func (x *ColorButton) ConnectColorSet(cb *func(ColorButton)) uint32 { |
| 160 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 161 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 162 | + | return gobject.SignalConnect(x.GoPointer(), "color-set", cbRefPtr) | |||
| 163 | + | } | |||
| 164 | + | ||||
| 149 | fcb := func(clsPtr uintptr) { | 165 | fcb := func(clsPtr uintptr) { | ||
| 150 | fa := ColorButton{} | 166 | fa := ColorButton{} | ||
| 151 | fa.Ptr = clsPtr | 167 | fa.Ptr = clsPtr | ||
| 168 | + | cbFn := *cb | |||
| 152 | 169 | ||||
| 153 | - | cb(fa) | 170 | + | cbFn(fa) |
| 154 | 171 | ||||
| 155 | } | 172 | } | ||
| 156 | - | return gobject.SignalConnect(x.GoPointer(), "color-set", purego.NewCallback(fcb)) | 173 | + | cbRefPtr := purego.NewCallback(fcb) |
| 174 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 175 | + | return gobject.SignalConnect(x.GoPointer(), "color-set", cbRefPtr) | |||
| 157 | } | 176 | } | ||
| 158 | 177 | ||||
| 159 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 178 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/gtk/gtkcolumnview.go +12 -3
| @@ -7,6 +7,7 @@ import ( | |||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | "github.com/jwijenbergh/puregotk/v4/gio" | 9 | "github.com/jwijenbergh/puregotk/v4/gio" | ||
| 10 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | 11 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 11 | ) | 12 | ) | ||
| 12 | 13 | ||||
| @@ -355,15 +356,23 @@ func (c *ColumnView) SetGoPointer(ptr uintptr) { | |||||
| 355 | // This allows for a convenient way to handle activation in a columnview. | 356 | // This allows for a convenient way to handle activation in a columnview. | ||
| 356 | // See [method@Gtk.ListItem.set_activatable] for details on how to use this | 357 | // See [method@Gtk.ListItem.set_activatable] for details on how to use this | ||
| 357 | // signal. | 358 | // signal. | ||
| 358 | - | func (x *ColumnView) ConnectActivate(cb func(ColumnView, uint)) uint32 { | 359 | + | func (x *ColumnView) ConnectActivate(cb *func(ColumnView, uint)) uint32 { |
| 360 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 361 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 362 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 363 | + | } | |||
| 364 | + | ||||
| 359 | fcb := func(clsPtr uintptr, PositionVarp uint) { | 365 | fcb := func(clsPtr uintptr, PositionVarp uint) { | ||
| 360 | fa := ColumnView{} | 366 | fa := ColumnView{} | ||
| 361 | fa.Ptr = clsPtr | 367 | fa.Ptr = clsPtr | ||
| 368 | + | cbFn := *cb | |||
| 362 | 369 | ||||
| 363 | - | cb(fa, PositionVarp) | 370 | + | cbFn(fa, PositionVarp) |
| 364 | 371 | ||||
| 365 | } | 372 | } | ||
| 366 | - | return gobject.SignalConnect(x.GoPointer(), "activate", purego.NewCallback(fcb)) | 373 | + | cbRefPtr := purego.NewCallback(fcb) |
| 374 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 375 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 367 | } | 376 | } | ||
| 368 | 377 | ||||
| 369 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 378 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/gtk/gtkcombobox.go +70 -22
| @@ -465,9 +465,9 @@ var xComboBoxSetRowSeparatorFunc func(uintptr, uintptr, uintptr, uintptr) | |||||
| 465 | // | 465 | // | ||
| 466 | // If the row separator function is %NULL, no separators are drawn. | 466 | // If the row separator function is %NULL, no separators are drawn. | ||
| 467 | // This is the default value. | 467 | // This is the default value. | ||
| 468 | - | func (x *ComboBox) SetRowSeparatorFunc(FuncVar TreeViewRowSeparatorFunc, DataVar uintptr, DestroyVar glib.DestroyNotify) { | 468 | + | func (x *ComboBox) SetRowSeparatorFunc(FuncVar *TreeViewRowSeparatorFunc, DataVar uintptr, DestroyVar *glib.DestroyNotify) { |
| 469 | 469 | ||||
| 470 | - | xComboBoxSetRowSeparatorFunc(x.GoPointer(), purego.NewCallback(FuncVar), DataVar, purego.NewCallback(DestroyVar)) | 470 | + | xComboBoxSetRowSeparatorFunc(x.GoPointer(), glib.NewCallback(FuncVar), DataVar, glib.NewCallback(DestroyVar)) |
| 471 | 471 | ||||
| 472 | } | 472 | } | ||
| 473 | 473 | ||||
| @@ -483,15 +483,23 @@ func (c *ComboBox) SetGoPointer(ptr uintptr) { | |||||
| 483 | // | 483 | // | ||
| 484 | // The `::activate` signal on `GtkComboBox` is an action signal and | 484 | // The `::activate` signal on `GtkComboBox` is an action signal and | ||
| 485 | // emitting it causes the combo box to pop up its dropdown. | 485 | // emitting it causes the combo box to pop up its dropdown. | ||
| 486 | - | func (x *ComboBox) ConnectActivate(cb func(ComboBox)) uint32 { | 486 | + | func (x *ComboBox) ConnectActivate(cb *func(ComboBox)) uint32 { |
| 487 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 488 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 489 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 490 | + | } | |||
| 491 | + | ||||
| 487 | fcb := func(clsPtr uintptr) { | 492 | fcb := func(clsPtr uintptr) { | ||
| 488 | fa := ComboBox{} | 493 | fa := ComboBox{} | ||
| 489 | fa.Ptr = clsPtr | 494 | fa.Ptr = clsPtr | ||
| 495 | + | cbFn := *cb | |||
| 490 | 496 | ||||
| 491 | - | cb(fa) | 497 | + | cbFn(fa) |
| 492 | 498 | ||||
| 493 | } | 499 | } | ||
| 494 | - | return gobject.SignalConnect(x.GoPointer(), "activate", purego.NewCallback(fcb)) | 500 | + | cbRefPtr := purego.NewCallback(fcb) |
| 501 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 502 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 495 | } | 503 | } | ||
| 496 | 504 | ||||
| 497 | // Emitted when the active item is changed. | 505 | // Emitted when the active item is changed. | ||
| @@ -499,15 +507,23 @@ func (x *ComboBox) ConnectActivate(cb func(ComboBox)) uint32 { | |||||
| 499 | // The can be due to the user selecting a different item from the list, | 507 | // The can be due to the user selecting a different item from the list, | ||
| 500 | // or due to a call to [method@Gtk.ComboBox.set_active_iter]. It will | 508 | // or due to a call to [method@Gtk.ComboBox.set_active_iter]. It will | ||
| 501 | // also be emitted while typing into the entry of a combo box with an entry. | 509 | // also be emitted while typing into the entry of a combo box with an entry. | ||
| 502 | - | func (x *ComboBox) ConnectChanged(cb func(ComboBox)) uint32 { | 510 | + | func (x *ComboBox) ConnectChanged(cb *func(ComboBox)) uint32 { |
| 511 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 512 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 513 | + | return gobject.SignalConnect(x.GoPointer(), "changed", cbRefPtr) | |||
| 514 | + | } | |||
| 515 | + | ||||
| 503 | fcb := func(clsPtr uintptr) { | 516 | fcb := func(clsPtr uintptr) { | ||
| 504 | fa := ComboBox{} | 517 | fa := ComboBox{} | ||
| 505 | fa.Ptr = clsPtr | 518 | fa.Ptr = clsPtr | ||
| 519 | + | cbFn := *cb | |||
| 506 | 520 | ||||
| 507 | - | cb(fa) | 521 | + | cbFn(fa) |
| 508 | 522 | ||||
| 509 | } | 523 | } | ||
| 510 | - | return gobject.SignalConnect(x.GoPointer(), "changed", purego.NewCallback(fcb)) | 524 | + | cbRefPtr := purego.NewCallback(fcb) |
| 525 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 526 | + | return gobject.SignalConnect(x.GoPointer(), "changed", cbRefPtr) | |||
| 511 | } | 527 | } | ||
| 512 | 528 | ||||
| 513 | // Emitted to allow changing how the text in a combo box's entry is displayed. | 529 | // Emitted to allow changing how the text in a combo box's entry is displayed. | ||
| @@ -544,29 +560,45 @@ func (x *ComboBox) ConnectChanged(cb func(ComboBox)) uint32 { | |||||
| 544 | // } | 560 | // } | ||
| 545 | // | 561 | // | ||
| 546 | // ``` | 562 | // ``` | ||
| 547 | - | func (x *ComboBox) ConnectFormatEntryText(cb func(ComboBox, string) string) uint32 { | 563 | + | func (x *ComboBox) ConnectFormatEntryText(cb *func(ComboBox, string) string) uint32 { |
| 564 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 565 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 566 | + | return gobject.SignalConnect(x.GoPointer(), "format-entry-text", cbRefPtr) | |||
| 567 | + | } | |||
| 568 | + | ||||
| 548 | fcb := func(clsPtr uintptr, PathVarp string) string { | 569 | fcb := func(clsPtr uintptr, PathVarp string) string { | ||
| 549 | fa := ComboBox{} | 570 | fa := ComboBox{} | ||
| 550 | fa.Ptr = clsPtr | 571 | fa.Ptr = clsPtr | ||
| 572 | + | cbFn := *cb | |||
| 551 | 573 | ||||
| 552 | - | return cb(fa, PathVarp) | 574 | + | return cbFn(fa, PathVarp) |
| 553 | 575 | ||||
| 554 | } | 576 | } | ||
| 555 | - | return gobject.SignalConnect(x.GoPointer(), "format-entry-text", purego.NewCallback(fcb)) | 577 | + | cbRefPtr := purego.NewCallback(fcb) |
| 578 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 579 | + | return gobject.SignalConnect(x.GoPointer(), "format-entry-text", cbRefPtr) | |||
| 556 | } | 580 | } | ||
| 557 | 581 | ||||
| 558 | // Emitted to move the active selection. | 582 | // Emitted to move the active selection. | ||
| 559 | // | 583 | // | ||
| 560 | // This is an [keybinding signal](class.SignalAction.html). | 584 | // This is an [keybinding signal](class.SignalAction.html). | ||
| 561 | - | func (x *ComboBox) ConnectMoveActive(cb func(ComboBox, ScrollType)) uint32 { | 585 | + | func (x *ComboBox) ConnectMoveActive(cb *func(ComboBox, ScrollType)) uint32 { |
| 586 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 587 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 588 | + | return gobject.SignalConnect(x.GoPointer(), "move-active", cbRefPtr) | |||
| 589 | + | } | |||
| 590 | + | ||||
| 562 | fcb := func(clsPtr uintptr, ScrollTypeVarp ScrollType) { | 591 | fcb := func(clsPtr uintptr, ScrollTypeVarp ScrollType) { | ||
| 563 | fa := ComboBox{} | 592 | fa := ComboBox{} | ||
| 564 | fa.Ptr = clsPtr | 593 | fa.Ptr = clsPtr | ||
| 594 | + | cbFn := *cb | |||
| 565 | 595 | ||||
| 566 | - | cb(fa, ScrollTypeVarp) | 596 | + | cbFn(fa, ScrollTypeVarp) |
| 567 | 597 | ||||
| 568 | } | 598 | } | ||
| 569 | - | return gobject.SignalConnect(x.GoPointer(), "move-active", purego.NewCallback(fcb)) | 599 | + | cbRefPtr := purego.NewCallback(fcb) |
| 600 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 601 | + | return gobject.SignalConnect(x.GoPointer(), "move-active", cbRefPtr) | |||
| 570 | } | 602 | } | ||
| 571 | 603 | ||||
| 572 | // Emitted to popdown the combo box list. | 604 | // Emitted to popdown the combo box list. | ||
| @@ -574,15 +606,23 @@ func (x *ComboBox) ConnectMoveActive(cb func(ComboBox, ScrollType)) uint32 { | |||||
| 574 | // This is an [keybinding signal](class.SignalAction.html). | 606 | // This is an [keybinding signal](class.SignalAction.html). | ||
| 575 | // | 607 | // | ||
| 576 | // The default bindings for this signal are Alt+Up and Escape. | 608 | // The default bindings for this signal are Alt+Up and Escape. | ||
| 577 | - | func (x *ComboBox) ConnectPopdown(cb func(ComboBox) bool) uint32 { | 609 | + | func (x *ComboBox) ConnectPopdown(cb *func(ComboBox) bool) uint32 { |
| 610 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 611 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 612 | + | return gobject.SignalConnect(x.GoPointer(), "popdown", cbRefPtr) | |||
| 613 | + | } | |||
| 614 | + | ||||
| 578 | fcb := func(clsPtr uintptr) bool { | 615 | fcb := func(clsPtr uintptr) bool { | ||
| 579 | fa := ComboBox{} | 616 | fa := ComboBox{} | ||
| 580 | fa.Ptr = clsPtr | 617 | fa.Ptr = clsPtr | ||
| 618 | + | cbFn := *cb | |||
| 581 | 619 | ||||
| 582 | - | return cb(fa) | 620 | + | return cbFn(fa) |
| 583 | 621 | ||||
| 584 | } | 622 | } | ||
| 585 | - | return gobject.SignalConnect(x.GoPointer(), "popdown", purego.NewCallback(fcb)) | 623 | + | cbRefPtr := purego.NewCallback(fcb) |
| 624 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 625 | + | return gobject.SignalConnect(x.GoPointer(), "popdown", cbRefPtr) | |||
| 586 | } | 626 | } | ||
| 587 | 627 | ||||
| 588 | // Emitted to popup the combo box list. | 628 | // Emitted to popup the combo box list. | ||
| @@ -590,15 +630,23 @@ func (x *ComboBox) ConnectPopdown(cb func(ComboBox) bool) uint32 { | |||||
| 590 | // This is an [keybinding signal](class.SignalAction.html). | 630 | // This is an [keybinding signal](class.SignalAction.html). | ||
| 591 | // | 631 | // | ||
| 592 | // The default binding for this signal is Alt+Down. | 632 | // The default binding for this signal is Alt+Down. | ||
| 593 | - | func (x *ComboBox) ConnectPopup(cb func(ComboBox)) uint32 { | 633 | + | func (x *ComboBox) ConnectPopup(cb *func(ComboBox)) uint32 { |
| 634 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 635 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 636 | + | return gobject.SignalConnect(x.GoPointer(), "popup", cbRefPtr) | |||
| 637 | + | } | |||
| 638 | + | ||||
| 594 | fcb := func(clsPtr uintptr) { | 639 | fcb := func(clsPtr uintptr) { | ||
| 595 | fa := ComboBox{} | 640 | fa := ComboBox{} | ||
| 596 | fa.Ptr = clsPtr | 641 | fa.Ptr = clsPtr | ||
| 642 | + | cbFn := *cb | |||
| 597 | 643 | ||||
| 598 | - | cb(fa) | 644 | + | cbFn(fa) |
| 599 | 645 | ||||
| 600 | } | 646 | } | ||
| 601 | - | return gobject.SignalConnect(x.GoPointer(), "popup", purego.NewCallback(fcb)) | 647 | + | cbRefPtr := purego.NewCallback(fcb) |
| 648 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 649 | + | return gobject.SignalConnect(x.GoPointer(), "popup", cbRefPtr) | |||
| 602 | } | 650 | } | ||
| 603 | 651 | ||||
| 604 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 652 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
| @@ -880,9 +928,9 @@ func (x *ComboBox) SetAttributes(CellVar *CellRenderer, varArgs ...interface{}) | |||||
| 880 | // cell renderer(s) as appropriate. | 928 | // cell renderer(s) as appropriate. | ||
| 881 | // | 929 | // | ||
| 882 | // @func may be %NULL to remove a previously set function. | 930 | // @func may be %NULL to remove a previously set function. | ||
| 883 | - | func (x *ComboBox) SetCellDataFunc(CellVar *CellRenderer, FuncVar CellLayoutDataFunc, FuncDataVar uintptr, DestroyVar glib.DestroyNotify) { | 931 | + | func (x *ComboBox) SetCellDataFunc(CellVar *CellRenderer, FuncVar *CellLayoutDataFunc, FuncDataVar uintptr, DestroyVar *glib.DestroyNotify) { |
| 884 | 932 | ||||
| 885 | - | XGtkCellLayoutSetCellDataFunc(x.GoPointer(), CellVar.GoPointer(), purego.NewCallback(FuncVar), FuncDataVar, purego.NewCallback(DestroyVar)) | 933 | + | XGtkCellLayoutSetCellDataFunc(x.GoPointer(), CellVar.GoPointer(), glib.NewCallback(FuncVar), FuncDataVar, glib.NewCallback(DestroyVar)) |
| 886 | 934 | ||||
| 887 | } | 935 | } | ||
| 888 | 936 | ||||
M v4/gtk/gtkcomboboxtext.go +2 -2
| @@ -511,9 +511,9 @@ func (x *ComboBoxText) SetAttributes(CellVar *CellRenderer, varArgs ...interface | |||||
| 511 | // cell renderer(s) as appropriate. | 511 | // cell renderer(s) as appropriate. | ||
| 512 | // | 512 | // | ||
| 513 | // @func may be %NULL to remove a previously set function. | 513 | // @func may be %NULL to remove a previously set function. | ||
| 514 | - | func (x *ComboBoxText) SetCellDataFunc(CellVar *CellRenderer, FuncVar CellLayoutDataFunc, FuncDataVar uintptr, DestroyVar glib.DestroyNotify) { | 514 | + | func (x *ComboBoxText) SetCellDataFunc(CellVar *CellRenderer, FuncVar *CellLayoutDataFunc, FuncDataVar uintptr, DestroyVar *glib.DestroyNotify) { |
| 515 | 515 | ||||
| 516 | - | XGtkCellLayoutSetCellDataFunc(x.GoPointer(), CellVar.GoPointer(), purego.NewCallback(FuncVar), FuncDataVar, purego.NewCallback(DestroyVar)) | 516 | + | XGtkCellLayoutSetCellDataFunc(x.GoPointer(), CellVar.GoPointer(), glib.NewCallback(FuncVar), FuncDataVar, glib.NewCallback(DestroyVar)) |
| 517 | 517 | ||||
| 518 | } | 518 | } | ||
| 519 | 519 | ||||
M v4/gtk/gtkcssprovider.go +12 -3
| @@ -7,6 +7,7 @@ import ( | |||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | "github.com/jwijenbergh/puregotk/v4/gio" | 9 | "github.com/jwijenbergh/puregotk/v4/gio" | ||
| 10 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | 11 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 11 | ) | 12 | ) | ||
| 12 | 13 | ||||
| @@ -173,15 +174,23 @@ func (c *CssProvider) SetGoPointer(ptr uintptr) { | |||||
| 173 | // Note that this signal may be emitted at any time as the css provider | 174 | // Note that this signal may be emitted at any time as the css provider | ||
| 174 | // may opt to defer parsing parts or all of the input to a later time | 175 | // may opt to defer parsing parts or all of the input to a later time | ||
| 175 | // than when a loading function was called. | 176 | // than when a loading function was called. | ||
| 176 | - | func (x *CssProvider) ConnectParsingError(cb func(CssProvider, uintptr, uintptr)) uint32 { | 177 | + | func (x *CssProvider) ConnectParsingError(cb *func(CssProvider, uintptr, uintptr)) uint32 { |
| 178 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 179 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 180 | + | return gobject.SignalConnect(x.GoPointer(), "parsing-error", cbRefPtr) | |||
| 181 | + | } | |||
| 182 | + | ||||
| 177 | fcb := func(clsPtr uintptr, SectionVarp uintptr, ErrorVarp uintptr) { | 183 | fcb := func(clsPtr uintptr, SectionVarp uintptr, ErrorVarp uintptr) { | ||
| 178 | fa := CssProvider{} | 184 | fa := CssProvider{} | ||
| 179 | fa.Ptr = clsPtr | 185 | fa.Ptr = clsPtr | ||
| 186 | + | cbFn := *cb | |||
| 180 | 187 | ||||
| 181 | - | cb(fa, SectionVarp, ErrorVarp) | 188 | + | cbFn(fa, SectionVarp, ErrorVarp) |
| 182 | 189 | ||||
| 183 | } | 190 | } | ||
| 184 | - | return gobject.SignalConnect(x.GoPointer(), "parsing-error", purego.NewCallback(fcb)) | 191 | + | cbRefPtr := purego.NewCallback(fcb) |
| 192 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 193 | + | return gobject.SignalConnect(x.GoPointer(), "parsing-error", cbRefPtr) | |||
| 185 | } | 194 | } | ||
| 186 | 195 | ||||
| 187 | func init() { | 196 | func init() { | ||
M v4/gtk/gtkcustomfilter.go +4 -4
| @@ -43,10 +43,10 @@ var xNewCustomFilter func(uintptr, uintptr, uintptr) uintptr | |||||
| 43 | // | 43 | // | ||
| 44 | // If the filter func changes its filtering behavior, | 44 | // If the filter func changes its filtering behavior, | ||
| 45 | // gtk_filter_changed() needs to be called. | 45 | // gtk_filter_changed() needs to be called. | ||
| 46 | - | func NewCustomFilter(MatchFuncVar CustomFilterFunc, UserDataVar uintptr, UserDestroyVar glib.DestroyNotify) *CustomFilter { | 46 | + | func NewCustomFilter(MatchFuncVar *CustomFilterFunc, UserDataVar uintptr, UserDestroyVar *glib.DestroyNotify) *CustomFilter { |
| 47 | var cls *CustomFilter | 47 | var cls *CustomFilter | ||
| 48 | 48 | ||||
| 49 | - | cret := xNewCustomFilter(purego.NewCallback(MatchFuncVar), UserDataVar, purego.NewCallback(UserDestroyVar)) | 49 | + | cret := xNewCustomFilter(glib.NewCallback(MatchFuncVar), UserDataVar, glib.NewCallback(UserDestroyVar)) |
| 50 | 50 | ||||
| 51 | if cret == 0 { | 51 | if cret == 0 { | ||
| 52 | return nil | 52 | return nil | ||
| @@ -67,9 +67,9 @@ var xCustomFilterSetFilterFunc func(uintptr, uintptr, uintptr, uintptr) | |||||
| 67 | // | 67 | // | ||
| 68 | // If a previous function was set, its @user_destroy will be | 68 | // If a previous function was set, its @user_destroy will be | ||
| 69 | // called now. | 69 | // called now. | ||
| 70 | - | func (x *CustomFilter) SetFilterFunc(MatchFuncVar CustomFilterFunc, UserDataVar uintptr, UserDestroyVar glib.DestroyNotify) { | 70 | + | func (x *CustomFilter) SetFilterFunc(MatchFuncVar *CustomFilterFunc, UserDataVar uintptr, UserDestroyVar *glib.DestroyNotify) { |
| 71 | 71 | ||||
| 72 | - | xCustomFilterSetFilterFunc(x.GoPointer(), purego.NewCallback(MatchFuncVar), UserDataVar, purego.NewCallback(UserDestroyVar)) | 72 | + | xCustomFilterSetFilterFunc(x.GoPointer(), glib.NewCallback(MatchFuncVar), UserDataVar, glib.NewCallback(UserDestroyVar)) |
| 73 | 73 | ||||
| 74 | } | 74 | } | ||
| 75 | 75 | ||||
M v4/gtk/gtkcustomlayout.go +3 -2
| @@ -6,6 +6,7 @@ import ( | |||||
| 6 | 6 | ||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 9 | ) | 10 | ) | ||
| 10 | 11 | ||||
| 11 | // A function to be used by `GtkCustomLayout` to allocate a widget. | 12 | // A function to be used by `GtkCustomLayout` to allocate a widget. | ||
| @@ -48,10 +49,10 @@ var xNewCustomLayout func(uintptr, uintptr, uintptr) uintptr | |||||
| 48 | // Legacy layout managers map to the old `GtkWidget` size negotiation | 49 | // Legacy layout managers map to the old `GtkWidget` size negotiation | ||
| 49 | // virtual functions, and are meant to be used during the transition | 50 | // virtual functions, and are meant to be used during the transition | ||
| 50 | // from layout containers to layout manager delegates. | 51 | // from layout containers to layout manager delegates. | ||
| 51 | - | func NewCustomLayout(RequestModeVar CustomRequestModeFunc, MeasureVar CustomMeasureFunc, AllocateVar CustomAllocateFunc) *CustomLayout { | 52 | + | func NewCustomLayout(RequestModeVar *CustomRequestModeFunc, MeasureVar *CustomMeasureFunc, AllocateVar *CustomAllocateFunc) *CustomLayout { |
| 52 | var cls *CustomLayout | 53 | var cls *CustomLayout | ||
| 53 | 54 | ||||
| 54 | - | cret := xNewCustomLayout(purego.NewCallback(RequestModeVar), purego.NewCallback(MeasureVar), purego.NewCallback(AllocateVar)) | 55 | + | cret := xNewCustomLayout(glib.NewCallback(RequestModeVar), glib.NewCallback(MeasureVar), glib.NewCallback(AllocateVar)) |
| 55 | 56 | ||||
| 56 | if cret == 0 { | 57 | if cret == 0 { | ||
| 57 | return nil | 58 | return nil | ||
M v4/gtk/gtkcustomsorter.go +4 -4
| @@ -35,10 +35,10 @@ var xNewCustomSorter func(uintptr, uintptr, uintptr) uintptr | |||||
| 35 | // @sort_func to compare items. | 35 | // @sort_func to compare items. | ||
| 36 | // | 36 | // | ||
| 37 | // If @sort_func is %NULL, all items are considered equal. | 37 | // If @sort_func is %NULL, all items are considered equal. | ||
| 38 | - | func NewCustomSorter(SortFuncVar glib.CompareDataFunc, UserDataVar uintptr, UserDestroyVar glib.DestroyNotify) *CustomSorter { | 38 | + | func NewCustomSorter(SortFuncVar *glib.CompareDataFunc, UserDataVar uintptr, UserDestroyVar *glib.DestroyNotify) *CustomSorter { |
| 39 | var cls *CustomSorter | 39 | var cls *CustomSorter | ||
| 40 | 40 | ||||
| 41 | - | cret := xNewCustomSorter(purego.NewCallback(SortFuncVar), UserDataVar, purego.NewCallback(UserDestroyVar)) | 41 | + | cret := xNewCustomSorter(glib.NewCallback(SortFuncVar), UserDataVar, glib.NewCallback(UserDestroyVar)) |
| 42 | 42 | ||||
| 43 | if cret == 0 { | 43 | if cret == 0 { | ||
| 44 | return nil | 44 | return nil | ||
| @@ -59,9 +59,9 @@ var xCustomSorterSetSortFunc func(uintptr, uintptr, uintptr, uintptr) | |||||
| 59 | // | 59 | // | ||
| 60 | // If a previous function was set, its @user_destroy will be | 60 | // If a previous function was set, its @user_destroy will be | ||
| 61 | // called now. | 61 | // called now. | ||
| 62 | - | func (x *CustomSorter) SetSortFunc(SortFuncVar glib.CompareDataFunc, UserDataVar uintptr, UserDestroyVar glib.DestroyNotify) { | 62 | + | func (x *CustomSorter) SetSortFunc(SortFuncVar *glib.CompareDataFunc, UserDataVar uintptr, UserDestroyVar *glib.DestroyNotify) { |
| 63 | 63 | ||||
| 64 | - | xCustomSorterSetSortFunc(x.GoPointer(), purego.NewCallback(SortFuncVar), UserDataVar, purego.NewCallback(UserDestroyVar)) | 64 | + | xCustomSorterSetSortFunc(x.GoPointer(), glib.NewCallback(SortFuncVar), UserDataVar, glib.NewCallback(UserDestroyVar)) |
| 65 | 65 | ||||
| 66 | } | 66 | } | ||
| 67 | 67 | ||||
M v4/gtk/gtkdialog.go +23 -6
| @@ -7,6 +7,7 @@ import ( | |||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | ||
| 10 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | 11 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 11 | "github.com/jwijenbergh/puregotk/v4/gsk" | 12 | "github.com/jwijenbergh/puregotk/v4/gsk" | ||
| 12 | ) | 13 | ) | ||
| @@ -440,15 +441,23 @@ func (c *Dialog) SetGoPointer(ptr uintptr) { | |||||
| 440 | // This is a [keybinding signal](class.SignalAction.html). | 441 | // This is a [keybinding signal](class.SignalAction.html). | ||
| 441 | // | 442 | // | ||
| 442 | // The default binding for this signal is the Escape key. | 443 | // The default binding for this signal is the Escape key. | ||
| 443 | - | func (x *Dialog) ConnectClose(cb func(Dialog)) uint32 { | 444 | + | func (x *Dialog) ConnectClose(cb *func(Dialog)) uint32 { |
| 445 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 446 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 447 | + | return gobject.SignalConnect(x.GoPointer(), "close", cbRefPtr) | |||
| 448 | + | } | |||
| 449 | + | ||||
| 444 | fcb := func(clsPtr uintptr) { | 450 | fcb := func(clsPtr uintptr) { | ||
| 445 | fa := Dialog{} | 451 | fa := Dialog{} | ||
| 446 | fa.Ptr = clsPtr | 452 | fa.Ptr = clsPtr | ||
| 453 | + | cbFn := *cb | |||
| 447 | 454 | ||||
| 448 | - | cb(fa) | 455 | + | cbFn(fa) |
| 449 | 456 | ||||
| 450 | } | 457 | } | ||
| 451 | - | return gobject.SignalConnect(x.GoPointer(), "close", purego.NewCallback(fcb)) | 458 | + | cbRefPtr := purego.NewCallback(fcb) |
| 459 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 460 | + | return gobject.SignalConnect(x.GoPointer(), "close", cbRefPtr) | |||
| 452 | } | 461 | } | ||
| 453 | 462 | ||||
| 454 | // Emitted when an action widget is clicked. | 463 | // Emitted when an action widget is clicked. | ||
| @@ -457,15 +466,23 @@ func (x *Dialog) ConnectClose(cb func(Dialog)) uint32 { | |||||
| 457 | // delete event, and when [method@Gtk.Dialog.response] is called. | 466 | // delete event, and when [method@Gtk.Dialog.response] is called. | ||
| 458 | // On a delete event, the response ID is %GTK_RESPONSE_DELETE_EVENT. | 467 | // On a delete event, the response ID is %GTK_RESPONSE_DELETE_EVENT. | ||
| 459 | // Otherwise, it depends on which action widget was clicked. | 468 | // Otherwise, it depends on which action widget was clicked. | ||
| 460 | - | func (x *Dialog) ConnectResponse(cb func(Dialog, int)) uint32 { | 469 | + | func (x *Dialog) ConnectResponse(cb *func(Dialog, int)) uint32 { |
| 470 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 471 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 472 | + | return gobject.SignalConnect(x.GoPointer(), "response", cbRefPtr) | |||
| 473 | + | } | |||
| 474 | + | ||||
| 461 | fcb := func(clsPtr uintptr, ResponseIdVarp int) { | 475 | fcb := func(clsPtr uintptr, ResponseIdVarp int) { | ||
| 462 | fa := Dialog{} | 476 | fa := Dialog{} | ||
| 463 | fa.Ptr = clsPtr | 477 | fa.Ptr = clsPtr | ||
| 478 | + | cbFn := *cb | |||
| 464 | 479 | ||||
| 465 | - | cb(fa, ResponseIdVarp) | 480 | + | cbFn(fa, ResponseIdVarp) |
| 466 | 481 | ||||
| 467 | } | 482 | } | ||
| 468 | - | return gobject.SignalConnect(x.GoPointer(), "response", purego.NewCallback(fcb)) | 483 | + | cbRefPtr := purego.NewCallback(fcb) |
| 484 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 485 | + | return gobject.SignalConnect(x.GoPointer(), "response", cbRefPtr) | |||
| 469 | } | 486 | } | ||
| 470 | 487 | ||||
| 471 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 488 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/gtk/gtkdragsource.go +45 -12
| @@ -7,6 +7,7 @@ import ( | |||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | ||
| 10 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | 11 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 11 | ) | 12 | ) | ||
| 12 | 13 | ||||
| @@ -244,15 +245,23 @@ func (c *DragSource) SetGoPointer(ptr uintptr) { | |||||
| 244 | // | 245 | // | ||
| 245 | // It can be used to e.g. set a custom drag icon with | 246 | // It can be used to e.g. set a custom drag icon with | ||
| 246 | // [method@Gtk.DragSource.set_icon]. | 247 | // [method@Gtk.DragSource.set_icon]. | ||
| 247 | - | func (x *DragSource) ConnectDragBegin(cb func(DragSource, uintptr)) uint32 { | 248 | + | func (x *DragSource) ConnectDragBegin(cb *func(DragSource, uintptr)) uint32 { |
| 249 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 250 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 251 | + | return gobject.SignalConnect(x.GoPointer(), "drag-begin", cbRefPtr) | |||
| 252 | + | } | |||
| 253 | + | ||||
| 248 | fcb := func(clsPtr uintptr, DragVarp uintptr) { | 254 | fcb := func(clsPtr uintptr, DragVarp uintptr) { | ||
| 249 | fa := DragSource{} | 255 | fa := DragSource{} | ||
| 250 | fa.Ptr = clsPtr | 256 | fa.Ptr = clsPtr | ||
| 257 | + | cbFn := *cb | |||
| 251 | 258 | ||||
| 252 | - | cb(fa, DragVarp) | 259 | + | cbFn(fa, DragVarp) |
| 253 | 260 | ||||
| 254 | } | 261 | } | ||
| 255 | - | return gobject.SignalConnect(x.GoPointer(), "drag-begin", purego.NewCallback(fcb)) | 262 | + | cbRefPtr := purego.NewCallback(fcb) |
| 263 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 264 | + | return gobject.SignalConnect(x.GoPointer(), "drag-begin", cbRefPtr) | |||
| 256 | } | 265 | } | ||
| 257 | 266 | ||||
| 258 | // Emitted on the drag source when a drag has failed. | 267 | // Emitted on the drag source when a drag has failed. | ||
| @@ -260,15 +269,23 @@ func (x *DragSource) ConnectDragBegin(cb func(DragSource, uintptr)) uint32 { | |||||
| 260 | // The signal handler may handle a failed drag operation based on | 269 | // The signal handler may handle a failed drag operation based on | ||
| 261 | // the type of error. It should return %TRUE if the failure has been handled | 270 | // the type of error. It should return %TRUE if the failure has been handled | ||
| 262 | // and the default "drag operation failed" animation should not be shown. | 271 | // and the default "drag operation failed" animation should not be shown. | ||
| 263 | - | func (x *DragSource) ConnectDragCancel(cb func(DragSource, uintptr, gdk.DragCancelReason) bool) uint32 { | 272 | + | func (x *DragSource) ConnectDragCancel(cb *func(DragSource, uintptr, gdk.DragCancelReason) bool) uint32 { |
| 273 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 274 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 275 | + | return gobject.SignalConnect(x.GoPointer(), "drag-cancel", cbRefPtr) | |||
| 276 | + | } | |||
| 277 | + | ||||
| 264 | fcb := func(clsPtr uintptr, DragVarp uintptr, ReasonVarp gdk.DragCancelReason) bool { | 278 | fcb := func(clsPtr uintptr, DragVarp uintptr, ReasonVarp gdk.DragCancelReason) bool { | ||
| 265 | fa := DragSource{} | 279 | fa := DragSource{} | ||
| 266 | fa.Ptr = clsPtr | 280 | fa.Ptr = clsPtr | ||
| 281 | + | cbFn := *cb | |||
| 267 | 282 | ||||
| 268 | - | return cb(fa, DragVarp, ReasonVarp) | 283 | + | return cbFn(fa, DragVarp, ReasonVarp) |
| 269 | 284 | ||||
| 270 | } | 285 | } | ||
| 271 | - | return gobject.SignalConnect(x.GoPointer(), "drag-cancel", purego.NewCallback(fcb)) | 286 | + | cbRefPtr := purego.NewCallback(fcb) |
| 287 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 288 | + | return gobject.SignalConnect(x.GoPointer(), "drag-cancel", cbRefPtr) | |||
| 272 | } | 289 | } | ||
| 273 | 290 | ||||
| 274 | // Emitted on the drag source when a drag is finished. | 291 | // Emitted on the drag source when a drag is finished. | ||
| @@ -276,15 +293,23 @@ func (x *DragSource) ConnectDragCancel(cb func(DragSource, uintptr, gdk.DragCanc | |||||
| 276 | // A typical reason to connect to this signal is to undo | 293 | // A typical reason to connect to this signal is to undo | ||
| 277 | // things done in [signal@Gtk.DragSource::prepare] or | 294 | // things done in [signal@Gtk.DragSource::prepare] or | ||
| 278 | // [signal@Gtk.DragSource::drag-begin] handlers. | 295 | // [signal@Gtk.DragSource::drag-begin] handlers. | ||
| 279 | - | func (x *DragSource) ConnectDragEnd(cb func(DragSource, uintptr, bool)) uint32 { | 296 | + | func (x *DragSource) ConnectDragEnd(cb *func(DragSource, uintptr, bool)) uint32 { |
| 297 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 298 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 299 | + | return gobject.SignalConnect(x.GoPointer(), "drag-end", cbRefPtr) | |||
| 300 | + | } | |||
| 301 | + | ||||
| 280 | fcb := func(clsPtr uintptr, DragVarp uintptr, DeleteDataVarp bool) { | 302 | fcb := func(clsPtr uintptr, DragVarp uintptr, DeleteDataVarp bool) { | ||
| 281 | fa := DragSource{} | 303 | fa := DragSource{} | ||
| 282 | fa.Ptr = clsPtr | 304 | fa.Ptr = clsPtr | ||
| 305 | + | cbFn := *cb | |||
| 283 | 306 | ||||
| 284 | - | cb(fa, DragVarp, DeleteDataVarp) | 307 | + | cbFn(fa, DragVarp, DeleteDataVarp) |
| 285 | 308 | ||||
| 286 | } | 309 | } | ||
| 287 | - | return gobject.SignalConnect(x.GoPointer(), "drag-end", purego.NewCallback(fcb)) | 310 | + | cbRefPtr := purego.NewCallback(fcb) |
| 311 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 312 | + | return gobject.SignalConnect(x.GoPointer(), "drag-end", cbRefPtr) | |||
| 288 | } | 313 | } | ||
| 289 | 314 | ||||
| 290 | // Emitted when a drag is about to be initiated. | 315 | // Emitted when a drag is about to be initiated. | ||
| @@ -293,16 +318,24 @@ func (x *DragSource) ConnectDragEnd(cb func(DragSource, uintptr, bool)) uint32 { | |||||
| 293 | // to start. The default handler for this signal returns the value of | 318 | // to start. The default handler for this signal returns the value of | ||
| 294 | // the [property@Gtk.DragSource:content] property, so if you set up that | 319 | // the [property@Gtk.DragSource:content] property, so if you set up that | ||
| 295 | // property ahead of time, you don't need to connect to this signal. | 320 | // property ahead of time, you don't need to connect to this signal. | ||
| 296 | - | func (x *DragSource) ConnectPrepare(cb func(DragSource, float64, float64) gdk.ContentProvider) uint32 { | 321 | + | func (x *DragSource) ConnectPrepare(cb *func(DragSource, float64, float64) gdk.ContentProvider) uint32 { |
| 322 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 323 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 324 | + | return gobject.SignalConnect(x.GoPointer(), "prepare", cbRefPtr) | |||
| 325 | + | } | |||
| 326 | + | ||||
| 297 | fcb := func(clsPtr uintptr, XVarp float64, YVarp float64) uintptr { | 327 | fcb := func(clsPtr uintptr, XVarp float64, YVarp float64) uintptr { | ||
| 298 | fa := DragSource{} | 328 | fa := DragSource{} | ||
| 299 | fa.Ptr = clsPtr | 329 | fa.Ptr = clsPtr | ||
| 330 | + | cbFn := *cb | |||
| 300 | 331 | ||||
| 301 | - | PrepareCls := cb(fa, XVarp, YVarp) | 332 | + | PrepareCls := cbFn(fa, XVarp, YVarp) |
| 302 | return PrepareCls.Ptr | 333 | return PrepareCls.Ptr | ||
| 303 | 334 | ||||
| 304 | } | 335 | } | ||
| 305 | - | return gobject.SignalConnect(x.GoPointer(), "prepare", purego.NewCallback(fcb)) | 336 | + | cbRefPtr := purego.NewCallback(fcb) |
| 337 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 338 | + | return gobject.SignalConnect(x.GoPointer(), "prepare", cbRefPtr) | |||
| 306 | } | 339 | } | ||
| 307 | 340 | ||||
| 308 | func init() { | 341 | func init() { | ||
M v4/gtk/gtkdrawingarea.go +13 -5
| @@ -205,9 +205,9 @@ var xDrawingAreaSetDrawFunc func(uintptr, uintptr, uintptr, uintptr) | |||||
| 205 | // | 205 | // | ||
| 206 | // If what you are drawing does change, call [method@Gtk.Widget.queue_draw] | 206 | // If what you are drawing does change, call [method@Gtk.Widget.queue_draw] | ||
| 207 | // on the drawing area. This will cause a redraw and will call @draw_func again. | 207 | // on the drawing area. This will cause a redraw and will call @draw_func again. | ||
| 208 | - | func (x *DrawingArea) SetDrawFunc(DrawFuncVar DrawingAreaDrawFunc, UserDataVar uintptr, DestroyVar glib.DestroyNotify) { | 208 | + | func (x *DrawingArea) SetDrawFunc(DrawFuncVar *DrawingAreaDrawFunc, UserDataVar uintptr, DestroyVar *glib.DestroyNotify) { |
| 209 | 209 | ||||
| 210 | - | xDrawingAreaSetDrawFunc(x.GoPointer(), purego.NewCallback(DrawFuncVar), UserDataVar, purego.NewCallback(DestroyVar)) | 210 | + | xDrawingAreaSetDrawFunc(x.GoPointer(), glib.NewCallback(DrawFuncVar), UserDataVar, glib.NewCallback(DestroyVar)) |
| 211 | 211 | ||||
| 212 | } | 212 | } | ||
| 213 | 213 | ||||
| @@ -224,15 +224,23 @@ func (c *DrawingArea) SetGoPointer(ptr uintptr) { | |||||
| 224 | // | 224 | // | ||
| 225 | // This is useful in order to keep state up to date with the widget size, | 225 | // This is useful in order to keep state up to date with the widget size, | ||
| 226 | // like for instance a backing surface. | 226 | // like for instance a backing surface. | ||
| 227 | - | func (x *DrawingArea) ConnectResize(cb func(DrawingArea, int, int)) uint32 { | 227 | + | func (x *DrawingArea) ConnectResize(cb *func(DrawingArea, int, int)) uint32 { |
| 228 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 229 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 230 | + | return gobject.SignalConnect(x.GoPointer(), "resize", cbRefPtr) | |||
| 231 | + | } | |||
| 232 | + | ||||
| 228 | fcb := func(clsPtr uintptr, WidthVarp int, HeightVarp int) { | 233 | fcb := func(clsPtr uintptr, WidthVarp int, HeightVarp int) { | ||
| 229 | fa := DrawingArea{} | 234 | fa := DrawingArea{} | ||
| 230 | fa.Ptr = clsPtr | 235 | fa.Ptr = clsPtr | ||
| 236 | + | cbFn := *cb | |||
| 231 | 237 | ||||
| 232 | - | cb(fa, WidthVarp, HeightVarp) | 238 | + | cbFn(fa, WidthVarp, HeightVarp) |
| 233 | 239 | ||||
| 234 | } | 240 | } | ||
| 235 | - | return gobject.SignalConnect(x.GoPointer(), "resize", purego.NewCallback(fcb)) | 241 | + | cbRefPtr := purego.NewCallback(fcb) |
| 242 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 243 | + | return gobject.SignalConnect(x.GoPointer(), "resize", cbRefPtr) | |||
| 236 | } | 244 | } | ||
| 237 | 245 | ||||
| 238 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 246 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/gtk/gtkdropcontrollermotion.go +34 -9
| @@ -7,6 +7,7 @@ import ( | |||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | ||
| 10 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | 11 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 11 | ) | 12 | ) | ||
| 12 | 13 | ||||
| @@ -99,39 +100,63 @@ func (c *DropControllerMotion) SetGoPointer(ptr uintptr) { | |||||
| 99 | } | 100 | } | ||
| 100 | 101 | ||||
| 101 | // Signals that the pointer has entered the widget. | 102 | // Signals that the pointer has entered the widget. | ||
| 102 | - | func (x *DropControllerMotion) ConnectEnter(cb func(DropControllerMotion, float64, float64)) uint32 { | 103 | + | func (x *DropControllerMotion) ConnectEnter(cb *func(DropControllerMotion, float64, float64)) uint32 { |
| 104 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 105 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 106 | + | return gobject.SignalConnect(x.GoPointer(), "enter", cbRefPtr) | |||
| 107 | + | } | |||
| 108 | + | ||||
| 103 | fcb := func(clsPtr uintptr, XVarp float64, YVarp float64) { | 109 | fcb := func(clsPtr uintptr, XVarp float64, YVarp float64) { | ||
| 104 | fa := DropControllerMotion{} | 110 | fa := DropControllerMotion{} | ||
| 105 | fa.Ptr = clsPtr | 111 | fa.Ptr = clsPtr | ||
| 112 | + | cbFn := *cb | |||
| 106 | 113 | ||||
| 107 | - | cb(fa, XVarp, YVarp) | 114 | + | cbFn(fa, XVarp, YVarp) |
| 108 | 115 | ||||
| 109 | } | 116 | } | ||
| 110 | - | return gobject.SignalConnect(x.GoPointer(), "enter", purego.NewCallback(fcb)) | 117 | + | cbRefPtr := purego.NewCallback(fcb) |
| 118 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 119 | + | return gobject.SignalConnect(x.GoPointer(), "enter", cbRefPtr) | |||
| 111 | } | 120 | } | ||
| 112 | 121 | ||||
| 113 | // Signals that the pointer has left the widget. | 122 | // Signals that the pointer has left the widget. | ||
| 114 | - | func (x *DropControllerMotion) ConnectLeave(cb func(DropControllerMotion)) uint32 { | 123 | + | func (x *DropControllerMotion) ConnectLeave(cb *func(DropControllerMotion)) uint32 { |
| 124 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 125 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 126 | + | return gobject.SignalConnect(x.GoPointer(), "leave", cbRefPtr) | |||
| 127 | + | } | |||
| 128 | + | ||||
| 115 | fcb := func(clsPtr uintptr) { | 129 | fcb := func(clsPtr uintptr) { | ||
| 116 | fa := DropControllerMotion{} | 130 | fa := DropControllerMotion{} | ||
| 117 | fa.Ptr = clsPtr | 131 | fa.Ptr = clsPtr | ||
| 132 | + | cbFn := *cb | |||
| 118 | 133 | ||||
| 119 | - | cb(fa) | 134 | + | cbFn(fa) |
| 120 | 135 | ||||
| 121 | } | 136 | } | ||
| 122 | - | return gobject.SignalConnect(x.GoPointer(), "leave", purego.NewCallback(fcb)) | 137 | + | cbRefPtr := purego.NewCallback(fcb) |
| 138 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 139 | + | return gobject.SignalConnect(x.GoPointer(), "leave", cbRefPtr) | |||
| 123 | } | 140 | } | ||
| 124 | 141 | ||||
| 125 | // Emitted when the pointer moves inside the widget. | 142 | // Emitted when the pointer moves inside the widget. | ||
| 126 | - | func (x *DropControllerMotion) ConnectMotion(cb func(DropControllerMotion, float64, float64)) uint32 { | 143 | + | func (x *DropControllerMotion) ConnectMotion(cb *func(DropControllerMotion, float64, float64)) uint32 { |
| 144 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 145 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 146 | + | return gobject.SignalConnect(x.GoPointer(), "motion", cbRefPtr) | |||
| 147 | + | } | |||
| 148 | + | ||||
| 127 | fcb := func(clsPtr uintptr, XVarp float64, YVarp float64) { | 149 | fcb := func(clsPtr uintptr, XVarp float64, YVarp float64) { | ||
| 128 | fa := DropControllerMotion{} | 150 | fa := DropControllerMotion{} | ||
| 129 | fa.Ptr = clsPtr | 151 | fa.Ptr = clsPtr | ||
| 152 | + | cbFn := *cb | |||
| 130 | 153 | ||||
| 131 | - | cb(fa, XVarp, YVarp) | 154 | + | cbFn(fa, XVarp, YVarp) |
| 132 | 155 | ||||
| 133 | } | 156 | } | ||
| 134 | - | return gobject.SignalConnect(x.GoPointer(), "motion", purego.NewCallback(fcb)) | 157 | + | cbRefPtr := purego.NewCallback(fcb) |
| 158 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 159 | + | return gobject.SignalConnect(x.GoPointer(), "motion", cbRefPtr) | |||
| 135 | } | 160 | } | ||
| 136 | 161 | ||||
| 137 | func init() { | 162 | func init() { | ||
M v4/gtk/gtkdropdown.go +12 -3
| @@ -7,6 +7,7 @@ import ( | |||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | "github.com/jwijenbergh/puregotk/v4/gio" | 9 | "github.com/jwijenbergh/puregotk/v4/gio" | ||
| 10 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | 11 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 11 | ) | 12 | ) | ||
| 12 | 13 | ||||
| @@ -310,15 +311,23 @@ func (c *DropDown) SetGoPointer(ptr uintptr) { | |||||
| 310 | // | 311 | // | ||
| 311 | // The `::activate` signal on `GtkDropDown` is an action signal and | 312 | // The `::activate` signal on `GtkDropDown` is an action signal and | ||
| 312 | // emitting it causes the drop down to pop up its dropdown. | 313 | // emitting it causes the drop down to pop up its dropdown. | ||
| 313 | - | func (x *DropDown) ConnectActivate(cb func(DropDown)) uint32 { | 314 | + | func (x *DropDown) ConnectActivate(cb *func(DropDown)) uint32 { |
| 315 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 316 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 317 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 318 | + | } | |||
| 319 | + | ||||
| 314 | fcb := func(clsPtr uintptr) { | 320 | fcb := func(clsPtr uintptr) { | ||
| 315 | fa := DropDown{} | 321 | fa := DropDown{} | ||
| 316 | fa.Ptr = clsPtr | 322 | fa.Ptr = clsPtr | ||
| 323 | + | cbFn := *cb | |||
| 317 | 324 | ||||
| 318 | - | cb(fa) | 325 | + | cbFn(fa) |
| 319 | 326 | ||||
| 320 | } | 327 | } | ||
| 321 | - | return gobject.SignalConnect(x.GoPointer(), "activate", purego.NewCallback(fcb)) | 328 | + | cbRefPtr := purego.NewCallback(fcb) |
| 329 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 330 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 322 | } | 331 | } | ||
| 323 | 332 | ||||
| 324 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 333 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/gtk/gtkdroptarget.go +56 -15
| @@ -7,6 +7,7 @@ import ( | |||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | ||
| 10 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | 11 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 11 | ) | 12 | ) | ||
| 12 | 13 | ||||
| @@ -276,15 +277,23 @@ func (c *DropTarget) SetGoPointer(ptr uintptr) { | |||||
| 276 | // [property@Gtk.DropTarget:preload] property should be set and the value | 277 | // [property@Gtk.DropTarget:preload] property should be set and the value | ||
| 277 | // should be inspected via the ::notify:value signal, calling | 278 | // should be inspected via the ::notify:value signal, calling | ||
| 278 | // [method@Gtk.DropTarget.reject] if required. | 279 | // [method@Gtk.DropTarget.reject] if required. | ||
| 279 | - | func (x *DropTarget) ConnectAccept(cb func(DropTarget, uintptr) bool) uint32 { | 280 | + | func (x *DropTarget) ConnectAccept(cb *func(DropTarget, uintptr) bool) uint32 { |
| 281 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 282 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 283 | + | return gobject.SignalConnect(x.GoPointer(), "accept", cbRefPtr) | |||
| 284 | + | } | |||
| 285 | + | ||||
| 280 | fcb := func(clsPtr uintptr, DropVarp uintptr) bool { | 286 | fcb := func(clsPtr uintptr, DropVarp uintptr) bool { | ||
| 281 | fa := DropTarget{} | 287 | fa := DropTarget{} | ||
| 282 | fa.Ptr = clsPtr | 288 | fa.Ptr = clsPtr | ||
| 289 | + | cbFn := *cb | |||
| 283 | 290 | ||||
| 284 | - | return cb(fa, DropVarp) | 291 | + | return cbFn(fa, DropVarp) |
| 285 | 292 | ||||
| 286 | } | 293 | } | ||
| 287 | - | return gobject.SignalConnect(x.GoPointer(), "accept", purego.NewCallback(fcb)) | 294 | + | cbRefPtr := purego.NewCallback(fcb) |
| 295 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 296 | + | return gobject.SignalConnect(x.GoPointer(), "accept", cbRefPtr) | |||
| 288 | } | 297 | } | ||
| 289 | 298 | ||||
| 290 | // Emitted on the drop site when the user drops the data onto the widget. | 299 | // Emitted on the drop site when the user drops the data onto the widget. | ||
| @@ -296,56 +305,88 @@ func (x *DropTarget) ConnectAccept(cb func(DropTarget, uintptr) bool) uint32 { | |||||
| 296 | // Otherwise, the handler returns %TRUE. In this case, this handler will | 305 | // Otherwise, the handler returns %TRUE. In this case, this handler will | ||
| 297 | // accept the drop. The handler is responsible for using the given @value | 306 | // accept the drop. The handler is responsible for using the given @value | ||
| 298 | // and performing the drop operation. | 307 | // and performing the drop operation. | ||
| 299 | - | func (x *DropTarget) ConnectDrop(cb func(DropTarget, uintptr, float64, float64) bool) uint32 { | 308 | + | func (x *DropTarget) ConnectDrop(cb *func(DropTarget, uintptr, float64, float64) bool) uint32 { |
| 309 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 310 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 311 | + | return gobject.SignalConnect(x.GoPointer(), "drop", cbRefPtr) | |||
| 312 | + | } | |||
| 313 | + | ||||
| 300 | fcb := func(clsPtr uintptr, ValueVarp uintptr, XVarp float64, YVarp float64) bool { | 314 | fcb := func(clsPtr uintptr, ValueVarp uintptr, XVarp float64, YVarp float64) bool { | ||
| 301 | fa := DropTarget{} | 315 | fa := DropTarget{} | ||
| 302 | fa.Ptr = clsPtr | 316 | fa.Ptr = clsPtr | ||
| 317 | + | cbFn := *cb | |||
| 303 | 318 | ||||
| 304 | - | return cb(fa, ValueVarp, XVarp, YVarp) | 319 | + | return cbFn(fa, ValueVarp, XVarp, YVarp) |
| 305 | 320 | ||||
| 306 | } | 321 | } | ||
| 307 | - | return gobject.SignalConnect(x.GoPointer(), "drop", purego.NewCallback(fcb)) | 322 | + | cbRefPtr := purego.NewCallback(fcb) |
| 323 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 324 | + | return gobject.SignalConnect(x.GoPointer(), "drop", cbRefPtr) | |||
| 308 | } | 325 | } | ||
| 309 | 326 | ||||
| 310 | // Emitted on the drop site when the pointer enters the widget. | 327 | // Emitted on the drop site when the pointer enters the widget. | ||
| 311 | // | 328 | // | ||
| 312 | // It can be used to set up custom highlighting. | 329 | // It can be used to set up custom highlighting. | ||
| 313 | - | func (x *DropTarget) ConnectEnter(cb func(DropTarget, float64, float64) gdk.DragAction) uint32 { | 330 | + | func (x *DropTarget) ConnectEnter(cb *func(DropTarget, float64, float64) gdk.DragAction) uint32 { |
| 331 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 332 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 333 | + | return gobject.SignalConnect(x.GoPointer(), "enter", cbRefPtr) | |||
| 334 | + | } | |||
| 335 | + | ||||
| 314 | fcb := func(clsPtr uintptr, XVarp float64, YVarp float64) gdk.DragAction { | 336 | fcb := func(clsPtr uintptr, XVarp float64, YVarp float64) gdk.DragAction { | ||
| 315 | fa := DropTarget{} | 337 | fa := DropTarget{} | ||
| 316 | fa.Ptr = clsPtr | 338 | fa.Ptr = clsPtr | ||
| 339 | + | cbFn := *cb | |||
| 317 | 340 | ||||
| 318 | - | return cb(fa, XVarp, YVarp) | 341 | + | return cbFn(fa, XVarp, YVarp) |
| 319 | 342 | ||||
| 320 | } | 343 | } | ||
| 321 | - | return gobject.SignalConnect(x.GoPointer(), "enter", purego.NewCallback(fcb)) | 344 | + | cbRefPtr := purego.NewCallback(fcb) |
| 345 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 346 | + | return gobject.SignalConnect(x.GoPointer(), "enter", cbRefPtr) | |||
| 322 | } | 347 | } | ||
| 323 | 348 | ||||
| 324 | // Emitted on the drop site when the pointer leaves the widget. | 349 | // Emitted on the drop site when the pointer leaves the widget. | ||
| 325 | // | 350 | // | ||
| 326 | // Its main purpose it to undo things done in | 351 | // Its main purpose it to undo things done in | ||
| 327 | // [signal@Gtk.DropTarget::enter]. | 352 | // [signal@Gtk.DropTarget::enter]. | ||
| 328 | - | func (x *DropTarget) ConnectLeave(cb func(DropTarget)) uint32 { | 353 | + | func (x *DropTarget) ConnectLeave(cb *func(DropTarget)) uint32 { |
| 354 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 355 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 356 | + | return gobject.SignalConnect(x.GoPointer(), "leave", cbRefPtr) | |||
| 357 | + | } | |||
| 358 | + | ||||
| 329 | fcb := func(clsPtr uintptr) { | 359 | fcb := func(clsPtr uintptr) { | ||
| 330 | fa := DropTarget{} | 360 | fa := DropTarget{} | ||
| 331 | fa.Ptr = clsPtr | 361 | fa.Ptr = clsPtr | ||
| 362 | + | cbFn := *cb | |||
| 332 | 363 | ||||
| 333 | - | cb(fa) | 364 | + | cbFn(fa) |
| 334 | 365 | ||||
| 335 | } | 366 | } | ||
| 336 | - | return gobject.SignalConnect(x.GoPointer(), "leave", purego.NewCallback(fcb)) | 367 | + | cbRefPtr := purego.NewCallback(fcb) |
| 368 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 369 | + | return gobject.SignalConnect(x.GoPointer(), "leave", cbRefPtr) | |||
| 337 | } | 370 | } | ||
| 338 | 371 | ||||
| 339 | // Emitted while the pointer is moving over the drop target. | 372 | // Emitted while the pointer is moving over the drop target. | ||
| 340 | - | func (x *DropTarget) ConnectMotion(cb func(DropTarget, float64, float64) gdk.DragAction) uint32 { | 373 | + | func (x *DropTarget) ConnectMotion(cb *func(DropTarget, float64, float64) gdk.DragAction) uint32 { |
| 374 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 375 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 376 | + | return gobject.SignalConnect(x.GoPointer(), "motion", cbRefPtr) | |||
| 377 | + | } | |||
| 378 | + | ||||
| 341 | fcb := func(clsPtr uintptr, XVarp float64, YVarp float64) gdk.DragAction { | 379 | fcb := func(clsPtr uintptr, XVarp float64, YVarp float64) gdk.DragAction { | ||
| 342 | fa := DropTarget{} | 380 | fa := DropTarget{} | ||
| 343 | fa.Ptr = clsPtr | 381 | fa.Ptr = clsPtr | ||
| 382 | + | cbFn := *cb | |||
| 344 | 383 | ||||
| 345 | - | return cb(fa, XVarp, YVarp) | 384 | + | return cbFn(fa, XVarp, YVarp) |
| 346 | 385 | ||||
| 347 | } | 386 | } | ||
| 348 | - | return gobject.SignalConnect(x.GoPointer(), "motion", purego.NewCallback(fcb)) | 387 | + | cbRefPtr := purego.NewCallback(fcb) |
| 388 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 389 | + | return gobject.SignalConnect(x.GoPointer(), "motion", cbRefPtr) | |||
| 349 | } | 390 | } | ||
| 350 | 391 | ||||
| 351 | func init() { | 392 | func init() { | ||
M v4/gtk/gtkdroptargetasync.go +56 -15
| @@ -7,6 +7,7 @@ import ( | |||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | ||
| 10 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | 11 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 11 | ) | 12 | ) | ||
| 12 | 13 | ||||
| @@ -151,56 +152,88 @@ func (c *DropTargetAsync) SetGoPointer(ptr uintptr) { | |||||
| 151 | // further processing, such as inspecting the data, this function should | 152 | // further processing, such as inspecting the data, this function should | ||
| 152 | // return %TRUE and proceed as is @drop was accepted and if it decides to | 153 | // return %TRUE and proceed as is @drop was accepted and if it decides to | ||
| 153 | // reject the drop later, it should call [method@Gtk.DropTargetAsync.reject_drop]. | 154 | // reject the drop later, it should call [method@Gtk.DropTargetAsync.reject_drop]. | ||
| 154 | - | func (x *DropTargetAsync) ConnectAccept(cb func(DropTargetAsync, uintptr) bool) uint32 { | 155 | + | func (x *DropTargetAsync) ConnectAccept(cb *func(DropTargetAsync, uintptr) bool) uint32 { |
| 156 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 157 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 158 | + | return gobject.SignalConnect(x.GoPointer(), "accept", cbRefPtr) | |||
| 159 | + | } | |||
| 160 | + | ||||
| 155 | fcb := func(clsPtr uintptr, DropVarp uintptr) bool { | 161 | fcb := func(clsPtr uintptr, DropVarp uintptr) bool { | ||
| 156 | fa := DropTargetAsync{} | 162 | fa := DropTargetAsync{} | ||
| 157 | fa.Ptr = clsPtr | 163 | fa.Ptr = clsPtr | ||
| 164 | + | cbFn := *cb | |||
| 158 | 165 | ||||
| 159 | - | return cb(fa, DropVarp) | 166 | + | return cbFn(fa, DropVarp) |
| 160 | 167 | ||||
| 161 | } | 168 | } | ||
| 162 | - | return gobject.SignalConnect(x.GoPointer(), "accept", purego.NewCallback(fcb)) | 169 | + | cbRefPtr := purego.NewCallback(fcb) |
| 170 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 171 | + | return gobject.SignalConnect(x.GoPointer(), "accept", cbRefPtr) | |||
| 163 | } | 172 | } | ||
| 164 | 173 | ||||
| 165 | // Emitted on the drop site when the pointer enters the widget. | 174 | // Emitted on the drop site when the pointer enters the widget. | ||
| 166 | // | 175 | // | ||
| 167 | // It can be used to set up custom highlighting. | 176 | // It can be used to set up custom highlighting. | ||
| 168 | - | func (x *DropTargetAsync) ConnectDragEnter(cb func(DropTargetAsync, uintptr, float64, float64) gdk.DragAction) uint32 { | 177 | + | func (x *DropTargetAsync) ConnectDragEnter(cb *func(DropTargetAsync, uintptr, float64, float64) gdk.DragAction) uint32 { |
| 178 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 179 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 180 | + | return gobject.SignalConnect(x.GoPointer(), "drag-enter", cbRefPtr) | |||
| 181 | + | } | |||
| 182 | + | ||||
| 169 | fcb := func(clsPtr uintptr, DropVarp uintptr, XVarp float64, YVarp float64) gdk.DragAction { | 183 | fcb := func(clsPtr uintptr, DropVarp uintptr, XVarp float64, YVarp float64) gdk.DragAction { | ||
| 170 | fa := DropTargetAsync{} | 184 | fa := DropTargetAsync{} | ||
| 171 | fa.Ptr = clsPtr | 185 | fa.Ptr = clsPtr | ||
| 186 | + | cbFn := *cb | |||
| 172 | 187 | ||||
| 173 | - | return cb(fa, DropVarp, XVarp, YVarp) | 188 | + | return cbFn(fa, DropVarp, XVarp, YVarp) |
| 174 | 189 | ||||
| 175 | } | 190 | } | ||
| 176 | - | return gobject.SignalConnect(x.GoPointer(), "drag-enter", purego.NewCallback(fcb)) | 191 | + | cbRefPtr := purego.NewCallback(fcb) |
| 192 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 193 | + | return gobject.SignalConnect(x.GoPointer(), "drag-enter", cbRefPtr) | |||
| 177 | } | 194 | } | ||
| 178 | 195 | ||||
| 179 | // Emitted on the drop site when the pointer leaves the widget. | 196 | // Emitted on the drop site when the pointer leaves the widget. | ||
| 180 | // | 197 | // | ||
| 181 | // Its main purpose it to undo things done in | 198 | // Its main purpose it to undo things done in | ||
| 182 | // `GtkDropTargetAsync`::drag-enter. | 199 | // `GtkDropTargetAsync`::drag-enter. | ||
| 183 | - | func (x *DropTargetAsync) ConnectDragLeave(cb func(DropTargetAsync, uintptr)) uint32 { | 200 | + | func (x *DropTargetAsync) ConnectDragLeave(cb *func(DropTargetAsync, uintptr)) uint32 { |
| 201 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 202 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 203 | + | return gobject.SignalConnect(x.GoPointer(), "drag-leave", cbRefPtr) | |||
| 204 | + | } | |||
| 205 | + | ||||
| 184 | fcb := func(clsPtr uintptr, DropVarp uintptr) { | 206 | fcb := func(clsPtr uintptr, DropVarp uintptr) { | ||
| 185 | fa := DropTargetAsync{} | 207 | fa := DropTargetAsync{} | ||
| 186 | fa.Ptr = clsPtr | 208 | fa.Ptr = clsPtr | ||
| 209 | + | cbFn := *cb | |||
| 187 | 210 | ||||
| 188 | - | cb(fa, DropVarp) | 211 | + | cbFn(fa, DropVarp) |
| 189 | 212 | ||||
| 190 | } | 213 | } | ||
| 191 | - | return gobject.SignalConnect(x.GoPointer(), "drag-leave", purego.NewCallback(fcb)) | 214 | + | cbRefPtr := purego.NewCallback(fcb) |
| 215 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 216 | + | return gobject.SignalConnect(x.GoPointer(), "drag-leave", cbRefPtr) | |||
| 192 | } | 217 | } | ||
| 193 | 218 | ||||
| 194 | // Emitted while the pointer is moving over the drop target. | 219 | // Emitted while the pointer is moving over the drop target. | ||
| 195 | - | func (x *DropTargetAsync) ConnectDragMotion(cb func(DropTargetAsync, uintptr, float64, float64) gdk.DragAction) uint32 { | 220 | + | func (x *DropTargetAsync) ConnectDragMotion(cb *func(DropTargetAsync, uintptr, float64, float64) gdk.DragAction) uint32 { |
| 221 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 222 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 223 | + | return gobject.SignalConnect(x.GoPointer(), "drag-motion", cbRefPtr) | |||
| 224 | + | } | |||
| 225 | + | ||||
| 196 | fcb := func(clsPtr uintptr, DropVarp uintptr, XVarp float64, YVarp float64) gdk.DragAction { | 226 | fcb := func(clsPtr uintptr, DropVarp uintptr, XVarp float64, YVarp float64) gdk.DragAction { | ||
| 197 | fa := DropTargetAsync{} | 227 | fa := DropTargetAsync{} | ||
| 198 | fa.Ptr = clsPtr | 228 | fa.Ptr = clsPtr | ||
| 229 | + | cbFn := *cb | |||
| 199 | 230 | ||||
| 200 | - | return cb(fa, DropVarp, XVarp, YVarp) | 231 | + | return cbFn(fa, DropVarp, XVarp, YVarp) |
| 201 | 232 | ||||
| 202 | } | 233 | } | ||
| 203 | - | return gobject.SignalConnect(x.GoPointer(), "drag-motion", purego.NewCallback(fcb)) | 234 | + | cbRefPtr := purego.NewCallback(fcb) |
| 235 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 236 | + | return gobject.SignalConnect(x.GoPointer(), "drag-motion", cbRefPtr) | |||
| 204 | } | 237 | } | ||
| 205 | 238 | ||||
| 206 | // Emitted on the drop site when the user drops the data onto the widget. | 239 | // Emitted on the drop site when the user drops the data onto the widget. | ||
| @@ -217,15 +250,23 @@ func (x *DropTargetAsync) ConnectDragMotion(cb func(DropTargetAsync, uintptr, fl | |||||
| 217 | // To receive the data, use one of the read functions provided by | 250 | // To receive the data, use one of the read functions provided by | ||
| 218 | // [class@Gdk.Drop] such as [method@Gdk.Drop.read_async] or | 251 | // [class@Gdk.Drop] such as [method@Gdk.Drop.read_async] or | ||
| 219 | // [method@Gdk.Drop.read_value_async]. | 252 | // [method@Gdk.Drop.read_value_async]. | ||
| 220 | - | func (x *DropTargetAsync) ConnectDrop(cb func(DropTargetAsync, uintptr, float64, float64) bool) uint32 { | 253 | + | func (x *DropTargetAsync) ConnectDrop(cb *func(DropTargetAsync, uintptr, float64, float64) bool) uint32 { |
| 254 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 255 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 256 | + | return gobject.SignalConnect(x.GoPointer(), "drop", cbRefPtr) | |||
| 257 | + | } | |||
| 258 | + | ||||
| 221 | fcb := func(clsPtr uintptr, DropVarp uintptr, XVarp float64, YVarp float64) bool { | 259 | fcb := func(clsPtr uintptr, DropVarp uintptr, XVarp float64, YVarp float64) bool { | ||
| 222 | fa := DropTargetAsync{} | 260 | fa := DropTargetAsync{} | ||
| 223 | fa.Ptr = clsPtr | 261 | fa.Ptr = clsPtr | ||
| 262 | + | cbFn := *cb | |||
| 224 | 263 | ||||
| 225 | - | return cb(fa, DropVarp, XVarp, YVarp) | 264 | + | return cbFn(fa, DropVarp, XVarp, YVarp) |
| 226 | 265 | ||||
| 227 | } | 266 | } | ||
| 228 | - | return gobject.SignalConnect(x.GoPointer(), "drop", purego.NewCallback(fcb)) | 267 | + | cbRefPtr := purego.NewCallback(fcb) |
| 268 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 269 | + | return gobject.SignalConnect(x.GoPointer(), "drop", cbRefPtr) | |||
| 229 | } | 270 | } | ||
| 230 | 271 | ||||
| 231 | func init() { | 272 | func init() { | ||
M v4/gtk/gtkemojichooser.go +12 -3
| @@ -7,6 +7,7 @@ import ( | |||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | ||
| 10 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | 11 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 11 | "github.com/jwijenbergh/puregotk/v4/gsk" | 12 | "github.com/jwijenbergh/puregotk/v4/gsk" | ||
| 12 | ) | 13 | ) | ||
| @@ -84,15 +85,23 @@ func (c *EmojiChooser) SetGoPointer(ptr uintptr) { | |||||
| 84 | } | 85 | } | ||
| 85 | 86 | ||||
| 86 | // Emitted when the user selects an Emoji. | 87 | // Emitted when the user selects an Emoji. | ||
| 87 | - | func (x *EmojiChooser) ConnectEmojiPicked(cb func(EmojiChooser, string)) uint32 { | 88 | + | func (x *EmojiChooser) ConnectEmojiPicked(cb *func(EmojiChooser, string)) uint32 { |
| 89 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 90 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 91 | + | return gobject.SignalConnect(x.GoPointer(), "emoji-picked", cbRefPtr) | |||
| 92 | + | } | |||
| 93 | + | ||||
| 88 | fcb := func(clsPtr uintptr, TextVarp string) { | 94 | fcb := func(clsPtr uintptr, TextVarp string) { | ||
| 89 | fa := EmojiChooser{} | 95 | fa := EmojiChooser{} | ||
| 90 | fa.Ptr = clsPtr | 96 | fa.Ptr = clsPtr | ||
| 97 | + | cbFn := *cb | |||
| 91 | 98 | ||||
| 92 | - | cb(fa, TextVarp) | 99 | + | cbFn(fa, TextVarp) |
| 93 | 100 | ||||
| 94 | } | 101 | } | ||
| 95 | - | return gobject.SignalConnect(x.GoPointer(), "emoji-picked", purego.NewCallback(fcb)) | 102 | + | cbRefPtr := purego.NewCallback(fcb) |
| 103 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 104 | + | return gobject.SignalConnect(x.GoPointer(), "emoji-picked", cbRefPtr) | |||
| 96 | } | 105 | } | ||
| 97 | 106 | ||||
| 98 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 107 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/gtk/gtkentry.go +34 -9
| @@ -8,6 +8,7 @@ import ( | |||||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | ||
| 10 | "github.com/jwijenbergh/puregotk/v4/gio" | 10 | "github.com/jwijenbergh/puregotk/v4/gio" | ||
| 11 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 11 | "github.com/jwijenbergh/puregotk/v4/gobject" | 12 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 12 | "github.com/jwijenbergh/puregotk/v4/pango" | 13 | "github.com/jwijenbergh/puregotk/v4/pango" | ||
| 13 | ) | 14 | ) | ||
| @@ -916,40 +917,64 @@ func (c *Entry) SetGoPointer(ptr uintptr) { | |||||
| 916 | // Emitted when the entry is activated. | 917 | // Emitted when the entry is activated. | ||
| 917 | // | 918 | // | ||
| 918 | // The keybindings for this signal are all forms of the Enter key. | 919 | // The keybindings for this signal are all forms of the Enter key. | ||
| 919 | - | func (x *Entry) ConnectActivate(cb func(Entry)) uint32 { | 920 | + | func (x *Entry) ConnectActivate(cb *func(Entry)) uint32 { |
| 921 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 922 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 923 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 924 | + | } | |||
| 925 | + | ||||
| 920 | fcb := func(clsPtr uintptr) { | 926 | fcb := func(clsPtr uintptr) { | ||
| 921 | fa := Entry{} | 927 | fa := Entry{} | ||
| 922 | fa.Ptr = clsPtr | 928 | fa.Ptr = clsPtr | ||
| 929 | + | cbFn := *cb | |||
| 923 | 930 | ||||
| 924 | - | cb(fa) | 931 | + | cbFn(fa) |
| 925 | 932 | ||||
| 926 | } | 933 | } | ||
| 927 | - | return gobject.SignalConnect(x.GoPointer(), "activate", purego.NewCallback(fcb)) | 934 | + | cbRefPtr := purego.NewCallback(fcb) |
| 935 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 936 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 928 | } | 937 | } | ||
| 929 | 938 | ||||
| 930 | // Emitted when an activatable icon is clicked. | 939 | // Emitted when an activatable icon is clicked. | ||
| 931 | - | func (x *Entry) ConnectIconPress(cb func(Entry, EntryIconPosition)) uint32 { | 940 | + | func (x *Entry) ConnectIconPress(cb *func(Entry, EntryIconPosition)) uint32 { |
| 941 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 942 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 943 | + | return gobject.SignalConnect(x.GoPointer(), "icon-press", cbRefPtr) | |||
| 944 | + | } | |||
| 945 | + | ||||
| 932 | fcb := func(clsPtr uintptr, IconPosVarp EntryIconPosition) { | 946 | fcb := func(clsPtr uintptr, IconPosVarp EntryIconPosition) { | ||
| 933 | fa := Entry{} | 947 | fa := Entry{} | ||
| 934 | fa.Ptr = clsPtr | 948 | fa.Ptr = clsPtr | ||
| 949 | + | cbFn := *cb | |||
| 935 | 950 | ||||
| 936 | - | cb(fa, IconPosVarp) | 951 | + | cbFn(fa, IconPosVarp) |
| 937 | 952 | ||||
| 938 | } | 953 | } | ||
| 939 | - | return gobject.SignalConnect(x.GoPointer(), "icon-press", purego.NewCallback(fcb)) | 954 | + | cbRefPtr := purego.NewCallback(fcb) |
| 955 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 956 | + | return gobject.SignalConnect(x.GoPointer(), "icon-press", cbRefPtr) | |||
| 940 | } | 957 | } | ||
| 941 | 958 | ||||
| 942 | // Emitted on the button release from a mouse click | 959 | // Emitted on the button release from a mouse click | ||
| 943 | // over an activatable icon. | 960 | // over an activatable icon. | ||
| 944 | - | func (x *Entry) ConnectIconRelease(cb func(Entry, EntryIconPosition)) uint32 { | 961 | + | func (x *Entry) ConnectIconRelease(cb *func(Entry, EntryIconPosition)) uint32 { |
| 962 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 963 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 964 | + | return gobject.SignalConnect(x.GoPointer(), "icon-release", cbRefPtr) | |||
| 965 | + | } | |||
| 966 | + | ||||
| 945 | fcb := func(clsPtr uintptr, IconPosVarp EntryIconPosition) { | 967 | fcb := func(clsPtr uintptr, IconPosVarp EntryIconPosition) { | ||
| 946 | fa := Entry{} | 968 | fa := Entry{} | ||
| 947 | fa.Ptr = clsPtr | 969 | fa.Ptr = clsPtr | ||
| 970 | + | cbFn := *cb | |||
| 948 | 971 | ||||
| 949 | - | cb(fa, IconPosVarp) | 972 | + | cbFn(fa, IconPosVarp) |
| 950 | 973 | ||||
| 951 | } | 974 | } | ||
| 952 | - | return gobject.SignalConnect(x.GoPointer(), "icon-release", purego.NewCallback(fcb)) | 975 | + | cbRefPtr := purego.NewCallback(fcb) |
| 976 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 977 | + | return gobject.SignalConnect(x.GoPointer(), "icon-release", cbRefPtr) | |||
| 953 | } | 978 | } | ||
| 954 | 979 | ||||
| 955 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 980 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/gtk/gtkentrybuffer.go +23 -6
| @@ -6,6 +6,7 @@ import ( | |||||
| 6 | 6 | ||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 9 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 10 | ) | 11 | ) | ||
| 11 | 12 | ||||
| @@ -189,27 +190,43 @@ func (c *EntryBuffer) SetGoPointer(ptr uintptr) { | |||||
| 189 | // | 190 | // | ||
| 190 | // If you want access to the text after the text has been modified, | 191 | // If you want access to the text after the text has been modified, | ||
| 191 | // use %G_CONNECT_AFTER. | 192 | // use %G_CONNECT_AFTER. | ||
| 192 | - | func (x *EntryBuffer) ConnectDeletedText(cb func(EntryBuffer, uint, uint)) uint32 { | 193 | + | func (x *EntryBuffer) ConnectDeletedText(cb *func(EntryBuffer, uint, uint)) uint32 { |
| 194 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 195 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 196 | + | return gobject.SignalConnect(x.GoPointer(), "deleted-text", cbRefPtr) | |||
| 197 | + | } | |||
| 198 | + | ||||
| 193 | fcb := func(clsPtr uintptr, PositionVarp uint, NCharsVarp uint) { | 199 | fcb := func(clsPtr uintptr, PositionVarp uint, NCharsVarp uint) { | ||
| 194 | fa := EntryBuffer{} | 200 | fa := EntryBuffer{} | ||
| 195 | fa.Ptr = clsPtr | 201 | fa.Ptr = clsPtr | ||
| 202 | + | cbFn := *cb | |||
| 196 | 203 | ||||
| 197 | - | cb(fa, PositionVarp, NCharsVarp) | 204 | + | cbFn(fa, PositionVarp, NCharsVarp) |
| 198 | 205 | ||||
| 199 | } | 206 | } | ||
| 200 | - | return gobject.SignalConnect(x.GoPointer(), "deleted-text", purego.NewCallback(fcb)) | 207 | + | cbRefPtr := purego.NewCallback(fcb) |
| 208 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 209 | + | return gobject.SignalConnect(x.GoPointer(), "deleted-text", cbRefPtr) | |||
| 201 | } | 210 | } | ||
| 202 | 211 | ||||
| 203 | // This signal is emitted after text is inserted into the buffer. | 212 | // This signal is emitted after text is inserted into the buffer. | ||
| 204 | - | func (x *EntryBuffer) ConnectInsertedText(cb func(EntryBuffer, uint, string, uint)) uint32 { | 213 | + | func (x *EntryBuffer) ConnectInsertedText(cb *func(EntryBuffer, uint, string, uint)) uint32 { |
| 214 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 215 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 216 | + | return gobject.SignalConnect(x.GoPointer(), "inserted-text", cbRefPtr) | |||
| 217 | + | } | |||
| 218 | + | ||||
| 205 | fcb := func(clsPtr uintptr, PositionVarp uint, CharsVarp string, NCharsVarp uint) { | 219 | fcb := func(clsPtr uintptr, PositionVarp uint, CharsVarp string, NCharsVarp uint) { | ||
| 206 | fa := EntryBuffer{} | 220 | fa := EntryBuffer{} | ||
| 207 | fa.Ptr = clsPtr | 221 | fa.Ptr = clsPtr | ||
| 222 | + | cbFn := *cb | |||
| 208 | 223 | ||||
| 209 | - | cb(fa, PositionVarp, CharsVarp, NCharsVarp) | 224 | + | cbFn(fa, PositionVarp, CharsVarp, NCharsVarp) |
| 210 | 225 | ||||
| 211 | } | 226 | } | ||
| 212 | - | return gobject.SignalConnect(x.GoPointer(), "inserted-text", purego.NewCallback(fcb)) | 227 | + | cbRefPtr := purego.NewCallback(fcb) |
| 228 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 229 | + | return gobject.SignalConnect(x.GoPointer(), "inserted-text", cbRefPtr) | |||
| 213 | } | 230 | } | ||
| 214 | 231 | ||||
| 215 | func init() { | 232 | func init() { | ||
M v4/gtk/gtkentrycompletion.go +50 -16
| @@ -2,6 +2,8 @@ | |||||
| 2 | package gtk | 2 | package gtk | ||
| 3 | 3 | ||||
| 4 | import ( | 4 | import ( | ||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 5 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 6 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 7 | "github.com/jwijenbergh/puregotk/v4/glib" | 9 | "github.com/jwijenbergh/puregotk/v4/glib" | ||
| @@ -274,9 +276,9 @@ var xEntryCompletionSetMatchFunc func(uintptr, uintptr, uintptr, uintptr) | |||||
| 274 | // | 276 | // | ||
| 275 | // The match function is used to determine if a row should or | 277 | // The match function is used to determine if a row should or | ||
| 276 | // should not be in the completion list. | 278 | // should not be in the completion list. | ||
| 277 | - | func (x *EntryCompletion) SetMatchFunc(FuncVar EntryCompletionMatchFunc, FuncDataVar uintptr, FuncNotifyVar glib.DestroyNotify) { | 279 | + | func (x *EntryCompletion) SetMatchFunc(FuncVar *EntryCompletionMatchFunc, FuncDataVar uintptr, FuncNotifyVar *glib.DestroyNotify) { |
| 278 | 280 | ||||
| 279 | - | xEntryCompletionSetMatchFunc(x.GoPointer(), purego.NewCallback(FuncVar), FuncDataVar, purego.NewCallback(FuncNotifyVar)) | 281 | + | xEntryCompletionSetMatchFunc(x.GoPointer(), glib.NewCallback(FuncVar), FuncDataVar, glib.NewCallback(FuncNotifyVar)) |
| 280 | 282 | ||||
| 281 | } | 283 | } | ||
| 282 | 284 | ||||
| @@ -374,15 +376,23 @@ func (c *EntryCompletion) SetGoPointer(ptr uintptr) { | |||||
| 374 | // | 376 | // | ||
| 375 | // Note that @model is the model that was passed to | 377 | // Note that @model is the model that was passed to | ||
| 376 | // [method@Gtk.EntryCompletion.set_model]. | 378 | // [method@Gtk.EntryCompletion.set_model]. | ||
| 377 | - | func (x *EntryCompletion) ConnectCursorOnMatch(cb func(EntryCompletion, uintptr, uintptr) bool) uint32 { | 379 | + | func (x *EntryCompletion) ConnectCursorOnMatch(cb *func(EntryCompletion, uintptr, uintptr) bool) uint32 { |
| 380 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 381 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 382 | + | return gobject.SignalConnect(x.GoPointer(), "cursor-on-match", cbRefPtr) | |||
| 383 | + | } | |||
| 384 | + | ||||
| 378 | fcb := func(clsPtr uintptr, ModelVarp uintptr, IterVarp uintptr) bool { | 385 | fcb := func(clsPtr uintptr, ModelVarp uintptr, IterVarp uintptr) bool { | ||
| 379 | fa := EntryCompletion{} | 386 | fa := EntryCompletion{} | ||
| 380 | fa.Ptr = clsPtr | 387 | fa.Ptr = clsPtr | ||
| 388 | + | cbFn := *cb | |||
| 381 | 389 | ||||
| 382 | - | return cb(fa, ModelVarp, IterVarp) | 390 | + | return cbFn(fa, ModelVarp, IterVarp) |
| 383 | 391 | ||||
| 384 | } | 392 | } | ||
| 385 | - | return gobject.SignalConnect(x.GoPointer(), "cursor-on-match", purego.NewCallback(fcb)) | 393 | + | cbRefPtr := purego.NewCallback(fcb) |
| 394 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 395 | + | return gobject.SignalConnect(x.GoPointer(), "cursor-on-match", cbRefPtr) | |||
| 386 | } | 396 | } | ||
| 387 | 397 | ||||
| 388 | // Emitted when the inline autocompletion is triggered. | 398 | // Emitted when the inline autocompletion is triggered. | ||
| @@ -394,15 +404,23 @@ func (x *EntryCompletion) ConnectCursorOnMatch(cb func(EntryCompletion, uintptr, | |||||
| 394 | // smaller part of the @prefix into the entry - e.g. the entry used in | 404 | // smaller part of the @prefix into the entry - e.g. the entry used in | ||
| 395 | // the `GtkFileChooser` inserts only the part of the prefix up to the | 405 | // the `GtkFileChooser` inserts only the part of the prefix up to the | ||
| 396 | // next '/'. | 406 | // next '/'. | ||
| 397 | - | func (x *EntryCompletion) ConnectInsertPrefix(cb func(EntryCompletion, string) bool) uint32 { | 407 | + | func (x *EntryCompletion) ConnectInsertPrefix(cb *func(EntryCompletion, string) bool) uint32 { |
| 408 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 409 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 410 | + | return gobject.SignalConnect(x.GoPointer(), "insert-prefix", cbRefPtr) | |||
| 411 | + | } | |||
| 412 | + | ||||
| 398 | fcb := func(clsPtr uintptr, PrefixVarp string) bool { | 413 | fcb := func(clsPtr uintptr, PrefixVarp string) bool { | ||
| 399 | fa := EntryCompletion{} | 414 | fa := EntryCompletion{} | ||
| 400 | fa.Ptr = clsPtr | 415 | fa.Ptr = clsPtr | ||
| 416 | + | cbFn := *cb | |||
| 401 | 417 | ||||
| 402 | - | return cb(fa, PrefixVarp) | 418 | + | return cbFn(fa, PrefixVarp) |
| 403 | 419 | ||||
| 404 | } | 420 | } | ||
| 405 | - | return gobject.SignalConnect(x.GoPointer(), "insert-prefix", purego.NewCallback(fcb)) | 421 | + | cbRefPtr := purego.NewCallback(fcb) |
| 422 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 423 | + | return gobject.SignalConnect(x.GoPointer(), "insert-prefix", cbRefPtr) | |||
| 406 | } | 424 | } | ||
| 407 | 425 | ||||
| 408 | // Emitted when a match from the list is selected. | 426 | // Emitted when a match from the list is selected. | ||
| @@ -413,30 +431,46 @@ func (x *EntryCompletion) ConnectInsertPrefix(cb func(EntryCompletion, string) b | |||||
| 413 | // | 431 | // | ||
| 414 | // Note that @model is the model that was passed to | 432 | // Note that @model is the model that was passed to | ||
| 415 | // [method@Gtk.EntryCompletion.set_model]. | 433 | // [method@Gtk.EntryCompletion.set_model]. | ||
| 416 | - | func (x *EntryCompletion) ConnectMatchSelected(cb func(EntryCompletion, uintptr, uintptr) bool) uint32 { | 434 | + | func (x *EntryCompletion) ConnectMatchSelected(cb *func(EntryCompletion, uintptr, uintptr) bool) uint32 { |
| 435 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 436 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 437 | + | return gobject.SignalConnect(x.GoPointer(), "match-selected", cbRefPtr) | |||
| 438 | + | } | |||
| 439 | + | ||||
| 417 | fcb := func(clsPtr uintptr, ModelVarp uintptr, IterVarp uintptr) bool { | 440 | fcb := func(clsPtr uintptr, ModelVarp uintptr, IterVarp uintptr) bool { | ||
| 418 | fa := EntryCompletion{} | 441 | fa := EntryCompletion{} | ||
| 419 | fa.Ptr = clsPtr | 442 | fa.Ptr = clsPtr | ||
| 443 | + | cbFn := *cb | |||
| 420 | 444 | ||||
| 421 | - | return cb(fa, ModelVarp, IterVarp) | 445 | + | return cbFn(fa, ModelVarp, IterVarp) |
| 422 | 446 | ||||
| 423 | } | 447 | } | ||
| 424 | - | return gobject.SignalConnect(x.GoPointer(), "match-selected", purego.NewCallback(fcb)) | 448 | + | cbRefPtr := purego.NewCallback(fcb) |
| 449 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 450 | + | return gobject.SignalConnect(x.GoPointer(), "match-selected", cbRefPtr) | |||
| 425 | } | 451 | } | ||
| 426 | 452 | ||||
| 427 | // Emitted when the filter model has zero | 453 | // Emitted when the filter model has zero | ||
| 428 | // number of rows in completion_complete method. | 454 | // number of rows in completion_complete method. | ||
| 429 | // | 455 | // | ||
| 430 | // In other words when `GtkEntryCompletion` is out of suggestions. | 456 | // In other words when `GtkEntryCompletion` is out of suggestions. | ||
| 431 | - | func (x *EntryCompletion) ConnectNoMatches(cb func(EntryCompletion)) uint32 { | 457 | + | func (x *EntryCompletion) ConnectNoMatches(cb *func(EntryCompletion)) uint32 { |
| 458 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 459 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 460 | + | return gobject.SignalConnect(x.GoPointer(), "no-matches", cbRefPtr) | |||
| 461 | + | } | |||
| 462 | + | ||||
| 432 | fcb := func(clsPtr uintptr) { | 463 | fcb := func(clsPtr uintptr) { | ||
| 433 | fa := EntryCompletion{} | 464 | fa := EntryCompletion{} | ||
| 434 | fa.Ptr = clsPtr | 465 | fa.Ptr = clsPtr | ||
| 466 | + | cbFn := *cb | |||
| 435 | 467 | ||||
| 436 | - | cb(fa) | 468 | + | cbFn(fa) |
| 437 | 469 | ||||
| 438 | } | 470 | } | ||
| 439 | - | return gobject.SignalConnect(x.GoPointer(), "no-matches", purego.NewCallback(fcb)) | 471 | + | cbRefPtr := purego.NewCallback(fcb) |
| 472 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 473 | + | return gobject.SignalConnect(x.GoPointer(), "no-matches", cbRefPtr) | |||
| 440 | } | 474 | } | ||
| 441 | 475 | ||||
| 442 | // Gets the ID of the @buildable object. | 476 | // Gets the ID of the @buildable object. | ||
| @@ -555,9 +589,9 @@ func (x *EntryCompletion) SetAttributes(CellVar *CellRenderer, varArgs ...interf | |||||
| 555 | // cell renderer(s) as appropriate. | 589 | // cell renderer(s) as appropriate. | ||
| 556 | // | 590 | // | ||
| 557 | // @func may be %NULL to remove a previously set function. | 591 | // @func may be %NULL to remove a previously set function. | ||
| 558 | - | func (x *EntryCompletion) SetCellDataFunc(CellVar *CellRenderer, FuncVar CellLayoutDataFunc, FuncDataVar uintptr, DestroyVar glib.DestroyNotify) { | 592 | + | func (x *EntryCompletion) SetCellDataFunc(CellVar *CellRenderer, FuncVar *CellLayoutDataFunc, FuncDataVar uintptr, DestroyVar *glib.DestroyNotify) { |
| 559 | 593 | ||||
| 560 | - | XGtkCellLayoutSetCellDataFunc(x.GoPointer(), CellVar.GoPointer(), purego.NewCallback(FuncVar), FuncDataVar, purego.NewCallback(DestroyVar)) | 594 | + | XGtkCellLayoutSetCellDataFunc(x.GoPointer(), CellVar.GoPointer(), glib.NewCallback(FuncVar), FuncDataVar, glib.NewCallback(DestroyVar)) |
| 561 | 595 | ||||
| 562 | } | 596 | } | ||
| 563 | 597 | ||||
M v4/gtk/gtkeventcontrollerfocus.go +23 -6
| @@ -6,6 +6,7 @@ import ( | |||||
| 6 | 6 | ||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 9 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 10 | ) | 11 | ) | ||
| 11 | 12 | ||||
| @@ -87,15 +88,23 @@ func (c *EventControllerFocus) SetGoPointer(ptr uintptr) { | |||||
| 87 | // in these cases, you can monitor the | 88 | // in these cases, you can monitor the | ||
| 88 | // [property@Gtk.EventControllerFocus:is-focus] | 89 | // [property@Gtk.EventControllerFocus:is-focus] | ||
| 89 | // property for changes. | 90 | // property for changes. | ||
| 90 | - | func (x *EventControllerFocus) ConnectEnter(cb func(EventControllerFocus)) uint32 { | 91 | + | func (x *EventControllerFocus) ConnectEnter(cb *func(EventControllerFocus)) uint32 { |
| 92 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 93 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 94 | + | return gobject.SignalConnect(x.GoPointer(), "enter", cbRefPtr) | |||
| 95 | + | } | |||
| 96 | + | ||||
| 91 | fcb := func(clsPtr uintptr) { | 97 | fcb := func(clsPtr uintptr) { | ||
| 92 | fa := EventControllerFocus{} | 98 | fa := EventControllerFocus{} | ||
| 93 | fa.Ptr = clsPtr | 99 | fa.Ptr = clsPtr | ||
| 100 | + | cbFn := *cb | |||
| 94 | 101 | ||||
| 95 | - | cb(fa) | 102 | + | cbFn(fa) |
| 96 | 103 | ||||
| 97 | } | 104 | } | ||
| 98 | - | return gobject.SignalConnect(x.GoPointer(), "enter", purego.NewCallback(fcb)) | 105 | + | cbRefPtr := purego.NewCallback(fcb) |
| 106 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 107 | + | return gobject.SignalConnect(x.GoPointer(), "enter", cbRefPtr) | |||
| 99 | } | 108 | } | ||
| 100 | 109 | ||||
| 101 | // Emitted whenever the focus leaves the widget hierarchy | 110 | // Emitted whenever the focus leaves the widget hierarchy | ||
| @@ -107,15 +116,23 @@ func (x *EventControllerFocus) ConnectEnter(cb func(EventControllerFocus)) uint3 | |||||
| 107 | // to a descendent). If you are interested in these cases, you | 116 | // to a descendent). If you are interested in these cases, you | ||
| 108 | // can monitor the [property@Gtk.EventControllerFocus:is-focus] | 117 | // can monitor the [property@Gtk.EventControllerFocus:is-focus] | ||
| 109 | // property for changes. | 118 | // property for changes. | ||
| 110 | - | func (x *EventControllerFocus) ConnectLeave(cb func(EventControllerFocus)) uint32 { | 119 | + | func (x *EventControllerFocus) ConnectLeave(cb *func(EventControllerFocus)) uint32 { |
| 120 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 121 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 122 | + | return gobject.SignalConnect(x.GoPointer(), "leave", cbRefPtr) | |||
| 123 | + | } | |||
| 124 | + | ||||
| 111 | fcb := func(clsPtr uintptr) { | 125 | fcb := func(clsPtr uintptr) { | ||
| 112 | fa := EventControllerFocus{} | 126 | fa := EventControllerFocus{} | ||
| 113 | fa.Ptr = clsPtr | 127 | fa.Ptr = clsPtr | ||
| 128 | + | cbFn := *cb | |||
| 114 | 129 | ||||
| 115 | - | cb(fa) | 130 | + | cbFn(fa) |
| 116 | 131 | ||||
| 117 | } | 132 | } | ||
| 118 | - | return gobject.SignalConnect(x.GoPointer(), "leave", purego.NewCallback(fcb)) | 133 | + | cbRefPtr := purego.NewCallback(fcb) |
| 134 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 135 | + | return gobject.SignalConnect(x.GoPointer(), "leave", cbRefPtr) | |||
| 119 | } | 136 | } | ||
| 120 | 137 | ||||
| 121 | func init() { | 138 | func init() { | ||
M v4/gtk/gtkeventcontrollerkey.go +45 -12
| @@ -7,6 +7,7 @@ import ( | |||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | ||
| 10 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | 11 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 11 | ) | 12 | ) | ||
| 12 | 13 | ||||
| @@ -109,51 +110,83 @@ func (c *EventControllerKey) SetGoPointer(ptr uintptr) { | |||||
| 109 | // | 110 | // | ||
| 110 | // See [method@Gtk.EventControllerKey.set_im_context] and | 111 | // See [method@Gtk.EventControllerKey.set_im_context] and | ||
| 111 | // [method@Gtk.IMContext.filter_keypress]. | 112 | // [method@Gtk.IMContext.filter_keypress]. | ||
| 112 | - | func (x *EventControllerKey) ConnectImUpdate(cb func(EventControllerKey)) uint32 { | 113 | + | func (x *EventControllerKey) ConnectImUpdate(cb *func(EventControllerKey)) uint32 { |
| 114 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 115 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 116 | + | return gobject.SignalConnect(x.GoPointer(), "im-update", cbRefPtr) | |||
| 117 | + | } | |||
| 118 | + | ||||
| 113 | fcb := func(clsPtr uintptr) { | 119 | fcb := func(clsPtr uintptr) { | ||
| 114 | fa := EventControllerKey{} | 120 | fa := EventControllerKey{} | ||
| 115 | fa.Ptr = clsPtr | 121 | fa.Ptr = clsPtr | ||
| 122 | + | cbFn := *cb | |||
| 116 | 123 | ||||
| 117 | - | cb(fa) | 124 | + | cbFn(fa) |
| 118 | 125 | ||||
| 119 | } | 126 | } | ||
| 120 | - | return gobject.SignalConnect(x.GoPointer(), "im-update", purego.NewCallback(fcb)) | 127 | + | cbRefPtr := purego.NewCallback(fcb) |
| 128 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 129 | + | return gobject.SignalConnect(x.GoPointer(), "im-update", cbRefPtr) | |||
| 121 | } | 130 | } | ||
| 122 | 131 | ||||
| 123 | // Emitted whenever a key is pressed. | 132 | // Emitted whenever a key is pressed. | ||
| 124 | - | func (x *EventControllerKey) ConnectKeyPressed(cb func(EventControllerKey, uint, uint, gdk.ModifierType) bool) uint32 { | 133 | + | func (x *EventControllerKey) ConnectKeyPressed(cb *func(EventControllerKey, uint, uint, gdk.ModifierType) bool) uint32 { |
| 134 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 135 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 136 | + | return gobject.SignalConnect(x.GoPointer(), "key-pressed", cbRefPtr) | |||
| 137 | + | } | |||
| 138 | + | ||||
| 125 | fcb := func(clsPtr uintptr, KeyvalVarp uint, KeycodeVarp uint, StateVarp gdk.ModifierType) bool { | 139 | fcb := func(clsPtr uintptr, KeyvalVarp uint, KeycodeVarp uint, StateVarp gdk.ModifierType) bool { | ||
| 126 | fa := EventControllerKey{} | 140 | fa := EventControllerKey{} | ||
| 127 | fa.Ptr = clsPtr | 141 | fa.Ptr = clsPtr | ||
| 142 | + | cbFn := *cb | |||
| 128 | 143 | ||||
| 129 | - | return cb(fa, KeyvalVarp, KeycodeVarp, StateVarp) | 144 | + | return cbFn(fa, KeyvalVarp, KeycodeVarp, StateVarp) |
| 130 | 145 | ||||
| 131 | } | 146 | } | ||
| 132 | - | return gobject.SignalConnect(x.GoPointer(), "key-pressed", purego.NewCallback(fcb)) | 147 | + | cbRefPtr := purego.NewCallback(fcb) |
| 148 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 149 | + | return gobject.SignalConnect(x.GoPointer(), "key-pressed", cbRefPtr) | |||
| 133 | } | 150 | } | ||
| 134 | 151 | ||||
| 135 | // Emitted whenever a key is released. | 152 | // Emitted whenever a key is released. | ||
| 136 | - | func (x *EventControllerKey) ConnectKeyReleased(cb func(EventControllerKey, uint, uint, gdk.ModifierType)) uint32 { | 153 | + | func (x *EventControllerKey) ConnectKeyReleased(cb *func(EventControllerKey, uint, uint, gdk.ModifierType)) uint32 { |
| 154 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 155 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 156 | + | return gobject.SignalConnect(x.GoPointer(), "key-released", cbRefPtr) | |||
| 157 | + | } | |||
| 158 | + | ||||
| 137 | fcb := func(clsPtr uintptr, KeyvalVarp uint, KeycodeVarp uint, StateVarp gdk.ModifierType) { | 159 | fcb := func(clsPtr uintptr, KeyvalVarp uint, KeycodeVarp uint, StateVarp gdk.ModifierType) { | ||
| 138 | fa := EventControllerKey{} | 160 | fa := EventControllerKey{} | ||
| 139 | fa.Ptr = clsPtr | 161 | fa.Ptr = clsPtr | ||
| 162 | + | cbFn := *cb | |||
| 140 | 163 | ||||
| 141 | - | cb(fa, KeyvalVarp, KeycodeVarp, StateVarp) | 164 | + | cbFn(fa, KeyvalVarp, KeycodeVarp, StateVarp) |
| 142 | 165 | ||||
| 143 | } | 166 | } | ||
| 144 | - | return gobject.SignalConnect(x.GoPointer(), "key-released", purego.NewCallback(fcb)) | 167 | + | cbRefPtr := purego.NewCallback(fcb) |
| 168 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 169 | + | return gobject.SignalConnect(x.GoPointer(), "key-released", cbRefPtr) | |||
| 145 | } | 170 | } | ||
| 146 | 171 | ||||
| 147 | // Emitted whenever the state of modifier keys and pointer buttons change. | 172 | // Emitted whenever the state of modifier keys and pointer buttons change. | ||
| 148 | - | func (x *EventControllerKey) ConnectModifiers(cb func(EventControllerKey, gdk.ModifierType) bool) uint32 { | 173 | + | func (x *EventControllerKey) ConnectModifiers(cb *func(EventControllerKey, gdk.ModifierType) bool) uint32 { |
| 174 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 175 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 176 | + | return gobject.SignalConnect(x.GoPointer(), "modifiers", cbRefPtr) | |||
| 177 | + | } | |||
| 178 | + | ||||
| 149 | fcb := func(clsPtr uintptr, KeyvalVarp gdk.ModifierType) bool { | 179 | fcb := func(clsPtr uintptr, KeyvalVarp gdk.ModifierType) bool { | ||
| 150 | fa := EventControllerKey{} | 180 | fa := EventControllerKey{} | ||
| 151 | fa.Ptr = clsPtr | 181 | fa.Ptr = clsPtr | ||
| 182 | + | cbFn := *cb | |||
| 152 | 183 | ||||
| 153 | - | return cb(fa, KeyvalVarp) | 184 | + | return cbFn(fa, KeyvalVarp) |
| 154 | 185 | ||||
| 155 | } | 186 | } | ||
| 156 | - | return gobject.SignalConnect(x.GoPointer(), "modifiers", purego.NewCallback(fcb)) | 187 | + | cbRefPtr := purego.NewCallback(fcb) |
| 188 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 189 | + | return gobject.SignalConnect(x.GoPointer(), "modifiers", cbRefPtr) | |||
| 157 | } | 190 | } | ||
| 158 | 191 | ||||
| 159 | func init() { | 192 | func init() { | ||
M v4/gtk/gtkeventcontrollerlegacy.go +12 -3
| @@ -6,6 +6,7 @@ import ( | |||||
| 6 | 6 | ||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 9 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 10 | ) | 11 | ) | ||
| 11 | 12 | ||||
| @@ -56,15 +57,23 @@ func (c *EventControllerLegacy) SetGoPointer(ptr uintptr) { | |||||
| 56 | } | 57 | } | ||
| 57 | 58 | ||||
| 58 | // Emitted for each GDK event delivered to @controller. | 59 | // Emitted for each GDK event delivered to @controller. | ||
| 59 | - | func (x *EventControllerLegacy) ConnectEvent(cb func(EventControllerLegacy, uintptr) bool) uint32 { | 60 | + | func (x *EventControllerLegacy) ConnectEvent(cb *func(EventControllerLegacy, uintptr) bool) uint32 { |
| 61 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 62 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 63 | + | return gobject.SignalConnect(x.GoPointer(), "event", cbRefPtr) | |||
| 64 | + | } | |||
| 65 | + | ||||
| 60 | fcb := func(clsPtr uintptr, EventVarp uintptr) bool { | 66 | fcb := func(clsPtr uintptr, EventVarp uintptr) bool { | ||
| 61 | fa := EventControllerLegacy{} | 67 | fa := EventControllerLegacy{} | ||
| 62 | fa.Ptr = clsPtr | 68 | fa.Ptr = clsPtr | ||
| 69 | + | cbFn := *cb | |||
| 63 | 70 | ||||
| 64 | - | return cb(fa, EventVarp) | 71 | + | return cbFn(fa, EventVarp) |
| 65 | 72 | ||||
| 66 | } | 73 | } | ||
| 67 | - | return gobject.SignalConnect(x.GoPointer(), "event", purego.NewCallback(fcb)) | 74 | + | cbRefPtr := purego.NewCallback(fcb) |
| 75 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 76 | + | return gobject.SignalConnect(x.GoPointer(), "event", cbRefPtr) | |||
| 68 | } | 77 | } | ||
| 69 | 78 | ||||
| 70 | func init() { | 79 | func init() { | ||
M v4/gtk/gtkeventcontrollermotion.go +34 -9
| @@ -6,6 +6,7 @@ import ( | |||||
| 6 | 6 | ||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 9 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 10 | ) | 11 | ) | ||
| 11 | 12 | ||||
| @@ -78,39 +79,63 @@ func (c *EventControllerMotion) SetGoPointer(ptr uintptr) { | |||||
| 78 | } | 79 | } | ||
| 79 | 80 | ||||
| 80 | // Signals that the pointer has entered the widget. | 81 | // Signals that the pointer has entered the widget. | ||
| 81 | - | func (x *EventControllerMotion) ConnectEnter(cb func(EventControllerMotion, float64, float64)) uint32 { | 82 | + | func (x *EventControllerMotion) ConnectEnter(cb *func(EventControllerMotion, float64, float64)) uint32 { |
| 83 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 84 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 85 | + | return gobject.SignalConnect(x.GoPointer(), "enter", cbRefPtr) | |||
| 86 | + | } | |||
| 87 | + | ||||
| 82 | fcb := func(clsPtr uintptr, XVarp float64, YVarp float64) { | 88 | fcb := func(clsPtr uintptr, XVarp float64, YVarp float64) { | ||
| 83 | fa := EventControllerMotion{} | 89 | fa := EventControllerMotion{} | ||
| 84 | fa.Ptr = clsPtr | 90 | fa.Ptr = clsPtr | ||
| 91 | + | cbFn := *cb | |||
| 85 | 92 | ||||
| 86 | - | cb(fa, XVarp, YVarp) | 93 | + | cbFn(fa, XVarp, YVarp) |
| 87 | 94 | ||||
| 88 | } | 95 | } | ||
| 89 | - | return gobject.SignalConnect(x.GoPointer(), "enter", purego.NewCallback(fcb)) | 96 | + | cbRefPtr := purego.NewCallback(fcb) |
| 97 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 98 | + | return gobject.SignalConnect(x.GoPointer(), "enter", cbRefPtr) | |||
| 90 | } | 99 | } | ||
| 91 | 100 | ||||
| 92 | // Signals that the pointer has left the widget. | 101 | // Signals that the pointer has left the widget. | ||
| 93 | - | func (x *EventControllerMotion) ConnectLeave(cb func(EventControllerMotion)) uint32 { | 102 | + | func (x *EventControllerMotion) ConnectLeave(cb *func(EventControllerMotion)) uint32 { |
| 103 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 104 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 105 | + | return gobject.SignalConnect(x.GoPointer(), "leave", cbRefPtr) | |||
| 106 | + | } | |||
| 107 | + | ||||
| 94 | fcb := func(clsPtr uintptr) { | 108 | fcb := func(clsPtr uintptr) { | ||
| 95 | fa := EventControllerMotion{} | 109 | fa := EventControllerMotion{} | ||
| 96 | fa.Ptr = clsPtr | 110 | fa.Ptr = clsPtr | ||
| 111 | + | cbFn := *cb | |||
| 97 | 112 | ||||
| 98 | - | cb(fa) | 113 | + | cbFn(fa) |
| 99 | 114 | ||||
| 100 | } | 115 | } | ||
| 101 | - | return gobject.SignalConnect(x.GoPointer(), "leave", purego.NewCallback(fcb)) | 116 | + | cbRefPtr := purego.NewCallback(fcb) |
| 117 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 118 | + | return gobject.SignalConnect(x.GoPointer(), "leave", cbRefPtr) | |||
| 102 | } | 119 | } | ||
| 103 | 120 | ||||
| 104 | // Emitted when the pointer moves inside the widget. | 121 | // Emitted when the pointer moves inside the widget. | ||
| 105 | - | func (x *EventControllerMotion) ConnectMotion(cb func(EventControllerMotion, float64, float64)) uint32 { | 122 | + | func (x *EventControllerMotion) ConnectMotion(cb *func(EventControllerMotion, float64, float64)) uint32 { |
| 123 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 124 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 125 | + | return gobject.SignalConnect(x.GoPointer(), "motion", cbRefPtr) | |||
| 126 | + | } | |||
| 127 | + | ||||
| 106 | fcb := func(clsPtr uintptr, XVarp float64, YVarp float64) { | 128 | fcb := func(clsPtr uintptr, XVarp float64, YVarp float64) { | ||
| 107 | fa := EventControllerMotion{} | 129 | fa := EventControllerMotion{} | ||
| 108 | fa.Ptr = clsPtr | 130 | fa.Ptr = clsPtr | ||
| 131 | + | cbFn := *cb | |||
| 109 | 132 | ||||
| 110 | - | cb(fa, XVarp, YVarp) | 133 | + | cbFn(fa, XVarp, YVarp) |
| 111 | 134 | ||||
| 112 | } | 135 | } | ||
| 113 | - | return gobject.SignalConnect(x.GoPointer(), "motion", purego.NewCallback(fcb)) | 136 | + | cbRefPtr := purego.NewCallback(fcb) |
| 137 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 138 | + | return gobject.SignalConnect(x.GoPointer(), "motion", cbRefPtr) | |||
| 114 | } | 139 | } | ||
| 115 | 140 | ||||
| 116 | func init() { | 141 | func init() { | ||
M v4/gtk/gtkeventcontrollerscroll.go +45 -12
| @@ -7,6 +7,7 @@ import ( | |||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | ||
| 10 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | 11 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 11 | ) | 12 | ) | ||
| 12 | 13 | ||||
| @@ -141,15 +142,23 @@ func (c *EventControllerScroll) SetGoPointer(ptr uintptr) { | |||||
| 141 | // @vel_x and @vel_y express the initial velocity that was | 142 | // @vel_x and @vel_y express the initial velocity that was | ||
| 142 | // imprinted by the scroll events. @vel_x and @vel_y are expressed in | 143 | // imprinted by the scroll events. @vel_x and @vel_y are expressed in | ||
| 143 | // pixels/ms. | 144 | // pixels/ms. | ||
| 144 | - | func (x *EventControllerScroll) ConnectDecelerate(cb func(EventControllerScroll, float64, float64)) uint32 { | 145 | + | func (x *EventControllerScroll) ConnectDecelerate(cb *func(EventControllerScroll, float64, float64)) uint32 { |
| 146 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 147 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 148 | + | return gobject.SignalConnect(x.GoPointer(), "decelerate", cbRefPtr) | |||
| 149 | + | } | |||
| 150 | + | ||||
| 145 | fcb := func(clsPtr uintptr, VelXVarp float64, VelYVarp float64) { | 151 | fcb := func(clsPtr uintptr, VelXVarp float64, VelYVarp float64) { | ||
| 146 | fa := EventControllerScroll{} | 152 | fa := EventControllerScroll{} | ||
| 147 | fa.Ptr = clsPtr | 153 | fa.Ptr = clsPtr | ||
| 154 | + | cbFn := *cb | |||
| 148 | 155 | ||||
| 149 | - | cb(fa, VelXVarp, VelYVarp) | 156 | + | cbFn(fa, VelXVarp, VelYVarp) |
| 150 | 157 | ||||
| 151 | } | 158 | } | ||
| 152 | - | return gobject.SignalConnect(x.GoPointer(), "decelerate", purego.NewCallback(fcb)) | 159 | + | cbRefPtr := purego.NewCallback(fcb) |
| 160 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 161 | + | return gobject.SignalConnect(x.GoPointer(), "decelerate", cbRefPtr) | |||
| 153 | } | 162 | } | ||
| 154 | 163 | ||||
| 155 | // Signals that the widget should scroll by the | 164 | // Signals that the widget should scroll by the | ||
| @@ -157,43 +166,67 @@ func (x *EventControllerScroll) ConnectDecelerate(cb func(EventControllerScroll, | |||||
| 157 | // | 166 | // | ||
| 158 | // For the representation unit of the deltas, see | 167 | // For the representation unit of the deltas, see | ||
| 159 | // [method@Gtk.EventControllerScroll.get_unit]. | 168 | // [method@Gtk.EventControllerScroll.get_unit]. | ||
| 160 | - | func (x *EventControllerScroll) ConnectScroll(cb func(EventControllerScroll, float64, float64) bool) uint32 { | 169 | + | func (x *EventControllerScroll) ConnectScroll(cb *func(EventControllerScroll, float64, float64) bool) uint32 { |
| 170 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 171 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 172 | + | return gobject.SignalConnect(x.GoPointer(), "scroll", cbRefPtr) | |||
| 173 | + | } | |||
| 174 | + | ||||
| 161 | fcb := func(clsPtr uintptr, DxVarp float64, DyVarp float64) bool { | 175 | fcb := func(clsPtr uintptr, DxVarp float64, DyVarp float64) bool { | ||
| 162 | fa := EventControllerScroll{} | 176 | fa := EventControllerScroll{} | ||
| 163 | fa.Ptr = clsPtr | 177 | fa.Ptr = clsPtr | ||
| 178 | + | cbFn := *cb | |||
| 164 | 179 | ||||
| 165 | - | return cb(fa, DxVarp, DyVarp) | 180 | + | return cbFn(fa, DxVarp, DyVarp) |
| 166 | 181 | ||||
| 167 | } | 182 | } | ||
| 168 | - | return gobject.SignalConnect(x.GoPointer(), "scroll", purego.NewCallback(fcb)) | 183 | + | cbRefPtr := purego.NewCallback(fcb) |
| 184 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 185 | + | return gobject.SignalConnect(x.GoPointer(), "scroll", cbRefPtr) | |||
| 169 | } | 186 | } | ||
| 170 | 187 | ||||
| 171 | // Signals that a new scrolling operation has begun. | 188 | // Signals that a new scrolling operation has begun. | ||
| 172 | // | 189 | // | ||
| 173 | // It will only be emitted on devices capable of it. | 190 | // It will only be emitted on devices capable of it. | ||
| 174 | - | func (x *EventControllerScroll) ConnectScrollBegin(cb func(EventControllerScroll)) uint32 { | 191 | + | func (x *EventControllerScroll) ConnectScrollBegin(cb *func(EventControllerScroll)) uint32 { |
| 192 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 193 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 194 | + | return gobject.SignalConnect(x.GoPointer(), "scroll-begin", cbRefPtr) | |||
| 195 | + | } | |||
| 196 | + | ||||
| 175 | fcb := func(clsPtr uintptr) { | 197 | fcb := func(clsPtr uintptr) { | ||
| 176 | fa := EventControllerScroll{} | 198 | fa := EventControllerScroll{} | ||
| 177 | fa.Ptr = clsPtr | 199 | fa.Ptr = clsPtr | ||
| 200 | + | cbFn := *cb | |||
| 178 | 201 | ||||
| 179 | - | cb(fa) | 202 | + | cbFn(fa) |
| 180 | 203 | ||||
| 181 | } | 204 | } | ||
| 182 | - | return gobject.SignalConnect(x.GoPointer(), "scroll-begin", purego.NewCallback(fcb)) | 205 | + | cbRefPtr := purego.NewCallback(fcb) |
| 206 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 207 | + | return gobject.SignalConnect(x.GoPointer(), "scroll-begin", cbRefPtr) | |||
| 183 | } | 208 | } | ||
| 184 | 209 | ||||
| 185 | // Signals that a scrolling operation has finished. | 210 | // Signals that a scrolling operation has finished. | ||
| 186 | // | 211 | // | ||
| 187 | // It will only be emitted on devices capable of it. | 212 | // It will only be emitted on devices capable of it. | ||
| 188 | - | func (x *EventControllerScroll) ConnectScrollEnd(cb func(EventControllerScroll)) uint32 { | 213 | + | func (x *EventControllerScroll) ConnectScrollEnd(cb *func(EventControllerScroll)) uint32 { |
| 214 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 215 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 216 | + | return gobject.SignalConnect(x.GoPointer(), "scroll-end", cbRefPtr) | |||
| 217 | + | } | |||
| 218 | + | ||||
| 189 | fcb := func(clsPtr uintptr) { | 219 | fcb := func(clsPtr uintptr) { | ||
| 190 | fa := EventControllerScroll{} | 220 | fa := EventControllerScroll{} | ||
| 191 | fa.Ptr = clsPtr | 221 | fa.Ptr = clsPtr | ||
| 222 | + | cbFn := *cb | |||
| 192 | 223 | ||||
| 193 | - | cb(fa) | 224 | + | cbFn(fa) |
| 194 | 225 | ||||
| 195 | } | 226 | } | ||
| 196 | - | return gobject.SignalConnect(x.GoPointer(), "scroll-end", purego.NewCallback(fcb)) | 227 | + | cbRefPtr := purego.NewCallback(fcb) |
| 228 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 229 | + | return gobject.SignalConnect(x.GoPointer(), "scroll-end", cbRefPtr) | |||
| 197 | } | 230 | } | ||
| 198 | 231 | ||||
| 199 | func init() { | 232 | func init() { | ||
M v4/gtk/gtkexpander.go +14 -3
| @@ -2,8 +2,11 @@ | |||||
| 2 | package gtk | 2 | package gtk | ||
| 3 | 3 | ||||
| 4 | import ( | 4 | import ( | ||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 5 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 6 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 7 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 8 | ) | 11 | ) | ||
| 9 | 12 | ||||
| @@ -326,15 +329,23 @@ func (c *Expander) SetGoPointer(ptr uintptr) { | |||||
| 326 | } | 329 | } | ||
| 327 | 330 | ||||
| 328 | // Activates the `GtkExpander`. | 331 | // Activates the `GtkExpander`. | ||
| 329 | - | func (x *Expander) ConnectActivate(cb func(Expander)) uint32 { | 332 | + | func (x *Expander) ConnectActivate(cb *func(Expander)) uint32 { |
| 333 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 334 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 335 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 336 | + | } | |||
| 337 | + | ||||
| 330 | fcb := func(clsPtr uintptr) { | 338 | fcb := func(clsPtr uintptr) { | ||
| 331 | fa := Expander{} | 339 | fa := Expander{} | ||
| 332 | fa.Ptr = clsPtr | 340 | fa.Ptr = clsPtr | ||
| 341 | + | cbFn := *cb | |||
| 333 | 342 | ||||
| 334 | - | cb(fa) | 343 | + | cbFn(fa) |
| 335 | 344 | ||||
| 336 | } | 345 | } | ||
| 337 | - | return gobject.SignalConnect(x.GoPointer(), "activate", purego.NewCallback(fcb)) | 346 | + | cbRefPtr := purego.NewCallback(fcb) |
| 347 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 348 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 338 | } | 349 | } | ||
| 339 | 350 | ||||
| 340 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 351 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/gtk/gtkexpression.go +4 -4
| @@ -163,10 +163,10 @@ var xNewCClosureExpression func([]interface{}, uintptr, uint, uintptr, uintptr, | |||||
| 163 | // This function is a variant of [ctor@Gtk.ClosureExpression.new] that | 163 | // This function is a variant of [ctor@Gtk.ClosureExpression.new] that | ||
| 164 | // creates a `GClosure` by calling g_cclosure_new() with the given | 164 | // creates a `GClosure` by calling g_cclosure_new() with the given | ||
| 165 | // `callback_func`, `user_data` and `user_destroy`. | 165 | // `callback_func`, `user_data` and `user_destroy`. | ||
| 166 | - | func NewCClosureExpression(ValueTypeVar []interface{}, MarshalVar gobject.ClosureMarshal, NParamsVar uint, ParamsVar uintptr, CallbackFuncVar gobject.Callback, UserDataVar uintptr, UserDestroyVar gobject.ClosureNotify) *CClosureExpression { | 166 | + | func NewCClosureExpression(ValueTypeVar []interface{}, MarshalVar *gobject.ClosureMarshal, NParamsVar uint, ParamsVar uintptr, CallbackFuncVar *gobject.Callback, UserDataVar uintptr, UserDestroyVar *gobject.ClosureNotify) *CClosureExpression { |
| 167 | var cls *CClosureExpression | 167 | var cls *CClosureExpression | ||
| 168 | 168 | ||||
| 169 | - | cret := xNewCClosureExpression(ValueTypeVar, purego.NewCallback(MarshalVar), NParamsVar, ParamsVar, purego.NewCallback(CallbackFuncVar), UserDataVar, purego.NewCallback(UserDestroyVar)) | 169 | + | cret := xNewCClosureExpression(ValueTypeVar, glib.NewCallback(MarshalVar), NParamsVar, ParamsVar, glib.NewCallback(CallbackFuncVar), UserDataVar, glib.NewCallback(UserDestroyVar)) |
| 170 | 170 | ||||
| 171 | if cret == 0 { | 171 | if cret == 0 { | ||
| 172 | return nil | 172 | return nil | ||
| @@ -538,9 +538,9 @@ var xExpressionWatch func(uintptr, uintptr, uintptr, uintptr, uintptr) *Expressi | |||||
| 538 | // GTK cannot guarantee that the evaluation did indeed change when the @notify | 538 | // GTK cannot guarantee that the evaluation did indeed change when the @notify | ||
| 539 | // gets invoked, but it guarantees the opposite: When it did in fact change, | 539 | // gets invoked, but it guarantees the opposite: When it did in fact change, | ||
| 540 | // the @notify will be invoked. | 540 | // the @notify will be invoked. | ||
| 541 | - | func (x *Expression) Watch(ThisVar *gobject.Object, NotifyVar ExpressionNotify, UserDataVar uintptr, UserDestroyVar glib.DestroyNotify) *ExpressionWatch { | 541 | + | func (x *Expression) Watch(ThisVar *gobject.Object, NotifyVar *ExpressionNotify, UserDataVar uintptr, UserDestroyVar *glib.DestroyNotify) *ExpressionWatch { |
| 542 | 542 | ||||
| 543 | - | cret := xExpressionWatch(x.GoPointer(), ThisVar.GoPointer(), purego.NewCallback(NotifyVar), UserDataVar, purego.NewCallback(UserDestroyVar)) | 543 | + | cret := xExpressionWatch(x.GoPointer(), ThisVar.GoPointer(), glib.NewCallback(NotifyVar), UserDataVar, glib.NewCallback(UserDestroyVar)) |
| 544 | return cret | 544 | return cret | ||
| 545 | } | 545 | } | ||
| 546 | 546 | ||||
M v4/gtk/gtkfilechooserwidget.go +134 -36
| @@ -2,6 +2,8 @@ | |||||
| 2 | package gtk | 2 | package gtk | ||
| 3 | 3 | ||||
| 4 | import ( | 4 | import ( | ||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 5 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 6 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 7 | "github.com/jwijenbergh/puregotk/v4/gio" | 9 | "github.com/jwijenbergh/puregotk/v4/gio" | ||
| @@ -65,15 +67,23 @@ func (c *FileChooserWidget) SetGoPointer(ptr uintptr) { | |||||
| 65 | // folder in the file list. | 67 | // folder in the file list. | ||
| 66 | // | 68 | // | ||
| 67 | // The default binding for this signal is <kbd>Alt</kbd>-<kbd>D</kbd>. | 69 | // The default binding for this signal is <kbd>Alt</kbd>-<kbd>D</kbd>. | ||
| 68 | - | func (x *FileChooserWidget) ConnectDesktopFolder(cb func(FileChooserWidget)) uint32 { | 70 | + | func (x *FileChooserWidget) ConnectDesktopFolder(cb *func(FileChooserWidget)) uint32 { |
| 71 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 72 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 73 | + | return gobject.SignalConnect(x.GoPointer(), "desktop-folder", cbRefPtr) | |||
| 74 | + | } | |||
| 75 | + | ||||
| 69 | fcb := func(clsPtr uintptr) { | 76 | fcb := func(clsPtr uintptr) { | ||
| 70 | fa := FileChooserWidget{} | 77 | fa := FileChooserWidget{} | ||
| 71 | fa.Ptr = clsPtr | 78 | fa.Ptr = clsPtr | ||
| 79 | + | cbFn := *cb | |||
| 72 | 80 | ||||
| 73 | - | cb(fa) | 81 | + | cbFn(fa) |
| 74 | 82 | ||||
| 75 | } | 83 | } | ||
| 76 | - | return gobject.SignalConnect(x.GoPointer(), "desktop-folder", purego.NewCallback(fcb)) | 84 | + | cbRefPtr := purego.NewCallback(fcb) |
| 85 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 86 | + | return gobject.SignalConnect(x.GoPointer(), "desktop-folder", cbRefPtr) | |||
| 77 | } | 87 | } | ||
| 78 | 88 | ||||
| 79 | // Emitted when the user asks for it. | 89 | // Emitted when the user asks for it. | ||
| @@ -88,15 +98,23 @@ func (x *FileChooserWidget) ConnectDesktopFolder(cb func(FileChooserWidget)) uin | |||||
| 88 | // switch to the "baz" subfolder. | 98 | // switch to the "baz" subfolder. | ||
| 89 | // | 99 | // | ||
| 90 | // The default binding for this signal is <kbd>Alt</kbd>-<kbd>Down</kbd>. | 100 | // The default binding for this signal is <kbd>Alt</kbd>-<kbd>Down</kbd>. | ||
| 91 | - | func (x *FileChooserWidget) ConnectDownFolder(cb func(FileChooserWidget)) uint32 { | 101 | + | func (x *FileChooserWidget) ConnectDownFolder(cb *func(FileChooserWidget)) uint32 { |
| 102 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 103 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 104 | + | return gobject.SignalConnect(x.GoPointer(), "down-folder", cbRefPtr) | |||
| 105 | + | } | |||
| 106 | + | ||||
| 92 | fcb := func(clsPtr uintptr) { | 107 | fcb := func(clsPtr uintptr) { | ||
| 93 | fa := FileChooserWidget{} | 108 | fa := FileChooserWidget{} | ||
| 94 | fa.Ptr = clsPtr | 109 | fa.Ptr = clsPtr | ||
| 110 | + | cbFn := *cb | |||
| 95 | 111 | ||||
| 96 | - | cb(fa) | 112 | + | cbFn(fa) |
| 97 | 113 | ||||
| 98 | } | 114 | } | ||
| 99 | - | return gobject.SignalConnect(x.GoPointer(), "down-folder", purego.NewCallback(fcb)) | 115 | + | cbRefPtr := purego.NewCallback(fcb) |
| 116 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 117 | + | return gobject.SignalConnect(x.GoPointer(), "down-folder", cbRefPtr) | |||
| 100 | } | 118 | } | ||
| 101 | 119 | ||||
| 102 | // Emitted when the user asks for it. | 120 | // Emitted when the user asks for it. | ||
| @@ -107,15 +125,23 @@ func (x *FileChooserWidget) ConnectDownFolder(cb func(FileChooserWidget)) uint32 | |||||
| 107 | // folder in the file list. | 125 | // folder in the file list. | ||
| 108 | // | 126 | // | ||
| 109 | // The default binding for this signal is <kbd>Alt</kbd>-<kbd>Home</kbd>. | 127 | // The default binding for this signal is <kbd>Alt</kbd>-<kbd>Home</kbd>. | ||
| 110 | - | func (x *FileChooserWidget) ConnectHomeFolder(cb func(FileChooserWidget)) uint32 { | 128 | + | func (x *FileChooserWidget) ConnectHomeFolder(cb *func(FileChooserWidget)) uint32 { |
| 129 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 130 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 131 | + | return gobject.SignalConnect(x.GoPointer(), "home-folder", cbRefPtr) | |||
| 132 | + | } | |||
| 133 | + | ||||
| 111 | fcb := func(clsPtr uintptr) { | 134 | fcb := func(clsPtr uintptr) { | ||
| 112 | fa := FileChooserWidget{} | 135 | fa := FileChooserWidget{} | ||
| 113 | fa.Ptr = clsPtr | 136 | fa.Ptr = clsPtr | ||
| 137 | + | cbFn := *cb | |||
| 114 | 138 | ||||
| 115 | - | cb(fa) | 139 | + | cbFn(fa) |
| 116 | 140 | ||||
| 117 | } | 141 | } | ||
| 118 | - | return gobject.SignalConnect(x.GoPointer(), "home-folder", purego.NewCallback(fcb)) | 142 | + | cbRefPtr := purego.NewCallback(fcb) |
| 143 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 144 | + | return gobject.SignalConnect(x.GoPointer(), "home-folder", cbRefPtr) | |||
| 119 | } | 145 | } | ||
| 120 | 146 | ||||
| 121 | // Emitted when the user asks for it. | 147 | // Emitted when the user asks for it. | ||
| @@ -131,15 +157,23 @@ func (x *FileChooserWidget) ConnectHomeFolder(cb func(FileChooserWidget)) uint32 | |||||
| 131 | // type `/` and immediately type a path name. On Unix systems, this is | 157 | // type `/` and immediately type a path name. On Unix systems, this is | ||
| 132 | // bound to <kbd>~</kbd> (tilde) with a @path string of "~" itself for | 158 | // bound to <kbd>~</kbd> (tilde) with a @path string of "~" itself for | ||
| 133 | // access to home directories. | 159 | // access to home directories. | ||
| 134 | - | func (x *FileChooserWidget) ConnectLocationPopup(cb func(FileChooserWidget, string)) uint32 { | 160 | + | func (x *FileChooserWidget) ConnectLocationPopup(cb *func(FileChooserWidget, string)) uint32 { |
| 161 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 162 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 163 | + | return gobject.SignalConnect(x.GoPointer(), "location-popup", cbRefPtr) | |||
| 164 | + | } | |||
| 165 | + | ||||
| 135 | fcb := func(clsPtr uintptr, PathVarp string) { | 166 | fcb := func(clsPtr uintptr, PathVarp string) { | ||
| 136 | fa := FileChooserWidget{} | 167 | fa := FileChooserWidget{} | ||
| 137 | fa.Ptr = clsPtr | 168 | fa.Ptr = clsPtr | ||
| 169 | + | cbFn := *cb | |||
| 138 | 170 | ||||
| 139 | - | cb(fa, PathVarp) | 171 | + | cbFn(fa, PathVarp) |
| 140 | 172 | ||||
| 141 | } | 173 | } | ||
| 142 | - | return gobject.SignalConnect(x.GoPointer(), "location-popup", purego.NewCallback(fcb)) | 174 | + | cbRefPtr := purego.NewCallback(fcb) |
| 175 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 176 | + | return gobject.SignalConnect(x.GoPointer(), "location-popup", cbRefPtr) | |||
| 143 | } | 177 | } | ||
| 144 | 178 | ||||
| 145 | // Emitted when the user asks for it. | 179 | // Emitted when the user asks for it. | ||
| @@ -150,15 +184,23 @@ func (x *FileChooserWidget) ConnectLocationPopup(cb func(FileChooserWidget, stri | |||||
| 150 | // when the user pastes into a `GtkFileChooserWidget`. | 184 | // when the user pastes into a `GtkFileChooserWidget`. | ||
| 151 | // | 185 | // | ||
| 152 | // The default binding for this signal is <kbd>Control</kbd>-<kbd>V</kbd>. | 186 | // The default binding for this signal is <kbd>Control</kbd>-<kbd>V</kbd>. | ||
| 153 | - | func (x *FileChooserWidget) ConnectLocationPopupOnPaste(cb func(FileChooserWidget)) uint32 { | 187 | + | func (x *FileChooserWidget) ConnectLocationPopupOnPaste(cb *func(FileChooserWidget)) uint32 { |
| 188 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 189 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 190 | + | return gobject.SignalConnect(x.GoPointer(), "location-popup-on-paste", cbRefPtr) | |||
| 191 | + | } | |||
| 192 | + | ||||
| 154 | fcb := func(clsPtr uintptr) { | 193 | fcb := func(clsPtr uintptr) { | ||
| 155 | fa := FileChooserWidget{} | 194 | fa := FileChooserWidget{} | ||
| 156 | fa.Ptr = clsPtr | 195 | fa.Ptr = clsPtr | ||
| 196 | + | cbFn := *cb | |||
| 157 | 197 | ||||
| 158 | - | cb(fa) | 198 | + | cbFn(fa) |
| 159 | 199 | ||||
| 160 | } | 200 | } | ||
| 161 | - | return gobject.SignalConnect(x.GoPointer(), "location-popup-on-paste", purego.NewCallback(fcb)) | 201 | + | cbRefPtr := purego.NewCallback(fcb) |
| 202 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 203 | + | return gobject.SignalConnect(x.GoPointer(), "location-popup-on-paste", cbRefPtr) | |||
| 162 | } | 204 | } | ||
| 163 | 205 | ||||
| 164 | // Emitted when the user asks for it. | 206 | // Emitted when the user asks for it. | ||
| @@ -170,15 +212,23 @@ func (x *FileChooserWidget) ConnectLocationPopupOnPaste(cb func(FileChooserWidge | |||||
| 170 | // he wishes to select. | 212 | // he wishes to select. | ||
| 171 | // | 213 | // | ||
| 172 | // The default binding for this signal is <kbd>Control</kbd>-<kbd>L</kbd>. | 214 | // The default binding for this signal is <kbd>Control</kbd>-<kbd>L</kbd>. | ||
| 173 | - | func (x *FileChooserWidget) ConnectLocationTogglePopup(cb func(FileChooserWidget)) uint32 { | 215 | + | func (x *FileChooserWidget) ConnectLocationTogglePopup(cb *func(FileChooserWidget)) uint32 { |
| 216 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 217 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 218 | + | return gobject.SignalConnect(x.GoPointer(), "location-toggle-popup", cbRefPtr) | |||
| 219 | + | } | |||
| 220 | + | ||||
| 174 | fcb := func(clsPtr uintptr) { | 221 | fcb := func(clsPtr uintptr) { | ||
| 175 | fa := FileChooserWidget{} | 222 | fa := FileChooserWidget{} | ||
| 176 | fa.Ptr = clsPtr | 223 | fa.Ptr = clsPtr | ||
| 224 | + | cbFn := *cb | |||
| 177 | 225 | ||||
| 178 | - | cb(fa) | 226 | + | cbFn(fa) |
| 179 | 227 | ||||
| 180 | } | 228 | } | ||
| 181 | - | return gobject.SignalConnect(x.GoPointer(), "location-toggle-popup", purego.NewCallback(fcb)) | 229 | + | cbRefPtr := purego.NewCallback(fcb) |
| 230 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 231 | + | return gobject.SignalConnect(x.GoPointer(), "location-toggle-popup", cbRefPtr) | |||
| 182 | } | 232 | } | ||
| 183 | 233 | ||||
| 184 | // Emitted when the user asks for it. | 234 | // Emitted when the user asks for it. | ||
| @@ -188,15 +238,23 @@ func (x *FileChooserWidget) ConnectLocationTogglePopup(cb func(FileChooserWidget | |||||
| 188 | // This is used to move the focus to the places sidebar. | 238 | // This is used to move the focus to the places sidebar. | ||
| 189 | // | 239 | // | ||
| 190 | // The default binding for this signal is <kbd>Alt</kbd>-<kbd>P</kbd>. | 240 | // The default binding for this signal is <kbd>Alt</kbd>-<kbd>P</kbd>. | ||
| 191 | - | func (x *FileChooserWidget) ConnectPlacesShortcut(cb func(FileChooserWidget)) uint32 { | 241 | + | func (x *FileChooserWidget) ConnectPlacesShortcut(cb *func(FileChooserWidget)) uint32 { |
| 242 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 243 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 244 | + | return gobject.SignalConnect(x.GoPointer(), "places-shortcut", cbRefPtr) | |||
| 245 | + | } | |||
| 246 | + | ||||
| 192 | fcb := func(clsPtr uintptr) { | 247 | fcb := func(clsPtr uintptr) { | ||
| 193 | fa := FileChooserWidget{} | 248 | fa := FileChooserWidget{} | ||
| 194 | fa.Ptr = clsPtr | 249 | fa.Ptr = clsPtr | ||
| 250 | + | cbFn := *cb | |||
| 195 | 251 | ||||
| 196 | - | cb(fa) | 252 | + | cbFn(fa) |
| 197 | 253 | ||||
| 198 | } | 254 | } | ||
| 199 | - | return gobject.SignalConnect(x.GoPointer(), "places-shortcut", purego.NewCallback(fcb)) | 255 | + | cbRefPtr := purego.NewCallback(fcb) |
| 256 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 257 | + | return gobject.SignalConnect(x.GoPointer(), "places-shortcut", cbRefPtr) | |||
| 200 | } | 258 | } | ||
| 201 | 259 | ||||
| 202 | // Emitted when the user asks for it. | 260 | // Emitted when the user asks for it. | ||
| @@ -213,15 +271,23 @@ func (x *FileChooserWidget) ConnectPlacesShortcut(cb func(FileChooserWidget)) ui | |||||
| 213 | // Note that in the default binding, that <kbd>Alt</kbd>-<kbd>1</kbd> is | 271 | // Note that in the default binding, that <kbd>Alt</kbd>-<kbd>1</kbd> is | ||
| 214 | // actually defined to switch to the bookmark at index 0, and so on | 272 | // actually defined to switch to the bookmark at index 0, and so on | ||
| 215 | // successively. | 273 | // successively. | ||
| 216 | - | func (x *FileChooserWidget) ConnectQuickBookmark(cb func(FileChooserWidget, int)) uint32 { | 274 | + | func (x *FileChooserWidget) ConnectQuickBookmark(cb *func(FileChooserWidget, int)) uint32 { |
| 275 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 276 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 277 | + | return gobject.SignalConnect(x.GoPointer(), "quick-bookmark", cbRefPtr) | |||
| 278 | + | } | |||
| 279 | + | ||||
| 217 | fcb := func(clsPtr uintptr, BookmarkIndexVarp int) { | 280 | fcb := func(clsPtr uintptr, BookmarkIndexVarp int) { | ||
| 218 | fa := FileChooserWidget{} | 281 | fa := FileChooserWidget{} | ||
| 219 | fa.Ptr = clsPtr | 282 | fa.Ptr = clsPtr | ||
| 283 | + | cbFn := *cb | |||
| 220 | 284 | ||||
| 221 | - | cb(fa, BookmarkIndexVarp) | 285 | + | cbFn(fa, BookmarkIndexVarp) |
| 222 | 286 | ||||
| 223 | } | 287 | } | ||
| 224 | - | return gobject.SignalConnect(x.GoPointer(), "quick-bookmark", purego.NewCallback(fcb)) | 288 | + | cbRefPtr := purego.NewCallback(fcb) |
| 289 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 290 | + | return gobject.SignalConnect(x.GoPointer(), "quick-bookmark", cbRefPtr) | |||
| 225 | } | 291 | } | ||
| 226 | 292 | ||||
| 227 | // Emitted when the user asks for it. | 293 | // Emitted when the user asks for it. | ||
| @@ -231,15 +297,23 @@ func (x *FileChooserWidget) ConnectQuickBookmark(cb func(FileChooserWidget, int) | |||||
| 231 | // This is used to make the file chooser show the Recent location. | 297 | // This is used to make the file chooser show the Recent location. | ||
| 232 | // | 298 | // | ||
| 233 | // The default binding for this signal is <kbd>Alt</kbd>-<kbd>R</kbd>. | 299 | // The default binding for this signal is <kbd>Alt</kbd>-<kbd>R</kbd>. | ||
| 234 | - | func (x *FileChooserWidget) ConnectRecentShortcut(cb func(FileChooserWidget)) uint32 { | 300 | + | func (x *FileChooserWidget) ConnectRecentShortcut(cb *func(FileChooserWidget)) uint32 { |
| 301 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 302 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 303 | + | return gobject.SignalConnect(x.GoPointer(), "recent-shortcut", cbRefPtr) | |||
| 304 | + | } | |||
| 305 | + | ||||
| 235 | fcb := func(clsPtr uintptr) { | 306 | fcb := func(clsPtr uintptr) { | ||
| 236 | fa := FileChooserWidget{} | 307 | fa := FileChooserWidget{} | ||
| 237 | fa.Ptr = clsPtr | 308 | fa.Ptr = clsPtr | ||
| 309 | + | cbFn := *cb | |||
| 238 | 310 | ||||
| 239 | - | cb(fa) | 311 | + | cbFn(fa) |
| 240 | 312 | ||||
| 241 | } | 313 | } | ||
| 242 | - | return gobject.SignalConnect(x.GoPointer(), "recent-shortcut", purego.NewCallback(fcb)) | 314 | + | cbRefPtr := purego.NewCallback(fcb) |
| 315 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 316 | + | return gobject.SignalConnect(x.GoPointer(), "recent-shortcut", cbRefPtr) | |||
| 243 | } | 317 | } | ||
| 244 | 318 | ||||
| 245 | // Emitted when the user asks for it. | 319 | // Emitted when the user asks for it. | ||
| @@ -249,15 +323,23 @@ func (x *FileChooserWidget) ConnectRecentShortcut(cb func(FileChooserWidget)) ui | |||||
| 249 | // This is used to make the file chooser show the search entry. | 323 | // This is used to make the file chooser show the search entry. | ||
| 250 | // | 324 | // | ||
| 251 | // The default binding for this signal is <kbd>Alt</kbd>-<kbd>S</kbd>. | 325 | // The default binding for this signal is <kbd>Alt</kbd>-<kbd>S</kbd>. | ||
| 252 | - | func (x *FileChooserWidget) ConnectSearchShortcut(cb func(FileChooserWidget)) uint32 { | 326 | + | func (x *FileChooserWidget) ConnectSearchShortcut(cb *func(FileChooserWidget)) uint32 { |
| 327 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 328 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 329 | + | return gobject.SignalConnect(x.GoPointer(), "search-shortcut", cbRefPtr) | |||
| 330 | + | } | |||
| 331 | + | ||||
| 253 | fcb := func(clsPtr uintptr) { | 332 | fcb := func(clsPtr uintptr) { | ||
| 254 | fa := FileChooserWidget{} | 333 | fa := FileChooserWidget{} | ||
| 255 | fa.Ptr = clsPtr | 334 | fa.Ptr = clsPtr | ||
| 335 | + | cbFn := *cb | |||
| 256 | 336 | ||||
| 257 | - | cb(fa) | 337 | + | cbFn(fa) |
| 258 | 338 | ||||
| 259 | } | 339 | } | ||
| 260 | - | return gobject.SignalConnect(x.GoPointer(), "search-shortcut", purego.NewCallback(fcb)) | 340 | + | cbRefPtr := purego.NewCallback(fcb) |
| 341 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 342 | + | return gobject.SignalConnect(x.GoPointer(), "search-shortcut", cbRefPtr) | |||
| 261 | } | 343 | } | ||
| 262 | 344 | ||||
| 263 | // Emitted when the user asks for it. | 345 | // Emitted when the user asks for it. | ||
| @@ -267,15 +349,23 @@ func (x *FileChooserWidget) ConnectSearchShortcut(cb func(FileChooserWidget)) ui | |||||
| 267 | // This is used to make the file chooser display hidden files. | 349 | // This is used to make the file chooser display hidden files. | ||
| 268 | // | 350 | // | ||
| 269 | // The default binding for this signal is <kbd>Control</kbd>-<kbd>H</kbd>. | 351 | // The default binding for this signal is <kbd>Control</kbd>-<kbd>H</kbd>. | ||
| 270 | - | func (x *FileChooserWidget) ConnectShowHidden(cb func(FileChooserWidget)) uint32 { | 352 | + | func (x *FileChooserWidget) ConnectShowHidden(cb *func(FileChooserWidget)) uint32 { |
| 353 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 354 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 355 | + | return gobject.SignalConnect(x.GoPointer(), "show-hidden", cbRefPtr) | |||
| 356 | + | } | |||
| 357 | + | ||||
| 271 | fcb := func(clsPtr uintptr) { | 358 | fcb := func(clsPtr uintptr) { | ||
| 272 | fa := FileChooserWidget{} | 359 | fa := FileChooserWidget{} | ||
| 273 | fa.Ptr = clsPtr | 360 | fa.Ptr = clsPtr | ||
| 361 | + | cbFn := *cb | |||
| 274 | 362 | ||||
| 275 | - | cb(fa) | 363 | + | cbFn(fa) |
| 276 | 364 | ||||
| 277 | } | 365 | } | ||
| 278 | - | return gobject.SignalConnect(x.GoPointer(), "show-hidden", purego.NewCallback(fcb)) | 366 | + | cbRefPtr := purego.NewCallback(fcb) |
| 367 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 368 | + | return gobject.SignalConnect(x.GoPointer(), "show-hidden", cbRefPtr) | |||
| 279 | } | 369 | } | ||
| 280 | 370 | ||||
| 281 | // Emitted when the user asks for it. | 371 | // Emitted when the user asks for it. | ||
| @@ -286,15 +376,23 @@ func (x *FileChooserWidget) ConnectShowHidden(cb func(FileChooserWidget)) uint32 | |||||
| 286 | // of the current folder in the file hierarchy. | 376 | // of the current folder in the file hierarchy. | ||
| 287 | // | 377 | // | ||
| 288 | // The default binding for this signal is <kbd>Alt</kbd>-<kbd>Up</kbd>. | 378 | // The default binding for this signal is <kbd>Alt</kbd>-<kbd>Up</kbd>. | ||
| 289 | - | func (x *FileChooserWidget) ConnectUpFolder(cb func(FileChooserWidget)) uint32 { | 379 | + | func (x *FileChooserWidget) ConnectUpFolder(cb *func(FileChooserWidget)) uint32 { |
| 380 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 381 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 382 | + | return gobject.SignalConnect(x.GoPointer(), "up-folder", cbRefPtr) | |||
| 383 | + | } | |||
| 384 | + | ||||
| 290 | fcb := func(clsPtr uintptr) { | 385 | fcb := func(clsPtr uintptr) { | ||
| 291 | fa := FileChooserWidget{} | 386 | fa := FileChooserWidget{} | ||
| 292 | fa.Ptr = clsPtr | 387 | fa.Ptr = clsPtr | ||
| 388 | + | cbFn := *cb | |||
| 293 | 389 | ||||
| 294 | - | cb(fa) | 390 | + | cbFn(fa) |
| 295 | 391 | ||||
| 296 | } | 392 | } | ||
| 297 | - | return gobject.SignalConnect(x.GoPointer(), "up-folder", purego.NewCallback(fcb)) | 393 | + | cbRefPtr := purego.NewCallback(fcb) |
| 394 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 395 | + | return gobject.SignalConnect(x.GoPointer(), "up-folder", cbRefPtr) | |||
| 298 | } | 396 | } | ||
| 299 | 397 | ||||
| 300 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 398 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/gtk/gtkfilter.go +12 -3
| @@ -6,6 +6,7 @@ import ( | |||||
| 6 | 6 | ||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 9 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 10 | ) | 11 | ) | ||
| 11 | 12 | ||||
| @@ -152,15 +153,23 @@ func (c *Filter) SetGoPointer(ptr uintptr) { | |||||
| 152 | // Depending on the @change parameter, not all items need | 153 | // Depending on the @change parameter, not all items need | ||
| 153 | // to be checked, but only some. Refer to the [enum@Gtk.FilterChange] | 154 | // to be checked, but only some. Refer to the [enum@Gtk.FilterChange] | ||
| 154 | // documentation for details. | 155 | // documentation for details. | ||
| 155 | - | func (x *Filter) ConnectChanged(cb func(Filter, FilterChange)) uint32 { | 156 | + | func (x *Filter) ConnectChanged(cb *func(Filter, FilterChange)) uint32 { |
| 157 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 158 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 159 | + | return gobject.SignalConnect(x.GoPointer(), "changed", cbRefPtr) | |||
| 160 | + | } | |||
| 161 | + | ||||
| 156 | fcb := func(clsPtr uintptr, ChangeVarp FilterChange) { | 162 | fcb := func(clsPtr uintptr, ChangeVarp FilterChange) { | ||
| 157 | fa := Filter{} | 163 | fa := Filter{} | ||
| 158 | fa.Ptr = clsPtr | 164 | fa.Ptr = clsPtr | ||
| 165 | + | cbFn := *cb | |||
| 159 | 166 | ||||
| 160 | - | cb(fa, ChangeVarp) | 167 | + | cbFn(fa, ChangeVarp) |
| 161 | 168 | ||||
| 162 | } | 169 | } | ||
| 163 | - | return gobject.SignalConnect(x.GoPointer(), "changed", purego.NewCallback(fcb)) | 170 | + | cbRefPtr := purego.NewCallback(fcb) |
| 171 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 172 | + | return gobject.SignalConnect(x.GoPointer(), "changed", cbRefPtr) | |||
| 164 | } | 173 | } | ||
| 165 | 174 | ||||
| 166 | func init() { | 175 | func init() { | ||
M v4/gtk/gtkflowbox.go +96 -32
| @@ -145,9 +145,9 @@ var xFlowBoxBindModel func(uintptr, uintptr, uintptr, uintptr, uintptr) | |||||
| 145 | // Note that using a model is incompatible with the filtering and sorting | 145 | // Note that using a model is incompatible with the filtering and sorting | ||
| 146 | // functionality in `GtkFlowBox`. When using a model, filtering and sorting | 146 | // functionality in `GtkFlowBox`. When using a model, filtering and sorting | ||
| 147 | // should be implemented by the model. | 147 | // should be implemented by the model. | ||
| 148 | - | func (x *FlowBox) BindModel(ModelVar gio.ListModel, CreateWidgetFuncVar FlowBoxCreateWidgetFunc, UserDataVar uintptr, UserDataFreeFuncVar glib.DestroyNotify) { | 148 | + | func (x *FlowBox) BindModel(ModelVar gio.ListModel, CreateWidgetFuncVar *FlowBoxCreateWidgetFunc, UserDataVar uintptr, UserDataFreeFuncVar *glib.DestroyNotify) { |
| 149 | 149 | ||||
| 150 | - | xFlowBoxBindModel(x.GoPointer(), ModelVar.GoPointer(), purego.NewCallback(CreateWidgetFuncVar), UserDataVar, purego.NewCallback(UserDataFreeFuncVar)) | 150 | + | xFlowBoxBindModel(x.GoPointer(), ModelVar.GoPointer(), glib.NewCallback(CreateWidgetFuncVar), UserDataVar, glib.NewCallback(UserDataFreeFuncVar)) |
| 151 | 151 | ||||
| 152 | } | 152 | } | ||
| 153 | 153 | ||||
| @@ -350,9 +350,9 @@ var xFlowBoxSelectedForeach func(uintptr, uintptr, uintptr) | |||||
| 350 | // | 350 | // | ||
| 351 | // Note that the selection cannot be modified from within | 351 | // Note that the selection cannot be modified from within | ||
| 352 | // this function. | 352 | // this function. | ||
| 353 | - | func (x *FlowBox) SelectedForeach(FuncVar FlowBoxForeachFunc, DataVar uintptr) { | 353 | + | func (x *FlowBox) SelectedForeach(FuncVar *FlowBoxForeachFunc, DataVar uintptr) { |
| 354 | 354 | ||||
| 355 | - | xFlowBoxSelectedForeach(x.GoPointer(), purego.NewCallback(FuncVar), DataVar) | 355 | + | xFlowBoxSelectedForeach(x.GoPointer(), glib.NewCallback(FuncVar), DataVar) |
| 356 | 356 | ||||
| 357 | } | 357 | } | ||
| 358 | 358 | ||||
| @@ -390,9 +390,9 @@ var xFlowBoxSetFilterFunc func(uintptr, uintptr, uintptr, uintptr) | |||||
| 390 | // | 390 | // | ||
| 391 | // Note that using a filter function is incompatible with using a model | 391 | // Note that using a filter function is incompatible with using a model | ||
| 392 | // (see [method@Gtk.FlowBox.bind_model]). | 392 | // (see [method@Gtk.FlowBox.bind_model]). | ||
| 393 | - | func (x *FlowBox) SetFilterFunc(FilterFuncVar FlowBoxFilterFunc, UserDataVar uintptr, DestroyVar glib.DestroyNotify) { | 393 | + | func (x *FlowBox) SetFilterFunc(FilterFuncVar *FlowBoxFilterFunc, UserDataVar uintptr, DestroyVar *glib.DestroyNotify) { |
| 394 | 394 | ||||
| 395 | - | xFlowBoxSetFilterFunc(x.GoPointer(), purego.NewCallback(FilterFuncVar), UserDataVar, purego.NewCallback(DestroyVar)) | 395 | + | xFlowBoxSetFilterFunc(x.GoPointer(), glib.NewCallback(FilterFuncVar), UserDataVar, glib.NewCallback(DestroyVar)) |
| 396 | 396 | ||||
| 397 | } | 397 | } | ||
| 398 | 398 | ||||
| @@ -480,9 +480,9 @@ var xFlowBoxSetSortFunc func(uintptr, uintptr, uintptr, uintptr) | |||||
| 480 | // | 480 | // | ||
| 481 | // Note that using a sort function is incompatible with using a model | 481 | // Note that using a sort function is incompatible with using a model | ||
| 482 | // (see [method@Gtk.FlowBox.bind_model]). | 482 | // (see [method@Gtk.FlowBox.bind_model]). | ||
| 483 | - | func (x *FlowBox) SetSortFunc(SortFuncVar FlowBoxSortFunc, UserDataVar uintptr, DestroyVar glib.DestroyNotify) { | 483 | + | func (x *FlowBox) SetSortFunc(SortFuncVar *FlowBoxSortFunc, UserDataVar uintptr, DestroyVar *glib.DestroyNotify) { |
| 484 | 484 | ||||
| 485 | - | xFlowBoxSetSortFunc(x.GoPointer(), purego.NewCallback(SortFuncVar), UserDataVar, purego.NewCallback(DestroyVar)) | 485 | + | xFlowBoxSetSortFunc(x.GoPointer(), glib.NewCallback(SortFuncVar), UserDataVar, glib.NewCallback(DestroyVar)) |
| 486 | 486 | ||||
| 487 | } | 487 | } | ||
| 488 | 488 | ||||
| @@ -536,27 +536,43 @@ func (c *FlowBox) SetGoPointer(ptr uintptr) { | |||||
| 536 | // Emitted when the user activates the @box. | 536 | // Emitted when the user activates the @box. | ||
| 537 | // | 537 | // | ||
| 538 | // This is a [keybinding signal](class.SignalAction.html). | 538 | // This is a [keybinding signal](class.SignalAction.html). | ||
| 539 | - | func (x *FlowBox) ConnectActivateCursorChild(cb func(FlowBox)) uint32 { | 539 | + | func (x *FlowBox) ConnectActivateCursorChild(cb *func(FlowBox)) uint32 { |
| 540 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 541 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 542 | + | return gobject.SignalConnect(x.GoPointer(), "activate-cursor-child", cbRefPtr) | |||
| 543 | + | } | |||
| 544 | + | ||||
| 540 | fcb := func(clsPtr uintptr) { | 545 | fcb := func(clsPtr uintptr) { | ||
| 541 | fa := FlowBox{} | 546 | fa := FlowBox{} | ||
| 542 | fa.Ptr = clsPtr | 547 | fa.Ptr = clsPtr | ||
| 548 | + | cbFn := *cb | |||
| 543 | 549 | ||||
| 544 | - | cb(fa) | 550 | + | cbFn(fa) |
| 545 | 551 | ||||
| 546 | } | 552 | } | ||
| 547 | - | return gobject.SignalConnect(x.GoPointer(), "activate-cursor-child", purego.NewCallback(fcb)) | 553 | + | cbRefPtr := purego.NewCallback(fcb) |
| 554 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 555 | + | return gobject.SignalConnect(x.GoPointer(), "activate-cursor-child", cbRefPtr) | |||
| 548 | } | 556 | } | ||
| 549 | 557 | ||||
| 550 | // Emitted when a child has been activated by the user. | 558 | // Emitted when a child has been activated by the user. | ||
| 551 | - | func (x *FlowBox) ConnectChildActivated(cb func(FlowBox, uintptr)) uint32 { | 559 | + | func (x *FlowBox) ConnectChildActivated(cb *func(FlowBox, uintptr)) uint32 { |
| 560 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 561 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 562 | + | return gobject.SignalConnect(x.GoPointer(), "child-activated", cbRefPtr) | |||
| 563 | + | } | |||
| 564 | + | ||||
| 552 | fcb := func(clsPtr uintptr, ChildVarp uintptr) { | 565 | fcb := func(clsPtr uintptr, ChildVarp uintptr) { | ||
| 553 | fa := FlowBox{} | 566 | fa := FlowBox{} | ||
| 554 | fa.Ptr = clsPtr | 567 | fa.Ptr = clsPtr | ||
| 568 | + | cbFn := *cb | |||
| 555 | 569 | ||||
| 556 | - | cb(fa, ChildVarp) | 570 | + | cbFn(fa, ChildVarp) |
| 557 | 571 | ||||
| 558 | } | 572 | } | ||
| 559 | - | return gobject.SignalConnect(x.GoPointer(), "child-activated", purego.NewCallback(fcb)) | 573 | + | cbRefPtr := purego.NewCallback(fcb) |
| 574 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 575 | + | return gobject.SignalConnect(x.GoPointer(), "child-activated", cbRefPtr) | |||
| 560 | } | 576 | } | ||
| 561 | 577 | ||||
| 562 | // Emitted when the user initiates a cursor movement. | 578 | // Emitted when the user initiates a cursor movement. | ||
| @@ -575,15 +591,23 @@ func (x *FlowBox) ConnectChildActivated(cb func(FlowBox, uintptr)) uint32 { | |||||
| 575 | // move by individual children | 591 | // move by individual children | ||
| 576 | // - <kbd>Home</kbd>, <kbd>End</kbd> move to the ends of the box | 592 | // - <kbd>Home</kbd>, <kbd>End</kbd> move to the ends of the box | ||
| 577 | // - <kbd>PgUp</kbd>, <kbd>PgDn</kbd> move vertically by pages | 593 | // - <kbd>PgUp</kbd>, <kbd>PgDn</kbd> move vertically by pages | ||
| 578 | - | func (x *FlowBox) ConnectMoveCursor(cb func(FlowBox, MovementStep, int, bool, bool) bool) uint32 { | 594 | + | func (x *FlowBox) ConnectMoveCursor(cb *func(FlowBox, MovementStep, int, bool, bool) bool) uint32 { |
| 595 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 596 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 597 | + | return gobject.SignalConnect(x.GoPointer(), "move-cursor", cbRefPtr) | |||
| 598 | + | } | |||
| 599 | + | ||||
| 579 | fcb := func(clsPtr uintptr, StepVarp MovementStep, CountVarp int, ExtendVarp bool, ModifyVarp bool) bool { | 600 | fcb := func(clsPtr uintptr, StepVarp MovementStep, CountVarp int, ExtendVarp bool, ModifyVarp bool) bool { | ||
| 580 | fa := FlowBox{} | 601 | fa := FlowBox{} | ||
| 581 | fa.Ptr = clsPtr | 602 | fa.Ptr = clsPtr | ||
| 603 | + | cbFn := *cb | |||
| 582 | 604 | ||||
| 583 | - | return cb(fa, StepVarp, CountVarp, ExtendVarp, ModifyVarp) | 605 | + | return cbFn(fa, StepVarp, CountVarp, ExtendVarp, ModifyVarp) |
| 584 | 606 | ||||
| 585 | } | 607 | } | ||
| 586 | - | return gobject.SignalConnect(x.GoPointer(), "move-cursor", purego.NewCallback(fcb)) | 608 | + | cbRefPtr := purego.NewCallback(fcb) |
| 609 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 610 | + | return gobject.SignalConnect(x.GoPointer(), "move-cursor", cbRefPtr) | |||
| 587 | } | 611 | } | ||
| 588 | 612 | ||||
| 589 | // Emitted to select all children of the box, | 613 | // Emitted to select all children of the box, | ||
| @@ -592,15 +616,23 @@ func (x *FlowBox) ConnectMoveCursor(cb func(FlowBox, MovementStep, int, bool, bo | |||||
| 592 | // This is a [keybinding signal](class.SignalAction.html). | 616 | // This is a [keybinding signal](class.SignalAction.html). | ||
| 593 | // | 617 | // | ||
| 594 | // The default bindings for this signal is <kbd>Ctrl</kbd>-<kbd>a</kbd>. | 618 | // The default bindings for this signal is <kbd>Ctrl</kbd>-<kbd>a</kbd>. | ||
| 595 | - | func (x *FlowBox) ConnectSelectAll(cb func(FlowBox)) uint32 { | 619 | + | func (x *FlowBox) ConnectSelectAll(cb *func(FlowBox)) uint32 { |
| 620 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 621 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 622 | + | return gobject.SignalConnect(x.GoPointer(), "select-all", cbRefPtr) | |||
| 623 | + | } | |||
| 624 | + | ||||
| 596 | fcb := func(clsPtr uintptr) { | 625 | fcb := func(clsPtr uintptr) { | ||
| 597 | fa := FlowBox{} | 626 | fa := FlowBox{} | ||
| 598 | fa.Ptr = clsPtr | 627 | fa.Ptr = clsPtr | ||
| 628 | + | cbFn := *cb | |||
| 599 | 629 | ||||
| 600 | - | cb(fa) | 630 | + | cbFn(fa) |
| 601 | 631 | ||||
| 602 | } | 632 | } | ||
| 603 | - | return gobject.SignalConnect(x.GoPointer(), "select-all", purego.NewCallback(fcb)) | 633 | + | cbRefPtr := purego.NewCallback(fcb) |
| 634 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 635 | + | return gobject.SignalConnect(x.GoPointer(), "select-all", cbRefPtr) | |||
| 604 | } | 636 | } | ||
| 605 | 637 | ||||
| 606 | // Emitted when the set of selected children changes. | 638 | // Emitted when the set of selected children changes. | ||
| @@ -608,15 +640,23 @@ func (x *FlowBox) ConnectSelectAll(cb func(FlowBox)) uint32 { | |||||
| 608 | // Use [method@Gtk.FlowBox.selected_foreach] or | 640 | // Use [method@Gtk.FlowBox.selected_foreach] or | ||
| 609 | // [method@Gtk.FlowBox.get_selected_children] to obtain the | 641 | // [method@Gtk.FlowBox.get_selected_children] to obtain the | ||
| 610 | // selected children. | 642 | // selected children. | ||
| 611 | - | func (x *FlowBox) ConnectSelectedChildrenChanged(cb func(FlowBox)) uint32 { | 643 | + | func (x *FlowBox) ConnectSelectedChildrenChanged(cb *func(FlowBox)) uint32 { |
| 644 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 645 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 646 | + | return gobject.SignalConnect(x.GoPointer(), "selected-children-changed", cbRefPtr) | |||
| 647 | + | } | |||
| 648 | + | ||||
| 612 | fcb := func(clsPtr uintptr) { | 649 | fcb := func(clsPtr uintptr) { | ||
| 613 | fa := FlowBox{} | 650 | fa := FlowBox{} | ||
| 614 | fa.Ptr = clsPtr | 651 | fa.Ptr = clsPtr | ||
| 652 | + | cbFn := *cb | |||
| 615 | 653 | ||||
| 616 | - | cb(fa) | 654 | + | cbFn(fa) |
| 617 | 655 | ||||
| 618 | } | 656 | } | ||
| 619 | - | return gobject.SignalConnect(x.GoPointer(), "selected-children-changed", purego.NewCallback(fcb)) | 657 | + | cbRefPtr := purego.NewCallback(fcb) |
| 658 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 659 | + | return gobject.SignalConnect(x.GoPointer(), "selected-children-changed", cbRefPtr) | |||
| 620 | } | 660 | } | ||
| 621 | 661 | ||||
| 622 | // Emitted to toggle the selection of the child that has the focus. | 662 | // Emitted to toggle the selection of the child that has the focus. | ||
| @@ -624,15 +664,23 @@ func (x *FlowBox) ConnectSelectedChildrenChanged(cb func(FlowBox)) uint32 { | |||||
| 624 | // This is a [keybinding signal](class.SignalAction.html). | 664 | // This is a [keybinding signal](class.SignalAction.html). | ||
| 625 | // | 665 | // | ||
| 626 | // The default binding for this signal is <kbd>Ctrl</kbd>-<kbd>Space</kbd>. | 666 | // The default binding for this signal is <kbd>Ctrl</kbd>-<kbd>Space</kbd>. | ||
| 627 | - | func (x *FlowBox) ConnectToggleCursorChild(cb func(FlowBox)) uint32 { | 667 | + | func (x *FlowBox) ConnectToggleCursorChild(cb *func(FlowBox)) uint32 { |
| 668 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 669 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 670 | + | return gobject.SignalConnect(x.GoPointer(), "toggle-cursor-child", cbRefPtr) | |||
| 671 | + | } | |||
| 672 | + | ||||
| 628 | fcb := func(clsPtr uintptr) { | 673 | fcb := func(clsPtr uintptr) { | ||
| 629 | fa := FlowBox{} | 674 | fa := FlowBox{} | ||
| 630 | fa.Ptr = clsPtr | 675 | fa.Ptr = clsPtr | ||
| 676 | + | cbFn := *cb | |||
| 631 | 677 | ||||
| 632 | - | cb(fa) | 678 | + | cbFn(fa) |
| 633 | 679 | ||||
| 634 | } | 680 | } | ||
| 635 | - | return gobject.SignalConnect(x.GoPointer(), "toggle-cursor-child", purego.NewCallback(fcb)) | 681 | + | cbRefPtr := purego.NewCallback(fcb) |
| 682 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 683 | + | return gobject.SignalConnect(x.GoPointer(), "toggle-cursor-child", cbRefPtr) | |||
| 636 | } | 684 | } | ||
| 637 | 685 | ||||
| 638 | // Emitted to unselect all children of the box, | 686 | // Emitted to unselect all children of the box, | ||
| @@ -641,15 +689,23 @@ func (x *FlowBox) ConnectToggleCursorChild(cb func(FlowBox)) uint32 { | |||||
| 641 | // This is a [keybinding signal](class.SignalAction.html). | 689 | // This is a [keybinding signal](class.SignalAction.html). | ||
| 642 | // | 690 | // | ||
| 643 | // The default bindings for this signal is <kbd>Ctrl</kbd>-<kbd>Shift</kbd>-<kbd>a</kbd>. | 691 | // The default bindings for this signal is <kbd>Ctrl</kbd>-<kbd>Shift</kbd>-<kbd>a</kbd>. | ||
| 644 | - | func (x *FlowBox) ConnectUnselectAll(cb func(FlowBox)) uint32 { | 692 | + | func (x *FlowBox) ConnectUnselectAll(cb *func(FlowBox)) uint32 { |
| 693 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 694 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 695 | + | return gobject.SignalConnect(x.GoPointer(), "unselect-all", cbRefPtr) | |||
| 696 | + | } | |||
| 697 | + | ||||
| 645 | fcb := func(clsPtr uintptr) { | 698 | fcb := func(clsPtr uintptr) { | ||
| 646 | fa := FlowBox{} | 699 | fa := FlowBox{} | ||
| 647 | fa.Ptr = clsPtr | 700 | fa.Ptr = clsPtr | ||
| 701 | + | cbFn := *cb | |||
| 648 | 702 | ||||
| 649 | - | cb(fa) | 703 | + | cbFn(fa) |
| 650 | 704 | ||||
| 651 | } | 705 | } | ||
| 652 | - | return gobject.SignalConnect(x.GoPointer(), "unselect-all", purego.NewCallback(fcb)) | 706 | + | cbRefPtr := purego.NewCallback(fcb) |
| 707 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 708 | + | return gobject.SignalConnect(x.GoPointer(), "unselect-all", cbRefPtr) | |||
| 653 | } | 709 | } | ||
| 654 | 710 | ||||
| 655 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 711 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
| @@ -928,15 +984,23 @@ func (c *FlowBoxChild) SetGoPointer(ptr uintptr) { | |||||
| 928 | // but it can be used by applications for their own purposes. | 984 | // but it can be used by applications for their own purposes. | ||
| 929 | // | 985 | // | ||
| 930 | // The default bindings are <kbd>Space</kbd> and <kbd>Enter</kbd>. | 986 | // The default bindings are <kbd>Space</kbd> and <kbd>Enter</kbd>. | ||
| 931 | - | func (x *FlowBoxChild) ConnectActivate(cb func(FlowBoxChild)) uint32 { | 987 | + | func (x *FlowBoxChild) ConnectActivate(cb *func(FlowBoxChild)) uint32 { |
| 988 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 989 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 990 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 991 | + | } | |||
| 992 | + | ||||
| 932 | fcb := func(clsPtr uintptr) { | 993 | fcb := func(clsPtr uintptr) { | ||
| 933 | fa := FlowBoxChild{} | 994 | fa := FlowBoxChild{} | ||
| 934 | fa.Ptr = clsPtr | 995 | fa.Ptr = clsPtr | ||
| 996 | + | cbFn := *cb | |||
| 935 | 997 | ||||
| 936 | - | cb(fa) | 998 | + | cbFn(fa) |
| 937 | 999 | ||||
| 938 | } | 1000 | } | ||
| 939 | - | return gobject.SignalConnect(x.GoPointer(), "activate", purego.NewCallback(fcb)) | 1001 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1002 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1003 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 940 | } | 1004 | } | ||
| 941 | 1005 | ||||
| 942 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 1006 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/gtk/gtkfontbutton.go +26 -8
| @@ -2,6 +2,8 @@ | |||||
| 2 | package gtk | 2 | package gtk | ||
| 3 | 3 | ||||
| 4 | import ( | 4 | import ( | ||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 5 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 6 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 7 | "github.com/jwijenbergh/puregotk/v4/glib" | 9 | "github.com/jwijenbergh/puregotk/v4/glib" | ||
| @@ -158,15 +160,23 @@ func (c *FontButton) SetGoPointer(ptr uintptr) { | |||||
| 158 | // | 160 | // | ||
| 159 | // The `::activate` signal on `GtkFontButton` is an action signal and | 161 | // The `::activate` signal on `GtkFontButton` is an action signal and | ||
| 160 | // emitting it causes the button to present its dialog. | 162 | // emitting it causes the button to present its dialog. | ||
| 161 | - | func (x *FontButton) ConnectActivate(cb func(FontButton)) uint32 { | 163 | + | func (x *FontButton) ConnectActivate(cb *func(FontButton)) uint32 { |
| 164 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 165 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 166 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 167 | + | } | |||
| 168 | + | ||||
| 162 | fcb := func(clsPtr uintptr) { | 169 | fcb := func(clsPtr uintptr) { | ||
| 163 | fa := FontButton{} | 170 | fa := FontButton{} | ||
| 164 | fa.Ptr = clsPtr | 171 | fa.Ptr = clsPtr | ||
| 172 | + | cbFn := *cb | |||
| 165 | 173 | ||||
| 166 | - | cb(fa) | 174 | + | cbFn(fa) |
| 167 | 175 | ||||
| 168 | } | 176 | } | ||
| 169 | - | return gobject.SignalConnect(x.GoPointer(), "activate", purego.NewCallback(fcb)) | 177 | + | cbRefPtr := purego.NewCallback(fcb) |
| 178 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 179 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 170 | } | 180 | } | ||
| 171 | 181 | ||||
| 172 | // Emitted when the user selects a font. | 182 | // Emitted when the user selects a font. | ||
| @@ -177,15 +187,23 @@ func (x *FontButton) ConnectActivate(cb func(FontButton)) uint32 { | |||||
| 177 | // Note that this signal is only emitted when the user changes the font. | 187 | // Note that this signal is only emitted when the user changes the font. | ||
| 178 | // If you need to react to programmatic font changes as well, use | 188 | // If you need to react to programmatic font changes as well, use | ||
| 179 | // the notify::font signal. | 189 | // the notify::font signal. | ||
| 180 | - | func (x *FontButton) ConnectFontSet(cb func(FontButton)) uint32 { | 190 | + | func (x *FontButton) ConnectFontSet(cb *func(FontButton)) uint32 { |
| 191 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 192 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 193 | + | return gobject.SignalConnect(x.GoPointer(), "font-set", cbRefPtr) | |||
| 194 | + | } | |||
| 195 | + | ||||
| 181 | fcb := func(clsPtr uintptr) { | 196 | fcb := func(clsPtr uintptr) { | ||
| 182 | fa := FontButton{} | 197 | fa := FontButton{} | ||
| 183 | fa.Ptr = clsPtr | 198 | fa.Ptr = clsPtr | ||
| 199 | + | cbFn := *cb | |||
| 184 | 200 | ||||
| 185 | - | cb(fa) | 201 | + | cbFn(fa) |
| 186 | 202 | ||||
| 187 | } | 203 | } | ||
| 188 | - | return gobject.SignalConnect(x.GoPointer(), "font-set", purego.NewCallback(fcb)) | 204 | + | cbRefPtr := purego.NewCallback(fcb) |
| 205 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 206 | + | return gobject.SignalConnect(x.GoPointer(), "font-set", cbRefPtr) | |||
| 189 | } | 207 | } | ||
| 190 | 208 | ||||
| 191 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 209 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
| @@ -463,9 +481,9 @@ func (x *FontButton) GetShowPreviewEntry() bool { | |||||
| 463 | 481 | ||||
| 464 | // Adds a filter function that decides which fonts to display | 482 | // Adds a filter function that decides which fonts to display | ||
| 465 | // in the font chooser. | 483 | // in the font chooser. | ||
| 466 | - | func (x *FontButton) SetFilterFunc(FilterVar FontFilterFunc, UserDataVar uintptr, DestroyVar glib.DestroyNotify) { | 484 | + | func (x *FontButton) SetFilterFunc(FilterVar *FontFilterFunc, UserDataVar uintptr, DestroyVar *glib.DestroyNotify) { |
| 467 | 485 | ||||
| 468 | - | XGtkFontChooserSetFilterFunc(x.GoPointer(), purego.NewCallback(FilterVar), UserDataVar, purego.NewCallback(DestroyVar)) | 486 | + | XGtkFontChooserSetFilterFunc(x.GoPointer(), glib.NewCallback(FilterVar), UserDataVar, glib.NewCallback(DestroyVar)) |
| 469 | 487 | ||||
| 470 | } | 488 | } | ||
| 471 | 489 | ||||
M v4/gtk/gtkfontchooser.go +3 -3
| @@ -47,7 +47,7 @@ type FontChooser interface { | |||||
| 47 | GetLevel() FontChooserLevel | 47 | GetLevel() FontChooserLevel | ||
| 48 | GetPreviewText() string | 48 | GetPreviewText() string | ||
| 49 | GetShowPreviewEntry() bool | 49 | GetShowPreviewEntry() bool | ||
| 50 | - | SetFilterFunc(FilterVar FontFilterFunc, UserDataVar uintptr, DestroyVar glib.DestroyNotify) | 50 | + | SetFilterFunc(FilterVar *FontFilterFunc, UserDataVar uintptr, DestroyVar *glib.DestroyNotify) |
| 51 | SetFont(FontnameVar string) | 51 | SetFont(FontnameVar string) | ||
| 52 | SetFontDesc(FontDescVar *pango.FontDescription) | 52 | SetFontDesc(FontDescVar *pango.FontDescription) | ||
| 53 | SetFontMap(FontmapVar *pango.FontMap) | 53 | SetFontMap(FontmapVar *pango.FontMap) | ||
| @@ -200,9 +200,9 @@ func (x *FontChooserBase) GetShowPreviewEntry() bool { | |||||
| 200 | 200 | ||||
| 201 | // Adds a filter function that decides which fonts to display | 201 | // Adds a filter function that decides which fonts to display | ||
| 202 | // in the font chooser. | 202 | // in the font chooser. | ||
| 203 | - | func (x *FontChooserBase) SetFilterFunc(FilterVar FontFilterFunc, UserDataVar uintptr, DestroyVar glib.DestroyNotify) { | 203 | + | func (x *FontChooserBase) SetFilterFunc(FilterVar *FontFilterFunc, UserDataVar uintptr, DestroyVar *glib.DestroyNotify) { |
| 204 | 204 | ||||
| 205 | - | XGtkFontChooserSetFilterFunc(x.GoPointer(), purego.NewCallback(FilterVar), UserDataVar, purego.NewCallback(DestroyVar)) | 205 | + | XGtkFontChooserSetFilterFunc(x.GoPointer(), glib.NewCallback(FilterVar), UserDataVar, glib.NewCallback(DestroyVar)) |
| 206 | 206 | ||||
| 207 | } | 207 | } | ||
| 208 | 208 | ||||
M v4/gtk/gtkfontchooserdialog.go +2 -2
| @@ -335,9 +335,9 @@ func (x *FontChooserDialog) GetShowPreviewEntry() bool { | |||||
| 335 | 335 | ||||
| 336 | // Adds a filter function that decides which fonts to display | 336 | // Adds a filter function that decides which fonts to display | ||
| 337 | // in the font chooser. | 337 | // in the font chooser. | ||
| 338 | - | func (x *FontChooserDialog) SetFilterFunc(FilterVar FontFilterFunc, UserDataVar uintptr, DestroyVar glib.DestroyNotify) { | 338 | + | func (x *FontChooserDialog) SetFilterFunc(FilterVar *FontFilterFunc, UserDataVar uintptr, DestroyVar *glib.DestroyNotify) { |
| 339 | 339 | ||||
| 340 | - | XGtkFontChooserSetFilterFunc(x.GoPointer(), purego.NewCallback(FilterVar), UserDataVar, purego.NewCallback(DestroyVar)) | 340 | + | XGtkFontChooserSetFilterFunc(x.GoPointer(), glib.NewCallback(FilterVar), UserDataVar, glib.NewCallback(DestroyVar)) |
| 341 | 341 | ||||
| 342 | } | 342 | } | ||
| 343 | 343 | ||||
M v4/gtk/gtkfontchooserwidget.go +2 -2
| @@ -336,9 +336,9 @@ func (x *FontChooserWidget) GetShowPreviewEntry() bool { | |||||
| 336 | 336 | ||||
| 337 | // Adds a filter function that decides which fonts to display | 337 | // Adds a filter function that decides which fonts to display | ||
| 338 | // in the font chooser. | 338 | // in the font chooser. | ||
| 339 | - | func (x *FontChooserWidget) SetFilterFunc(FilterVar FontFilterFunc, UserDataVar uintptr, DestroyVar glib.DestroyNotify) { | 339 | + | func (x *FontChooserWidget) SetFilterFunc(FilterVar *FontFilterFunc, UserDataVar uintptr, DestroyVar *glib.DestroyNotify) { |
| 340 | 340 | ||||
| 341 | - | XGtkFontChooserSetFilterFunc(x.GoPointer(), purego.NewCallback(FilterVar), UserDataVar, purego.NewCallback(DestroyVar)) | 341 | + | XGtkFontChooserSetFilterFunc(x.GoPointer(), glib.NewCallback(FilterVar), UserDataVar, glib.NewCallback(DestroyVar)) |
| 342 | 342 | ||||
| 343 | } | 343 | } | ||
| 344 | 344 | ||||
M v4/gtk/gtkgesture.go +55 -15
| @@ -402,15 +402,23 @@ func (c *Gesture) SetGoPointer(ptr uintptr) { | |||||
| 402 | // (eg. a third touch on a 2-touches gesture) is lifted, in that | 402 | // (eg. a third touch on a 2-touches gesture) is lifted, in that | ||
| 403 | // situation @sequence won't pertain to the current set of active | 403 | // situation @sequence won't pertain to the current set of active | ||
| 404 | // touches, so don't rely on this being true. | 404 | // touches, so don't rely on this being true. | ||
| 405 | - | func (x *Gesture) ConnectBegin(cb func(Gesture, uintptr)) uint32 { | 405 | + | func (x *Gesture) ConnectBegin(cb *func(Gesture, uintptr)) uint32 { |
| 406 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 407 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 408 | + | return gobject.SignalConnect(x.GoPointer(), "begin", cbRefPtr) | |||
| 409 | + | } | |||
| 410 | + | ||||
| 406 | fcb := func(clsPtr uintptr, SequenceVarp uintptr) { | 411 | fcb := func(clsPtr uintptr, SequenceVarp uintptr) { | ||
| 407 | fa := Gesture{} | 412 | fa := Gesture{} | ||
| 408 | fa.Ptr = clsPtr | 413 | fa.Ptr = clsPtr | ||
| 414 | + | cbFn := *cb | |||
| 409 | 415 | ||||
| 410 | - | cb(fa, SequenceVarp) | 416 | + | cbFn(fa, SequenceVarp) |
| 411 | 417 | ||||
| 412 | } | 418 | } | ||
| 413 | - | return gobject.SignalConnect(x.GoPointer(), "begin", purego.NewCallback(fcb)) | 419 | + | cbRefPtr := purego.NewCallback(fcb) |
| 420 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 421 | + | return gobject.SignalConnect(x.GoPointer(), "begin", cbRefPtr) | |||
| 414 | } | 422 | } | ||
| 415 | 423 | ||||
| 416 | // Emitted whenever a sequence is cancelled. | 424 | // Emitted whenever a sequence is cancelled. | ||
| @@ -423,15 +431,23 @@ func (x *Gesture) ConnectBegin(cb func(Gesture, uintptr)) uint32 { | |||||
| 423 | // | 431 | // | ||
| 424 | // @gesture must forget everything about @sequence as in | 432 | // @gesture must forget everything about @sequence as in | ||
| 425 | // response to this signal. | 433 | // response to this signal. | ||
| 426 | - | func (x *Gesture) ConnectCancel(cb func(Gesture, uintptr)) uint32 { | 434 | + | func (x *Gesture) ConnectCancel(cb *func(Gesture, uintptr)) uint32 { |
| 435 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 436 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 437 | + | return gobject.SignalConnect(x.GoPointer(), "cancel", cbRefPtr) | |||
| 438 | + | } | |||
| 439 | + | ||||
| 427 | fcb := func(clsPtr uintptr, SequenceVarp uintptr) { | 440 | fcb := func(clsPtr uintptr, SequenceVarp uintptr) { | ||
| 428 | fa := Gesture{} | 441 | fa := Gesture{} | ||
| 429 | fa.Ptr = clsPtr | 442 | fa.Ptr = clsPtr | ||
| 443 | + | cbFn := *cb | |||
| 430 | 444 | ||||
| 431 | - | cb(fa, SequenceVarp) | 445 | + | cbFn(fa, SequenceVarp) |
| 432 | 446 | ||||
| 433 | } | 447 | } | ||
| 434 | - | return gobject.SignalConnect(x.GoPointer(), "cancel", purego.NewCallback(fcb)) | 448 | + | cbRefPtr := purego.NewCallback(fcb) |
| 449 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 450 | + | return gobject.SignalConnect(x.GoPointer(), "cancel", cbRefPtr) | |||
| 435 | } | 451 | } | ||
| 436 | 452 | ||||
| 437 | // Emitted when @gesture either stopped recognizing the event | 453 | // Emitted when @gesture either stopped recognizing the event | ||
| @@ -443,44 +459,68 @@ func (x *Gesture) ConnectCancel(cb func(Gesture, uintptr)) uint32 { | |||||
| 443 | // pressed touch sequence that exceeds [property@Gtk.Gesture:n-points]). | 459 | // pressed touch sequence that exceeds [property@Gtk.Gesture:n-points]). | ||
| 444 | // This situation may be detected by checking through | 460 | // This situation may be detected by checking through | ||
| 445 | // [method@Gtk.Gesture.handles_sequence]. | 461 | // [method@Gtk.Gesture.handles_sequence]. | ||
| 446 | - | func (x *Gesture) ConnectEnd(cb func(Gesture, uintptr)) uint32 { | 462 | + | func (x *Gesture) ConnectEnd(cb *func(Gesture, uintptr)) uint32 { |
| 463 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 464 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 465 | + | return gobject.SignalConnect(x.GoPointer(), "end", cbRefPtr) | |||
| 466 | + | } | |||
| 467 | + | ||||
| 447 | fcb := func(clsPtr uintptr, SequenceVarp uintptr) { | 468 | fcb := func(clsPtr uintptr, SequenceVarp uintptr) { | ||
| 448 | fa := Gesture{} | 469 | fa := Gesture{} | ||
| 449 | fa.Ptr = clsPtr | 470 | fa.Ptr = clsPtr | ||
| 471 | + | cbFn := *cb | |||
| 450 | 472 | ||||
| 451 | - | cb(fa, SequenceVarp) | 473 | + | cbFn(fa, SequenceVarp) |
| 452 | 474 | ||||
| 453 | } | 475 | } | ||
| 454 | - | return gobject.SignalConnect(x.GoPointer(), "end", purego.NewCallback(fcb)) | 476 | + | cbRefPtr := purego.NewCallback(fcb) |
| 477 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 478 | + | return gobject.SignalConnect(x.GoPointer(), "end", cbRefPtr) | |||
| 455 | } | 479 | } | ||
| 456 | 480 | ||||
| 457 | // Emitted whenever a sequence state changes. | 481 | // Emitted whenever a sequence state changes. | ||
| 458 | // | 482 | // | ||
| 459 | // See [method@Gtk.Gesture.set_sequence_state] to know | 483 | // See [method@Gtk.Gesture.set_sequence_state] to know | ||
| 460 | // more about the expectable sequence lifetimes. | 484 | // more about the expectable sequence lifetimes. | ||
| 461 | - | func (x *Gesture) ConnectSequenceStateChanged(cb func(Gesture, uintptr, EventSequenceState)) uint32 { | 485 | + | func (x *Gesture) ConnectSequenceStateChanged(cb *func(Gesture, uintptr, EventSequenceState)) uint32 { |
| 486 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 487 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 488 | + | return gobject.SignalConnect(x.GoPointer(), "sequence-state-changed", cbRefPtr) | |||
| 489 | + | } | |||
| 490 | + | ||||
| 462 | fcb := func(clsPtr uintptr, SequenceVarp uintptr, StateVarp EventSequenceState) { | 491 | fcb := func(clsPtr uintptr, SequenceVarp uintptr, StateVarp EventSequenceState) { | ||
| 463 | fa := Gesture{} | 492 | fa := Gesture{} | ||
| 464 | fa.Ptr = clsPtr | 493 | fa.Ptr = clsPtr | ||
| 494 | + | cbFn := *cb | |||
| 465 | 495 | ||||
| 466 | - | cb(fa, SequenceVarp, StateVarp) | 496 | + | cbFn(fa, SequenceVarp, StateVarp) |
| 467 | 497 | ||||
| 468 | } | 498 | } | ||
| 469 | - | return gobject.SignalConnect(x.GoPointer(), "sequence-state-changed", purego.NewCallback(fcb)) | 499 | + | cbRefPtr := purego.NewCallback(fcb) |
| 500 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 501 | + | return gobject.SignalConnect(x.GoPointer(), "sequence-state-changed", cbRefPtr) | |||
| 470 | } | 502 | } | ||
| 471 | 503 | ||||
| 472 | // Emitted whenever an event is handled while the gesture is recognized. | 504 | // Emitted whenever an event is handled while the gesture is recognized. | ||
| 473 | // | 505 | // | ||
| 474 | // @sequence is guaranteed to pertain to the set of active touches. | 506 | // @sequence is guaranteed to pertain to the set of active touches. | ||
| 475 | - | func (x *Gesture) ConnectUpdate(cb func(Gesture, uintptr)) uint32 { | 507 | + | func (x *Gesture) ConnectUpdate(cb *func(Gesture, uintptr)) uint32 { |
| 508 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 509 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 510 | + | return gobject.SignalConnect(x.GoPointer(), "update", cbRefPtr) | |||
| 511 | + | } | |||
| 512 | + | ||||
| 476 | fcb := func(clsPtr uintptr, SequenceVarp uintptr) { | 513 | fcb := func(clsPtr uintptr, SequenceVarp uintptr) { | ||
| 477 | fa := Gesture{} | 514 | fa := Gesture{} | ||
| 478 | fa.Ptr = clsPtr | 515 | fa.Ptr = clsPtr | ||
| 516 | + | cbFn := *cb | |||
| 479 | 517 | ||||
| 480 | - | cb(fa, SequenceVarp) | 518 | + | cbFn(fa, SequenceVarp) |
| 481 | 519 | ||||
| 482 | } | 520 | } | ||
| 483 | - | return gobject.SignalConnect(x.GoPointer(), "update", purego.NewCallback(fcb)) | 521 | + | cbRefPtr := purego.NewCallback(fcb) |
| 522 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 523 | + | return gobject.SignalConnect(x.GoPointer(), "update", cbRefPtr) | |||
| 484 | } | 524 | } | ||
| 485 | 525 | ||||
| 486 | func init() { | 526 | func init() { | ||
M v4/gtk/gtkgestureclick.go +45 -12
| @@ -6,6 +6,7 @@ import ( | |||||
| 6 | 6 | ||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 9 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 10 | ) | 11 | ) | ||
| 11 | 12 | ||||
| @@ -59,15 +60,23 @@ func (c *GestureClick) SetGoPointer(ptr uintptr) { | |||||
| 59 | } | 60 | } | ||
| 60 | 61 | ||||
| 61 | // Emitted whenever a button or touch press happens. | 62 | // Emitted whenever a button or touch press happens. | ||
| 62 | - | func (x *GestureClick) ConnectPressed(cb func(GestureClick, int, float64, float64)) uint32 { | 63 | + | func (x *GestureClick) ConnectPressed(cb *func(GestureClick, int, float64, float64)) uint32 { |
| 64 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 65 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 66 | + | return gobject.SignalConnect(x.GoPointer(), "pressed", cbRefPtr) | |||
| 67 | + | } | |||
| 68 | + | ||||
| 63 | fcb := func(clsPtr uintptr, NPressVarp int, XVarp float64, YVarp float64) { | 69 | fcb := func(clsPtr uintptr, NPressVarp int, XVarp float64, YVarp float64) { | ||
| 64 | fa := GestureClick{} | 70 | fa := GestureClick{} | ||
| 65 | fa.Ptr = clsPtr | 71 | fa.Ptr = clsPtr | ||
| 72 | + | cbFn := *cb | |||
| 66 | 73 | ||||
| 67 | - | cb(fa, NPressVarp, XVarp, YVarp) | 74 | + | cbFn(fa, NPressVarp, XVarp, YVarp) |
| 68 | 75 | ||||
| 69 | } | 76 | } | ||
| 70 | - | return gobject.SignalConnect(x.GoPointer(), "pressed", purego.NewCallback(fcb)) | 77 | + | cbRefPtr := purego.NewCallback(fcb) |
| 78 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 79 | + | return gobject.SignalConnect(x.GoPointer(), "pressed", cbRefPtr) | |||
| 71 | } | 80 | } | ||
| 72 | 81 | ||||
| 73 | // Emitted when a button or touch is released. | 82 | // Emitted when a button or touch is released. | ||
| @@ -76,27 +85,43 @@ func (x *GestureClick) ConnectPressed(cb func(GestureClick, int, float64, float6 | |||||
| 76 | // this event, note that [signal@Gtk.GestureClick::stopped] may | 85 | // this event, note that [signal@Gtk.GestureClick::stopped] may | ||
| 77 | // have been emitted between the press and its release, @n_press | 86 | // have been emitted between the press and its release, @n_press | ||
| 78 | // will only start over at the next press. | 87 | // will only start over at the next press. | ||
| 79 | - | func (x *GestureClick) ConnectReleased(cb func(GestureClick, int, float64, float64)) uint32 { | 88 | + | func (x *GestureClick) ConnectReleased(cb *func(GestureClick, int, float64, float64)) uint32 { |
| 89 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 90 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 91 | + | return gobject.SignalConnect(x.GoPointer(), "released", cbRefPtr) | |||
| 92 | + | } | |||
| 93 | + | ||||
| 80 | fcb := func(clsPtr uintptr, NPressVarp int, XVarp float64, YVarp float64) { | 94 | fcb := func(clsPtr uintptr, NPressVarp int, XVarp float64, YVarp float64) { | ||
| 81 | fa := GestureClick{} | 95 | fa := GestureClick{} | ||
| 82 | fa.Ptr = clsPtr | 96 | fa.Ptr = clsPtr | ||
| 97 | + | cbFn := *cb | |||
| 83 | 98 | ||||
| 84 | - | cb(fa, NPressVarp, XVarp, YVarp) | 99 | + | cbFn(fa, NPressVarp, XVarp, YVarp) |
| 85 | 100 | ||||
| 86 | } | 101 | } | ||
| 87 | - | return gobject.SignalConnect(x.GoPointer(), "released", purego.NewCallback(fcb)) | 102 | + | cbRefPtr := purego.NewCallback(fcb) |
| 103 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 104 | + | return gobject.SignalConnect(x.GoPointer(), "released", cbRefPtr) | |||
| 88 | } | 105 | } | ||
| 89 | 106 | ||||
| 90 | // Emitted whenever any time/distance threshold has been exceeded. | 107 | // Emitted whenever any time/distance threshold has been exceeded. | ||
| 91 | - | func (x *GestureClick) ConnectStopped(cb func(GestureClick)) uint32 { | 108 | + | func (x *GestureClick) ConnectStopped(cb *func(GestureClick)) uint32 { |
| 109 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 110 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 111 | + | return gobject.SignalConnect(x.GoPointer(), "stopped", cbRefPtr) | |||
| 112 | + | } | |||
| 113 | + | ||||
| 92 | fcb := func(clsPtr uintptr) { | 114 | fcb := func(clsPtr uintptr) { | ||
| 93 | fa := GestureClick{} | 115 | fa := GestureClick{} | ||
| 94 | fa.Ptr = clsPtr | 116 | fa.Ptr = clsPtr | ||
| 117 | + | cbFn := *cb | |||
| 95 | 118 | ||||
| 96 | - | cb(fa) | 119 | + | cbFn(fa) |
| 97 | 120 | ||||
| 98 | } | 121 | } | ||
| 99 | - | return gobject.SignalConnect(x.GoPointer(), "stopped", purego.NewCallback(fcb)) | 122 | + | cbRefPtr := purego.NewCallback(fcb) |
| 123 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 124 | + | return gobject.SignalConnect(x.GoPointer(), "stopped", cbRefPtr) | |||
| 100 | } | 125 | } | ||
| 101 | 126 | ||||
| 102 | // Emitted whenever the gesture receives a release | 127 | // Emitted whenever the gesture receives a release | ||
| @@ -105,15 +130,23 @@ func (x *GestureClick) ConnectStopped(cb func(GestureClick)) uint32 { | |||||
| 105 | // Due to implicit grabs, this can only happen on situations | 130 | // Due to implicit grabs, this can only happen on situations | ||
| 106 | // where input is grabbed elsewhere mid-press or the pressed | 131 | // where input is grabbed elsewhere mid-press or the pressed | ||
| 107 | // widget voluntarily relinquishes its implicit grab. | 132 | // widget voluntarily relinquishes its implicit grab. | ||
| 108 | - | func (x *GestureClick) ConnectUnpairedRelease(cb func(GestureClick, float64, float64, uint, uintptr)) uint32 { | 133 | + | func (x *GestureClick) ConnectUnpairedRelease(cb *func(GestureClick, float64, float64, uint, uintptr)) uint32 { |
| 134 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 135 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 136 | + | return gobject.SignalConnect(x.GoPointer(), "unpaired-release", cbRefPtr) | |||
| 137 | + | } | |||
| 138 | + | ||||
| 109 | fcb := func(clsPtr uintptr, XVarp float64, YVarp float64, ButtonVarp uint, SequenceVarp uintptr) { | 139 | fcb := func(clsPtr uintptr, XVarp float64, YVarp float64, ButtonVarp uint, SequenceVarp uintptr) { | ||
| 110 | fa := GestureClick{} | 140 | fa := GestureClick{} | ||
| 111 | fa.Ptr = clsPtr | 141 | fa.Ptr = clsPtr | ||
| 142 | + | cbFn := *cb | |||
| 112 | 143 | ||||
| 113 | - | cb(fa, XVarp, YVarp, ButtonVarp, SequenceVarp) | 144 | + | cbFn(fa, XVarp, YVarp, ButtonVarp, SequenceVarp) |
| 114 | 145 | ||||
| 115 | } | 146 | } | ||
| 116 | - | return gobject.SignalConnect(x.GoPointer(), "unpaired-release", purego.NewCallback(fcb)) | 147 | + | cbRefPtr := purego.NewCallback(fcb) |
| 148 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 149 | + | return gobject.SignalConnect(x.GoPointer(), "unpaired-release", cbRefPtr) | |||
| 117 | } | 150 | } | ||
| 118 | 151 | ||||
| 119 | func init() { | 152 | func init() { | ||
M v4/gtk/gtkgesturedrag.go +34 -9
| @@ -6,6 +6,7 @@ import ( | |||||
| 6 | 6 | ||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 9 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 10 | ) | 11 | ) | ||
| 11 | 12 | ||||
| @@ -86,39 +87,63 @@ func (c *GestureDrag) SetGoPointer(ptr uintptr) { | |||||
| 86 | } | 87 | } | ||
| 87 | 88 | ||||
| 88 | // Emitted whenever dragging starts. | 89 | // Emitted whenever dragging starts. | ||
| 89 | - | func (x *GestureDrag) ConnectDragBegin(cb func(GestureDrag, float64, float64)) uint32 { | 90 | + | func (x *GestureDrag) ConnectDragBegin(cb *func(GestureDrag, float64, float64)) uint32 { |
| 91 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 92 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 93 | + | return gobject.SignalConnect(x.GoPointer(), "drag-begin", cbRefPtr) | |||
| 94 | + | } | |||
| 95 | + | ||||
| 90 | fcb := func(clsPtr uintptr, StartXVarp float64, StartYVarp float64) { | 96 | fcb := func(clsPtr uintptr, StartXVarp float64, StartYVarp float64) { | ||
| 91 | fa := GestureDrag{} | 97 | fa := GestureDrag{} | ||
| 92 | fa.Ptr = clsPtr | 98 | fa.Ptr = clsPtr | ||
| 99 | + | cbFn := *cb | |||
| 93 | 100 | ||||
| 94 | - | cb(fa, StartXVarp, StartYVarp) | 101 | + | cbFn(fa, StartXVarp, StartYVarp) |
| 95 | 102 | ||||
| 96 | } | 103 | } | ||
| 97 | - | return gobject.SignalConnect(x.GoPointer(), "drag-begin", purego.NewCallback(fcb)) | 104 | + | cbRefPtr := purego.NewCallback(fcb) |
| 105 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 106 | + | return gobject.SignalConnect(x.GoPointer(), "drag-begin", cbRefPtr) | |||
| 98 | } | 107 | } | ||
| 99 | 108 | ||||
| 100 | // Emitted whenever the dragging is finished. | 109 | // Emitted whenever the dragging is finished. | ||
| 101 | - | func (x *GestureDrag) ConnectDragEnd(cb func(GestureDrag, float64, float64)) uint32 { | 110 | + | func (x *GestureDrag) ConnectDragEnd(cb *func(GestureDrag, float64, float64)) uint32 { |
| 111 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 112 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 113 | + | return gobject.SignalConnect(x.GoPointer(), "drag-end", cbRefPtr) | |||
| 114 | + | } | |||
| 115 | + | ||||
| 102 | fcb := func(clsPtr uintptr, OffsetXVarp float64, OffsetYVarp float64) { | 116 | fcb := func(clsPtr uintptr, OffsetXVarp float64, OffsetYVarp float64) { | ||
| 103 | fa := GestureDrag{} | 117 | fa := GestureDrag{} | ||
| 104 | fa.Ptr = clsPtr | 118 | fa.Ptr = clsPtr | ||
| 119 | + | cbFn := *cb | |||
| 105 | 120 | ||||
| 106 | - | cb(fa, OffsetXVarp, OffsetYVarp) | 121 | + | cbFn(fa, OffsetXVarp, OffsetYVarp) |
| 107 | 122 | ||||
| 108 | } | 123 | } | ||
| 109 | - | return gobject.SignalConnect(x.GoPointer(), "drag-end", purego.NewCallback(fcb)) | 124 | + | cbRefPtr := purego.NewCallback(fcb) |
| 125 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 126 | + | return gobject.SignalConnect(x.GoPointer(), "drag-end", cbRefPtr) | |||
| 110 | } | 127 | } | ||
| 111 | 128 | ||||
| 112 | // Emitted whenever the dragging point moves. | 129 | // Emitted whenever the dragging point moves. | ||
| 113 | - | func (x *GestureDrag) ConnectDragUpdate(cb func(GestureDrag, float64, float64)) uint32 { | 130 | + | func (x *GestureDrag) ConnectDragUpdate(cb *func(GestureDrag, float64, float64)) uint32 { |
| 131 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 132 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 133 | + | return gobject.SignalConnect(x.GoPointer(), "drag-update", cbRefPtr) | |||
| 134 | + | } | |||
| 135 | + | ||||
| 114 | fcb := func(clsPtr uintptr, OffsetXVarp float64, OffsetYVarp float64) { | 136 | fcb := func(clsPtr uintptr, OffsetXVarp float64, OffsetYVarp float64) { | ||
| 115 | fa := GestureDrag{} | 137 | fa := GestureDrag{} | ||
| 116 | fa.Ptr = clsPtr | 138 | fa.Ptr = clsPtr | ||
| 139 | + | cbFn := *cb | |||
| 117 | 140 | ||||
| 118 | - | cb(fa, OffsetXVarp, OffsetYVarp) | 141 | + | cbFn(fa, OffsetXVarp, OffsetYVarp) |
| 119 | 142 | ||||
| 120 | } | 143 | } | ||
| 121 | - | return gobject.SignalConnect(x.GoPointer(), "drag-update", purego.NewCallback(fcb)) | 144 | + | cbRefPtr := purego.NewCallback(fcb) |
| 145 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 146 | + | return gobject.SignalConnect(x.GoPointer(), "drag-update", cbRefPtr) | |||
| 122 | } | 147 | } | ||
| 123 | 148 | ||||
| 124 | func init() { | 149 | func init() { | ||
M v4/gtk/gtkgesturelongpress.go +23 -6
| @@ -6,6 +6,7 @@ import ( | |||||
| 6 | 6 | ||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 9 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 10 | ) | 11 | ) | ||
| 11 | 12 | ||||
| @@ -88,28 +89,44 @@ func (c *GestureLongPress) SetGoPointer(ptr uintptr) { | |||||
| 88 | 89 | ||||
| 89 | // Emitted whenever a press moved too far, or was released | 90 | // Emitted whenever a press moved too far, or was released | ||
| 90 | // before [signal@Gtk.GestureLongPress::pressed] happened. | 91 | // before [signal@Gtk.GestureLongPress::pressed] happened. | ||
| 91 | - | func (x *GestureLongPress) ConnectCancelled(cb func(GestureLongPress)) uint32 { | 92 | + | func (x *GestureLongPress) ConnectCancelled(cb *func(GestureLongPress)) uint32 { |
| 93 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 94 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 95 | + | return gobject.SignalConnect(x.GoPointer(), "cancelled", cbRefPtr) | |||
| 96 | + | } | |||
| 97 | + | ||||
| 92 | fcb := func(clsPtr uintptr) { | 98 | fcb := func(clsPtr uintptr) { | ||
| 93 | fa := GestureLongPress{} | 99 | fa := GestureLongPress{} | ||
| 94 | fa.Ptr = clsPtr | 100 | fa.Ptr = clsPtr | ||
| 101 | + | cbFn := *cb | |||
| 95 | 102 | ||||
| 96 | - | cb(fa) | 103 | + | cbFn(fa) |
| 97 | 104 | ||||
| 98 | } | 105 | } | ||
| 99 | - | return gobject.SignalConnect(x.GoPointer(), "cancelled", purego.NewCallback(fcb)) | 106 | + | cbRefPtr := purego.NewCallback(fcb) |
| 107 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 108 | + | return gobject.SignalConnect(x.GoPointer(), "cancelled", cbRefPtr) | |||
| 100 | } | 109 | } | ||
| 101 | 110 | ||||
| 102 | // Emitted whenever a press goes unmoved/unreleased longer than | 111 | // Emitted whenever a press goes unmoved/unreleased longer than | ||
| 103 | // what the GTK defaults tell. | 112 | // what the GTK defaults tell. | ||
| 104 | - | func (x *GestureLongPress) ConnectPressed(cb func(GestureLongPress, float64, float64)) uint32 { | 113 | + | func (x *GestureLongPress) ConnectPressed(cb *func(GestureLongPress, float64, float64)) uint32 { |
| 114 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 115 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 116 | + | return gobject.SignalConnect(x.GoPointer(), "pressed", cbRefPtr) | |||
| 117 | + | } | |||
| 118 | + | ||||
| 105 | fcb := func(clsPtr uintptr, XVarp float64, YVarp float64) { | 119 | fcb := func(clsPtr uintptr, XVarp float64, YVarp float64) { | ||
| 106 | fa := GestureLongPress{} | 120 | fa := GestureLongPress{} | ||
| 107 | fa.Ptr = clsPtr | 121 | fa.Ptr = clsPtr | ||
| 122 | + | cbFn := *cb | |||
| 108 | 123 | ||||
| 109 | - | cb(fa, XVarp, YVarp) | 124 | + | cbFn(fa, XVarp, YVarp) |
| 110 | 125 | ||||
| 111 | } | 126 | } | ||
| 112 | - | return gobject.SignalConnect(x.GoPointer(), "pressed", purego.NewCallback(fcb)) | 127 | + | cbRefPtr := purego.NewCallback(fcb) |
| 128 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 129 | + | return gobject.SignalConnect(x.GoPointer(), "pressed", cbRefPtr) | |||
| 113 | } | 130 | } | ||
| 114 | 131 | ||||
| 115 | func init() { | 132 | func init() { | ||
M v4/gtk/gtkgesturepan.go +12 -3
| @@ -6,6 +6,7 @@ import ( | |||||
| 6 | 6 | ||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 9 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 10 | ) | 11 | ) | ||
| 11 | 12 | ||||
| @@ -83,15 +84,23 @@ func (c *GesturePan) SetGoPointer(ptr uintptr) { | |||||
| 83 | } | 84 | } | ||
| 84 | 85 | ||||
| 85 | // Emitted once a panning gesture along the expected axis is detected. | 86 | // Emitted once a panning gesture along the expected axis is detected. | ||
| 86 | - | func (x *GesturePan) ConnectPan(cb func(GesturePan, PanDirection, float64)) uint32 { | 87 | + | func (x *GesturePan) ConnectPan(cb *func(GesturePan, PanDirection, float64)) uint32 { |
| 88 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 89 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 90 | + | return gobject.SignalConnect(x.GoPointer(), "pan", cbRefPtr) | |||
| 91 | + | } | |||
| 92 | + | ||||
| 87 | fcb := func(clsPtr uintptr, DirectionVarp PanDirection, OffsetVarp float64) { | 93 | fcb := func(clsPtr uintptr, DirectionVarp PanDirection, OffsetVarp float64) { | ||
| 88 | fa := GesturePan{} | 94 | fa := GesturePan{} | ||
| 89 | fa.Ptr = clsPtr | 95 | fa.Ptr = clsPtr | ||
| 96 | + | cbFn := *cb | |||
| 90 | 97 | ||||
| 91 | - | cb(fa, DirectionVarp, OffsetVarp) | 98 | + | cbFn(fa, DirectionVarp, OffsetVarp) |
| 92 | 99 | ||||
| 93 | } | 100 | } | ||
| 94 | - | return gobject.SignalConnect(x.GoPointer(), "pan", purego.NewCallback(fcb)) | 101 | + | cbRefPtr := purego.NewCallback(fcb) |
| 102 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 103 | + | return gobject.SignalConnect(x.GoPointer(), "pan", cbRefPtr) | |||
| 95 | } | 104 | } | ||
| 96 | 105 | ||||
| 97 | func init() { | 106 | func init() { | ||
M v4/gtk/gtkgesturerotate.go +12 -3
| @@ -6,6 +6,7 @@ import ( | |||||
| 6 | 6 | ||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 9 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 10 | ) | 11 | ) | ||
| 11 | 12 | ||||
| @@ -69,15 +70,23 @@ func (c *GestureRotate) SetGoPointer(ptr uintptr) { | |||||
| 69 | } | 70 | } | ||
| 70 | 71 | ||||
| 71 | // Emitted when the angle between both tracked points changes. | 72 | // Emitted when the angle between both tracked points changes. | ||
| 72 | - | func (x *GestureRotate) ConnectAngleChanged(cb func(GestureRotate, float64, float64)) uint32 { | 73 | + | func (x *GestureRotate) ConnectAngleChanged(cb *func(GestureRotate, float64, float64)) uint32 { |
| 74 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 75 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 76 | + | return gobject.SignalConnect(x.GoPointer(), "angle-changed", cbRefPtr) | |||
| 77 | + | } | |||
| 78 | + | ||||
| 73 | fcb := func(clsPtr uintptr, AngleVarp float64, AngleDeltaVarp float64) { | 79 | fcb := func(clsPtr uintptr, AngleVarp float64, AngleDeltaVarp float64) { | ||
| 74 | fa := GestureRotate{} | 80 | fa := GestureRotate{} | ||
| 75 | fa.Ptr = clsPtr | 81 | fa.Ptr = clsPtr | ||
| 82 | + | cbFn := *cb | |||
| 76 | 83 | ||||
| 77 | - | cb(fa, AngleVarp, AngleDeltaVarp) | 84 | + | cbFn(fa, AngleVarp, AngleDeltaVarp) |
| 78 | 85 | ||||
| 79 | } | 86 | } | ||
| 80 | - | return gobject.SignalConnect(x.GoPointer(), "angle-changed", purego.NewCallback(fcb)) | 87 | + | cbRefPtr := purego.NewCallback(fcb) |
| 88 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 89 | + | return gobject.SignalConnect(x.GoPointer(), "angle-changed", cbRefPtr) | |||
| 81 | } | 90 | } | ||
| 82 | 91 | ||||
| 83 | func init() { | 92 | func init() { | ||
M v4/gtk/gtkgesturestylus.go +45 -12
| @@ -7,6 +7,7 @@ import ( | |||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | ||
| 10 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | 11 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 11 | ) | 12 | ) | ||
| 12 | 13 | ||||
| @@ -127,51 +128,83 @@ func (c *GestureStylus) SetGoPointer(ptr uintptr) { | |||||
| 127 | } | 128 | } | ||
| 128 | 129 | ||||
| 129 | // Emitted when the stylus touches the device. | 130 | // Emitted when the stylus touches the device. | ||
| 130 | - | func (x *GestureStylus) ConnectDown(cb func(GestureStylus, float64, float64)) uint32 { | 131 | + | func (x *GestureStylus) ConnectDown(cb *func(GestureStylus, float64, float64)) uint32 { |
| 132 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 133 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 134 | + | return gobject.SignalConnect(x.GoPointer(), "down", cbRefPtr) | |||
| 135 | + | } | |||
| 136 | + | ||||
| 131 | fcb := func(clsPtr uintptr, XVarp float64, YVarp float64) { | 137 | fcb := func(clsPtr uintptr, XVarp float64, YVarp float64) { | ||
| 132 | fa := GestureStylus{} | 138 | fa := GestureStylus{} | ||
| 133 | fa.Ptr = clsPtr | 139 | fa.Ptr = clsPtr | ||
| 140 | + | cbFn := *cb | |||
| 134 | 141 | ||||
| 135 | - | cb(fa, XVarp, YVarp) | 142 | + | cbFn(fa, XVarp, YVarp) |
| 136 | 143 | ||||
| 137 | } | 144 | } | ||
| 138 | - | return gobject.SignalConnect(x.GoPointer(), "down", purego.NewCallback(fcb)) | 145 | + | cbRefPtr := purego.NewCallback(fcb) |
| 146 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 147 | + | return gobject.SignalConnect(x.GoPointer(), "down", cbRefPtr) | |||
| 139 | } | 148 | } | ||
| 140 | 149 | ||||
| 141 | // Emitted when the stylus moves while touching the device. | 150 | // Emitted when the stylus moves while touching the device. | ||
| 142 | - | func (x *GestureStylus) ConnectMotion(cb func(GestureStylus, float64, float64)) uint32 { | 151 | + | func (x *GestureStylus) ConnectMotion(cb *func(GestureStylus, float64, float64)) uint32 { |
| 152 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 153 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 154 | + | return gobject.SignalConnect(x.GoPointer(), "motion", cbRefPtr) | |||
| 155 | + | } | |||
| 156 | + | ||||
| 143 | fcb := func(clsPtr uintptr, XVarp float64, YVarp float64) { | 157 | fcb := func(clsPtr uintptr, XVarp float64, YVarp float64) { | ||
| 144 | fa := GestureStylus{} | 158 | fa := GestureStylus{} | ||
| 145 | fa.Ptr = clsPtr | 159 | fa.Ptr = clsPtr | ||
| 160 | + | cbFn := *cb | |||
| 146 | 161 | ||||
| 147 | - | cb(fa, XVarp, YVarp) | 162 | + | cbFn(fa, XVarp, YVarp) |
| 148 | 163 | ||||
| 149 | } | 164 | } | ||
| 150 | - | return gobject.SignalConnect(x.GoPointer(), "motion", purego.NewCallback(fcb)) | 165 | + | cbRefPtr := purego.NewCallback(fcb) |
| 166 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 167 | + | return gobject.SignalConnect(x.GoPointer(), "motion", cbRefPtr) | |||
| 151 | } | 168 | } | ||
| 152 | 169 | ||||
| 153 | // Emitted when the stylus is in proximity of the device. | 170 | // Emitted when the stylus is in proximity of the device. | ||
| 154 | - | func (x *GestureStylus) ConnectProximity(cb func(GestureStylus, float64, float64)) uint32 { | 171 | + | func (x *GestureStylus) ConnectProximity(cb *func(GestureStylus, float64, float64)) uint32 { |
| 172 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 173 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 174 | + | return gobject.SignalConnect(x.GoPointer(), "proximity", cbRefPtr) | |||
| 175 | + | } | |||
| 176 | + | ||||
| 155 | fcb := func(clsPtr uintptr, XVarp float64, YVarp float64) { | 177 | fcb := func(clsPtr uintptr, XVarp float64, YVarp float64) { | ||
| 156 | fa := GestureStylus{} | 178 | fa := GestureStylus{} | ||
| 157 | fa.Ptr = clsPtr | 179 | fa.Ptr = clsPtr | ||
| 180 | + | cbFn := *cb | |||
| 158 | 181 | ||||
| 159 | - | cb(fa, XVarp, YVarp) | 182 | + | cbFn(fa, XVarp, YVarp) |
| 160 | 183 | ||||
| 161 | } | 184 | } | ||
| 162 | - | return gobject.SignalConnect(x.GoPointer(), "proximity", purego.NewCallback(fcb)) | 185 | + | cbRefPtr := purego.NewCallback(fcb) |
| 186 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 187 | + | return gobject.SignalConnect(x.GoPointer(), "proximity", cbRefPtr) | |||
| 163 | } | 188 | } | ||
| 164 | 189 | ||||
| 165 | // Emitted when the stylus no longer touches the device. | 190 | // Emitted when the stylus no longer touches the device. | ||
| 166 | - | func (x *GestureStylus) ConnectUp(cb func(GestureStylus, float64, float64)) uint32 { | 191 | + | func (x *GestureStylus) ConnectUp(cb *func(GestureStylus, float64, float64)) uint32 { |
| 192 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 193 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 194 | + | return gobject.SignalConnect(x.GoPointer(), "up", cbRefPtr) | |||
| 195 | + | } | |||
| 196 | + | ||||
| 167 | fcb := func(clsPtr uintptr, XVarp float64, YVarp float64) { | 197 | fcb := func(clsPtr uintptr, XVarp float64, YVarp float64) { | ||
| 168 | fa := GestureStylus{} | 198 | fa := GestureStylus{} | ||
| 169 | fa.Ptr = clsPtr | 199 | fa.Ptr = clsPtr | ||
| 200 | + | cbFn := *cb | |||
| 170 | 201 | ||||
| 171 | - | cb(fa, XVarp, YVarp) | 202 | + | cbFn(fa, XVarp, YVarp) |
| 172 | 203 | ||||
| 173 | } | 204 | } | ||
| 174 | - | return gobject.SignalConnect(x.GoPointer(), "up", purego.NewCallback(fcb)) | 205 | + | cbRefPtr := purego.NewCallback(fcb) |
| 206 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 207 | + | return gobject.SignalConnect(x.GoPointer(), "up", cbRefPtr) | |||
| 175 | } | 208 | } | ||
| 176 | 209 | ||||
| 177 | func init() { | 210 | func init() { | ||
M v4/gtk/gtkgestureswipe.go +12 -3
| @@ -6,6 +6,7 @@ import ( | |||||
| 6 | 6 | ||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 9 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 10 | ) | 11 | ) | ||
| 11 | 12 | ||||
| @@ -78,15 +79,23 @@ func (c *GestureSwipe) SetGoPointer(ptr uintptr) { | |||||
| 78 | // Emitted when the recognized gesture is finished. | 79 | // Emitted when the recognized gesture is finished. | ||
| 79 | // | 80 | // | ||
| 80 | // Velocity and direction are a product of previously recorded events. | 81 | // Velocity and direction are a product of previously recorded events. | ||
| 81 | - | func (x *GestureSwipe) ConnectSwipe(cb func(GestureSwipe, float64, float64)) uint32 { | 82 | + | func (x *GestureSwipe) ConnectSwipe(cb *func(GestureSwipe, float64, float64)) uint32 { |
| 83 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 84 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 85 | + | return gobject.SignalConnect(x.GoPointer(), "swipe", cbRefPtr) | |||
| 86 | + | } | |||
| 87 | + | ||||
| 82 | fcb := func(clsPtr uintptr, VelocityXVarp float64, VelocityYVarp float64) { | 88 | fcb := func(clsPtr uintptr, VelocityXVarp float64, VelocityYVarp float64) { | ||
| 83 | fa := GestureSwipe{} | 89 | fa := GestureSwipe{} | ||
| 84 | fa.Ptr = clsPtr | 90 | fa.Ptr = clsPtr | ||
| 91 | + | cbFn := *cb | |||
| 85 | 92 | ||||
| 86 | - | cb(fa, VelocityXVarp, VelocityYVarp) | 93 | + | cbFn(fa, VelocityXVarp, VelocityYVarp) |
| 87 | 94 | ||||
| 88 | } | 95 | } | ||
| 89 | - | return gobject.SignalConnect(x.GoPointer(), "swipe", purego.NewCallback(fcb)) | 96 | + | cbRefPtr := purego.NewCallback(fcb) |
| 97 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 98 | + | return gobject.SignalConnect(x.GoPointer(), "swipe", cbRefPtr) | |||
| 90 | } | 99 | } | ||
| 91 | 100 | ||||
| 92 | func init() { | 101 | func init() { | ||
M v4/gtk/gtkgesturezoom.go +12 -3
| @@ -6,6 +6,7 @@ import ( | |||||
| 6 | 6 | ||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 9 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 10 | ) | 11 | ) | ||
| 11 | 12 | ||||
| @@ -71,15 +72,23 @@ func (c *GestureZoom) SetGoPointer(ptr uintptr) { | |||||
| 71 | } | 72 | } | ||
| 72 | 73 | ||||
| 73 | // Emitted whenever the distance between both tracked sequences changes. | 74 | // Emitted whenever the distance between both tracked sequences changes. | ||
| 74 | - | func (x *GestureZoom) ConnectScaleChanged(cb func(GestureZoom, float64)) uint32 { | 75 | + | func (x *GestureZoom) ConnectScaleChanged(cb *func(GestureZoom, float64)) uint32 { |
| 76 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 77 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 78 | + | return gobject.SignalConnect(x.GoPointer(), "scale-changed", cbRefPtr) | |||
| 79 | + | } | |||
| 80 | + | ||||
| 75 | fcb := func(clsPtr uintptr, ScaleVarp float64) { | 81 | fcb := func(clsPtr uintptr, ScaleVarp float64) { | ||
| 76 | fa := GestureZoom{} | 82 | fa := GestureZoom{} | ||
| 77 | fa.Ptr = clsPtr | 83 | fa.Ptr = clsPtr | ||
| 84 | + | cbFn := *cb | |||
| 78 | 85 | ||||
| 79 | - | cb(fa, ScaleVarp) | 86 | + | cbFn(fa, ScaleVarp) |
| 80 | 87 | ||||
| 81 | } | 88 | } | ||
| 82 | - | return gobject.SignalConnect(x.GoPointer(), "scale-changed", purego.NewCallback(fcb)) | 89 | + | cbRefPtr := purego.NewCallback(fcb) |
| 90 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 91 | + | return gobject.SignalConnect(x.GoPointer(), "scale-changed", cbRefPtr) | |||
| 83 | } | 92 | } | ||
| 84 | 93 | ||||
| 85 | func init() { | 94 | func init() { | ||
M v4/gtk/gtkglarea.go +33 -9
| @@ -378,31 +378,47 @@ func (c *GLArea) SetGoPointer(ptr uintptr) { | |||||
| 378 | // If context creation fails then the signal handler can use | 378 | // If context creation fails then the signal handler can use | ||
| 379 | // [method@Gtk.GLArea.set_error] to register a more detailed error | 379 | // [method@Gtk.GLArea.set_error] to register a more detailed error | ||
| 380 | // of how the construction failed. | 380 | // of how the construction failed. | ||
| 381 | - | func (x *GLArea) ConnectCreateContext(cb func(GLArea) gdk.GLContext) uint32 { | 381 | + | func (x *GLArea) ConnectCreateContext(cb *func(GLArea) gdk.GLContext) uint32 { |
| 382 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 383 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 384 | + | return gobject.SignalConnect(x.GoPointer(), "create-context", cbRefPtr) | |||
| 385 | + | } | |||
| 386 | + | ||||
| 382 | fcb := func(clsPtr uintptr) uintptr { | 387 | fcb := func(clsPtr uintptr) uintptr { | ||
| 383 | fa := GLArea{} | 388 | fa := GLArea{} | ||
| 384 | fa.Ptr = clsPtr | 389 | fa.Ptr = clsPtr | ||
| 390 | + | cbFn := *cb | |||
| 385 | 391 | ||||
| 386 | - | CreateContextCls := cb(fa) | 392 | + | CreateContextCls := cbFn(fa) |
| 387 | return CreateContextCls.Ptr | 393 | return CreateContextCls.Ptr | ||
| 388 | 394 | ||||
| 389 | } | 395 | } | ||
| 390 | - | return gobject.SignalConnect(x.GoPointer(), "create-context", purego.NewCallback(fcb)) | 396 | + | cbRefPtr := purego.NewCallback(fcb) |
| 397 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 398 | + | return gobject.SignalConnect(x.GoPointer(), "create-context", cbRefPtr) | |||
| 391 | } | 399 | } | ||
| 392 | 400 | ||||
| 393 | // Emitted every time the contents of the `GtkGLArea` should be redrawn. | 401 | // Emitted every time the contents of the `GtkGLArea` should be redrawn. | ||
| 394 | // | 402 | // | ||
| 395 | // The @context is bound to the @area prior to emitting this function, | 403 | // The @context is bound to the @area prior to emitting this function, | ||
| 396 | // and the buffers are painted to the window once the emission terminates. | 404 | // and the buffers are painted to the window once the emission terminates. | ||
| 397 | - | func (x *GLArea) ConnectRender(cb func(GLArea, uintptr) bool) uint32 { | 405 | + | func (x *GLArea) ConnectRender(cb *func(GLArea, uintptr) bool) uint32 { |
| 406 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 407 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 408 | + | return gobject.SignalConnect(x.GoPointer(), "render", cbRefPtr) | |||
| 409 | + | } | |||
| 410 | + | ||||
| 398 | fcb := func(clsPtr uintptr, ContextVarp uintptr) bool { | 411 | fcb := func(clsPtr uintptr, ContextVarp uintptr) bool { | ||
| 399 | fa := GLArea{} | 412 | fa := GLArea{} | ||
| 400 | fa.Ptr = clsPtr | 413 | fa.Ptr = clsPtr | ||
| 414 | + | cbFn := *cb | |||
| 401 | 415 | ||||
| 402 | - | return cb(fa, ContextVarp) | 416 | + | return cbFn(fa, ContextVarp) |
| 403 | 417 | ||||
| 404 | } | 418 | } | ||
| 405 | - | return gobject.SignalConnect(x.GoPointer(), "render", purego.NewCallback(fcb)) | 419 | + | cbRefPtr := purego.NewCallback(fcb) |
| 420 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 421 | + | return gobject.SignalConnect(x.GoPointer(), "render", cbRefPtr) | |||
| 406 | } | 422 | } | ||
| 407 | 423 | ||||
| 408 | // Emitted once when the widget is realized, and then each time the widget | 424 | // Emitted once when the widget is realized, and then each time the widget | ||
| @@ -416,15 +432,23 @@ func (x *GLArea) ConnectRender(cb func(GLArea, uintptr) bool) uint32 { | |||||
| 416 | // is emitted. | 432 | // is emitted. | ||
| 417 | // | 433 | // | ||
| 418 | // The default handler sets up the GL viewport. | 434 | // The default handler sets up the GL viewport. | ||
| 419 | - | func (x *GLArea) ConnectResize(cb func(GLArea, int, int)) uint32 { | 435 | + | func (x *GLArea) ConnectResize(cb *func(GLArea, int, int)) uint32 { |
| 436 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 437 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 438 | + | return gobject.SignalConnect(x.GoPointer(), "resize", cbRefPtr) | |||
| 439 | + | } | |||
| 440 | + | ||||
| 420 | fcb := func(clsPtr uintptr, WidthVarp int, HeightVarp int) { | 441 | fcb := func(clsPtr uintptr, WidthVarp int, HeightVarp int) { | ||
| 421 | fa := GLArea{} | 442 | fa := GLArea{} | ||
| 422 | fa.Ptr = clsPtr | 443 | fa.Ptr = clsPtr | ||
| 444 | + | cbFn := *cb | |||
| 423 | 445 | ||||
| 424 | - | cb(fa, WidthVarp, HeightVarp) | 446 | + | cbFn(fa, WidthVarp, HeightVarp) |
| 425 | 447 | ||||
| 426 | } | 448 | } | ||
| 427 | - | return gobject.SignalConnect(x.GoPointer(), "resize", purego.NewCallback(fcb)) | 449 | + | cbRefPtr := purego.NewCallback(fcb) |
| 450 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 451 | + | return gobject.SignalConnect(x.GoPointer(), "resize", cbRefPtr) | |||
| 428 | } | 452 | } | ||
| 429 | 453 | ||||
| 430 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 454 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/gtk/gtkgridview.go +12 -3
| @@ -6,6 +6,7 @@ import ( | |||||
| 6 | 6 | ||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 9 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 10 | ) | 11 | ) | ||
| 11 | 12 | ||||
| @@ -240,15 +241,23 @@ func (c *GridView) SetGoPointer(ptr uintptr) { | |||||
| 240 | // This allows for a convenient way to handle activation in a gridview. | 241 | // This allows for a convenient way to handle activation in a gridview. | ||
| 241 | // See [property@Gtk.ListItem:activatable] for details on how to use | 242 | // See [property@Gtk.ListItem:activatable] for details on how to use | ||
| 242 | // this signal. | 243 | // this signal. | ||
| 243 | - | func (x *GridView) ConnectActivate(cb func(GridView, uint)) uint32 { | 244 | + | func (x *GridView) ConnectActivate(cb *func(GridView, uint)) uint32 { |
| 245 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 246 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 247 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 248 | + | } | |||
| 249 | + | ||||
| 244 | fcb := func(clsPtr uintptr, PositionVarp uint) { | 250 | fcb := func(clsPtr uintptr, PositionVarp uint) { | ||
| 245 | fa := GridView{} | 251 | fa := GridView{} | ||
| 246 | fa.Ptr = clsPtr | 252 | fa.Ptr = clsPtr | ||
| 253 | + | cbFn := *cb | |||
| 247 | 254 | ||||
| 248 | - | cb(fa, PositionVarp) | 255 | + | cbFn(fa, PositionVarp) |
| 249 | 256 | ||||
| 250 | } | 257 | } | ||
| 251 | - | return gobject.SignalConnect(x.GoPointer(), "activate", purego.NewCallback(fcb)) | 258 | + | cbRefPtr := purego.NewCallback(fcb) |
| 259 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 260 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 252 | } | 261 | } | ||
| 253 | 262 | ||||
| 254 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 263 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/gtk/gtkicontheme.go +14 -3
| @@ -2,10 +2,13 @@ | |||||
| 2 | package gtk | 2 | package gtk | ||
| 3 | 3 | ||||
| 4 | import ( | 4 | import ( | ||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 5 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 6 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 7 | "github.com/jwijenbergh/puregotk/v4/gdk" | 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | ||
| 8 | "github.com/jwijenbergh/puregotk/v4/gio" | 10 | "github.com/jwijenbergh/puregotk/v4/gio" | ||
| 11 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 9 | "github.com/jwijenbergh/puregotk/v4/gobject" | 12 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 10 | ) | 13 | ) | ||
| 11 | 14 | ||||
| @@ -581,15 +584,23 @@ func (c *IconTheme) SetGoPointer(ptr uintptr) { | |||||
| 581 | // This can happen becuase current icon theme is switched or | 584 | // This can happen becuase current icon theme is switched or | ||
| 582 | // because GTK detects that a change has occurred in the | 585 | // because GTK detects that a change has occurred in the | ||
| 583 | // contents of the current icon theme. | 586 | // contents of the current icon theme. | ||
| 584 | - | func (x *IconTheme) ConnectChanged(cb func(IconTheme)) uint32 { | 587 | + | func (x *IconTheme) ConnectChanged(cb *func(IconTheme)) uint32 { |
| 588 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 589 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 590 | + | return gobject.SignalConnect(x.GoPointer(), "changed", cbRefPtr) | |||
| 591 | + | } | |||
| 592 | + | ||||
| 585 | fcb := func(clsPtr uintptr) { | 593 | fcb := func(clsPtr uintptr) { | ||
| 586 | fa := IconTheme{} | 594 | fa := IconTheme{} | ||
| 587 | fa.Ptr = clsPtr | 595 | fa.Ptr = clsPtr | ||
| 596 | + | cbFn := *cb | |||
| 588 | 597 | ||||
| 589 | - | cb(fa) | 598 | + | cbFn(fa) |
| 590 | 599 | ||||
| 591 | } | 600 | } | ||
| 592 | - | return gobject.SignalConnect(x.GoPointer(), "changed", purego.NewCallback(fcb)) | 601 | + | cbRefPtr := purego.NewCallback(fcb) |
| 602 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 603 | + | return gobject.SignalConnect(x.GoPointer(), "changed", cbRefPtr) | |||
| 593 | } | 604 | } | ||
| 594 | 605 | ||||
| 595 | var xIconThemeGetForDisplay func(uintptr) uintptr | 606 | var xIconThemeGetForDisplay func(uintptr) uintptr | ||
M v4/gtk/gtkiconview.go +94 -28
| @@ -2,6 +2,8 @@ | |||||
| 2 | package gtk | 2 | package gtk | ||
| 3 | 3 | ||||
| 4 | import ( | 4 | import ( | ||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 5 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 6 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 7 | "github.com/jwijenbergh/puregotk/v4/gdk" | 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | ||
| @@ -511,9 +513,9 @@ var xIconViewSelectedForeach func(uintptr, uintptr, uintptr) | |||||
| 511 | 513 | ||||
| 512 | // Calls a function for each selected icon. Note that the model or | 514 | // Calls a function for each selected icon. Note that the model or | ||
| 513 | // selection cannot be modified from within this function. | 515 | // selection cannot be modified from within this function. | ||
| 514 | - | func (x *IconView) SelectedForeach(FuncVar IconViewForeachFunc, DataVar uintptr) { | 516 | + | func (x *IconView) SelectedForeach(FuncVar *IconViewForeachFunc, DataVar uintptr) { |
| 515 | 517 | ||||
| 516 | - | xIconViewSelectedForeach(x.GoPointer(), purego.NewCallback(FuncVar), DataVar) | 518 | + | xIconViewSelectedForeach(x.GoPointer(), glib.NewCallback(FuncVar), DataVar) |
| 517 | 519 | ||||
| 518 | } | 520 | } | ||
| 519 | 521 | ||||
| @@ -807,15 +809,23 @@ func (c *IconView) SetGoPointer(ptr uintptr) { | |||||
| 807 | // programmatically. | 809 | // programmatically. | ||
| 808 | // | 810 | // | ||
| 809 | // The default bindings for this signal are Space, Return and Enter. | 811 | // The default bindings for this signal are Space, Return and Enter. | ||
| 810 | - | func (x *IconView) ConnectActivateCursorItem(cb func(IconView) bool) uint32 { | 812 | + | func (x *IconView) ConnectActivateCursorItem(cb *func(IconView) bool) uint32 { |
| 813 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 814 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 815 | + | return gobject.SignalConnect(x.GoPointer(), "activate-cursor-item", cbRefPtr) | |||
| 816 | + | } | |||
| 817 | + | ||||
| 811 | fcb := func(clsPtr uintptr) bool { | 818 | fcb := func(clsPtr uintptr) bool { | ||
| 812 | fa := IconView{} | 819 | fa := IconView{} | ||
| 813 | fa.Ptr = clsPtr | 820 | fa.Ptr = clsPtr | ||
| 821 | + | cbFn := *cb | |||
| 814 | 822 | ||||
| 815 | - | return cb(fa) | 823 | + | return cbFn(fa) |
| 816 | 824 | ||||
| 817 | } | 825 | } | ||
| 818 | - | return gobject.SignalConnect(x.GoPointer(), "activate-cursor-item", purego.NewCallback(fcb)) | 826 | + | cbRefPtr := purego.NewCallback(fcb) |
| 827 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 828 | + | return gobject.SignalConnect(x.GoPointer(), "activate-cursor-item", cbRefPtr) | |||
| 819 | } | 829 | } | ||
| 820 | 830 | ||||
| 821 | // The ::item-activated signal is emitted when the method | 831 | // The ::item-activated signal is emitted when the method | ||
| @@ -825,15 +835,23 @@ func (x *IconView) ConnectActivateCursorItem(cb func(IconView) bool) uint32 { | |||||
| 825 | // "activate-on-single-click" property set to %TRUE. It is also | 835 | // "activate-on-single-click" property set to %TRUE. It is also | ||
| 826 | // emitted when a non-editable item is selected and one of the keys: | 836 | // emitted when a non-editable item is selected and one of the keys: | ||
| 827 | // Space, Return or Enter is pressed. | 837 | // Space, Return or Enter is pressed. | ||
| 828 | - | func (x *IconView) ConnectItemActivated(cb func(IconView, uintptr)) uint32 { | 838 | + | func (x *IconView) ConnectItemActivated(cb *func(IconView, uintptr)) uint32 { |
| 839 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 840 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 841 | + | return gobject.SignalConnect(x.GoPointer(), "item-activated", cbRefPtr) | |||
| 842 | + | } | |||
| 843 | + | ||||
| 829 | fcb := func(clsPtr uintptr, PathVarp uintptr) { | 844 | fcb := func(clsPtr uintptr, PathVarp uintptr) { | ||
| 830 | fa := IconView{} | 845 | fa := IconView{} | ||
| 831 | fa.Ptr = clsPtr | 846 | fa.Ptr = clsPtr | ||
| 847 | + | cbFn := *cb | |||
| 832 | 848 | ||||
| 833 | - | cb(fa, PathVarp) | 849 | + | cbFn(fa, PathVarp) |
| 834 | 850 | ||||
| 835 | } | 851 | } | ||
| 836 | - | return gobject.SignalConnect(x.GoPointer(), "item-activated", purego.NewCallback(fcb)) | 852 | + | cbRefPtr := purego.NewCallback(fcb) |
| 853 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 854 | + | return gobject.SignalConnect(x.GoPointer(), "item-activated", cbRefPtr) | |||
| 837 | } | 855 | } | ||
| 838 | 856 | ||||
| 839 | // The ::move-cursor signal is a | 857 | // The ::move-cursor signal is a | ||
| @@ -850,15 +868,23 @@ func (x *IconView) ConnectItemActivated(cb func(IconView, uintptr)) uint32 { | |||||
| 850 | // - PageUp/PageDown which move by "pages" | 868 | // - PageUp/PageDown which move by "pages" | ||
| 851 | // All of these will extend the selection when combined with | 869 | // All of these will extend the selection when combined with | ||
| 852 | // the Shift modifier. | 870 | // the Shift modifier. | ||
| 853 | - | func (x *IconView) ConnectMoveCursor(cb func(IconView, MovementStep, int, bool, bool) bool) uint32 { | 871 | + | func (x *IconView) ConnectMoveCursor(cb *func(IconView, MovementStep, int, bool, bool) bool) uint32 { |
| 872 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 873 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 874 | + | return gobject.SignalConnect(x.GoPointer(), "move-cursor", cbRefPtr) | |||
| 875 | + | } | |||
| 876 | + | ||||
| 854 | fcb := func(clsPtr uintptr, StepVarp MovementStep, CountVarp int, ExtendVarp bool, ModifyVarp bool) bool { | 877 | fcb := func(clsPtr uintptr, StepVarp MovementStep, CountVarp int, ExtendVarp bool, ModifyVarp bool) bool { | ||
| 855 | fa := IconView{} | 878 | fa := IconView{} | ||
| 856 | fa.Ptr = clsPtr | 879 | fa.Ptr = clsPtr | ||
| 880 | + | cbFn := *cb | |||
| 857 | 881 | ||||
| 858 | - | return cb(fa, StepVarp, CountVarp, ExtendVarp, ModifyVarp) | 882 | + | return cbFn(fa, StepVarp, CountVarp, ExtendVarp, ModifyVarp) |
| 859 | 883 | ||||
| 860 | } | 884 | } | ||
| 861 | - | return gobject.SignalConnect(x.GoPointer(), "move-cursor", purego.NewCallback(fcb)) | 885 | + | cbRefPtr := purego.NewCallback(fcb) |
| 886 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 887 | + | return gobject.SignalConnect(x.GoPointer(), "move-cursor", cbRefPtr) | |||
| 862 | } | 888 | } | ||
| 863 | 889 | ||||
| 864 | // A [keybinding signal][class@Gtk.SignalAction] | 890 | // A [keybinding signal][class@Gtk.SignalAction] | ||
| @@ -869,15 +895,23 @@ func (x *IconView) ConnectMoveCursor(cb func(IconView, MovementStep, int, bool, | |||||
| 869 | // programmatically. | 895 | // programmatically. | ||
| 870 | // | 896 | // | ||
| 871 | // The default binding for this signal is Ctrl-a. | 897 | // The default binding for this signal is Ctrl-a. | ||
| 872 | - | func (x *IconView) ConnectSelectAll(cb func(IconView)) uint32 { | 898 | + | func (x *IconView) ConnectSelectAll(cb *func(IconView)) uint32 { |
| 899 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 900 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 901 | + | return gobject.SignalConnect(x.GoPointer(), "select-all", cbRefPtr) | |||
| 902 | + | } | |||
| 903 | + | ||||
| 873 | fcb := func(clsPtr uintptr) { | 904 | fcb := func(clsPtr uintptr) { | ||
| 874 | fa := IconView{} | 905 | fa := IconView{} | ||
| 875 | fa.Ptr = clsPtr | 906 | fa.Ptr = clsPtr | ||
| 907 | + | cbFn := *cb | |||
| 876 | 908 | ||||
| 877 | - | cb(fa) | 909 | + | cbFn(fa) |
| 878 | 910 | ||||
| 879 | } | 911 | } | ||
| 880 | - | return gobject.SignalConnect(x.GoPointer(), "select-all", purego.NewCallback(fcb)) | 912 | + | cbRefPtr := purego.NewCallback(fcb) |
| 913 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 914 | + | return gobject.SignalConnect(x.GoPointer(), "select-all", cbRefPtr) | |||
| 881 | } | 915 | } | ||
| 882 | 916 | ||||
| 883 | // A [keybinding signal][class@Gtk.SignalAction] | 917 | // A [keybinding signal][class@Gtk.SignalAction] | ||
| @@ -889,28 +923,44 @@ func (x *IconView) ConnectSelectAll(cb func(IconView)) uint32 { | |||||
| 889 | // programmatically. | 923 | // programmatically. | ||
| 890 | // | 924 | // | ||
| 891 | // There is no default binding for this signal. | 925 | // There is no default binding for this signal. | ||
| 892 | - | func (x *IconView) ConnectSelectCursorItem(cb func(IconView)) uint32 { | 926 | + | func (x *IconView) ConnectSelectCursorItem(cb *func(IconView)) uint32 { |
| 927 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 928 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 929 | + | return gobject.SignalConnect(x.GoPointer(), "select-cursor-item", cbRefPtr) | |||
| 930 | + | } | |||
| 931 | + | ||||
| 893 | fcb := func(clsPtr uintptr) { | 932 | fcb := func(clsPtr uintptr) { | ||
| 894 | fa := IconView{} | 933 | fa := IconView{} | ||
| 895 | fa.Ptr = clsPtr | 934 | fa.Ptr = clsPtr | ||
| 935 | + | cbFn := *cb | |||
| 896 | 936 | ||||
| 897 | - | cb(fa) | 937 | + | cbFn(fa) |
| 898 | 938 | ||||
| 899 | } | 939 | } | ||
| 900 | - | return gobject.SignalConnect(x.GoPointer(), "select-cursor-item", purego.NewCallback(fcb)) | 940 | + | cbRefPtr := purego.NewCallback(fcb) |
| 941 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 942 | + | return gobject.SignalConnect(x.GoPointer(), "select-cursor-item", cbRefPtr) | |||
| 901 | } | 943 | } | ||
| 902 | 944 | ||||
| 903 | // The ::selection-changed signal is emitted when the selection | 945 | // The ::selection-changed signal is emitted when the selection | ||
| 904 | // (i.e. the set of selected items) changes. | 946 | // (i.e. the set of selected items) changes. | ||
| 905 | - | func (x *IconView) ConnectSelectionChanged(cb func(IconView)) uint32 { | 947 | + | func (x *IconView) ConnectSelectionChanged(cb *func(IconView)) uint32 { |
| 948 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 949 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 950 | + | return gobject.SignalConnect(x.GoPointer(), "selection-changed", cbRefPtr) | |||
| 951 | + | } | |||
| 952 | + | ||||
| 906 | fcb := func(clsPtr uintptr) { | 953 | fcb := func(clsPtr uintptr) { | ||
| 907 | fa := IconView{} | 954 | fa := IconView{} | ||
| 908 | fa.Ptr = clsPtr | 955 | fa.Ptr = clsPtr | ||
| 956 | + | cbFn := *cb | |||
| 909 | 957 | ||||
| 910 | - | cb(fa) | 958 | + | cbFn(fa) |
| 911 | 959 | ||||
| 912 | } | 960 | } | ||
| 913 | - | return gobject.SignalConnect(x.GoPointer(), "selection-changed", purego.NewCallback(fcb)) | 961 | + | cbRefPtr := purego.NewCallback(fcb) |
| 962 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 963 | + | return gobject.SignalConnect(x.GoPointer(), "selection-changed", cbRefPtr) | |||
| 914 | } | 964 | } | ||
| 915 | 965 | ||||
| 916 | // A [keybinding signal][class@Gtk.SignalAction] | 966 | // A [keybinding signal][class@Gtk.SignalAction] | ||
| @@ -923,15 +973,23 @@ func (x *IconView) ConnectSelectionChanged(cb func(IconView)) uint32 { | |||||
| 923 | // programmatically. | 973 | // programmatically. | ||
| 924 | // | 974 | // | ||
| 925 | // There is no default binding for this signal is Ctrl-Space. | 975 | // There is no default binding for this signal is Ctrl-Space. | ||
| 926 | - | func (x *IconView) ConnectToggleCursorItem(cb func(IconView)) uint32 { | 976 | + | func (x *IconView) ConnectToggleCursorItem(cb *func(IconView)) uint32 { |
| 977 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 978 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 979 | + | return gobject.SignalConnect(x.GoPointer(), "toggle-cursor-item", cbRefPtr) | |||
| 980 | + | } | |||
| 981 | + | ||||
| 927 | fcb := func(clsPtr uintptr) { | 982 | fcb := func(clsPtr uintptr) { | ||
| 928 | fa := IconView{} | 983 | fa := IconView{} | ||
| 929 | fa.Ptr = clsPtr | 984 | fa.Ptr = clsPtr | ||
| 985 | + | cbFn := *cb | |||
| 930 | 986 | ||||
| 931 | - | cb(fa) | 987 | + | cbFn(fa) |
| 932 | 988 | ||||
| 933 | } | 989 | } | ||
| 934 | - | return gobject.SignalConnect(x.GoPointer(), "toggle-cursor-item", purego.NewCallback(fcb)) | 990 | + | cbRefPtr := purego.NewCallback(fcb) |
| 991 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 992 | + | return gobject.SignalConnect(x.GoPointer(), "toggle-cursor-item", cbRefPtr) | |||
| 935 | } | 993 | } | ||
| 936 | 994 | ||||
| 937 | // A [keybinding signal][class@Gtk.SignalAction] | 995 | // A [keybinding signal][class@Gtk.SignalAction] | ||
| @@ -942,15 +1000,23 @@ func (x *IconView) ConnectToggleCursorItem(cb func(IconView)) uint32 { | |||||
| 942 | // programmatically. | 1000 | // programmatically. | ||
| 943 | // | 1001 | // | ||
| 944 | // The default binding for this signal is Ctrl-Shift-a. | 1002 | // The default binding for this signal is Ctrl-Shift-a. | ||
| 945 | - | func (x *IconView) ConnectUnselectAll(cb func(IconView)) uint32 { | 1003 | + | func (x *IconView) ConnectUnselectAll(cb *func(IconView)) uint32 { |
| 1004 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1005 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1006 | + | return gobject.SignalConnect(x.GoPointer(), "unselect-all", cbRefPtr) | |||
| 1007 | + | } | |||
| 1008 | + | ||||
| 946 | fcb := func(clsPtr uintptr) { | 1009 | fcb := func(clsPtr uintptr) { | ||
| 947 | fa := IconView{} | 1010 | fa := IconView{} | ||
| 948 | fa.Ptr = clsPtr | 1011 | fa.Ptr = clsPtr | ||
| 1012 | + | cbFn := *cb | |||
| 949 | 1013 | ||||
| 950 | - | cb(fa) | 1014 | + | cbFn(fa) |
| 951 | 1015 | ||||
| 952 | } | 1016 | } | ||
| 953 | - | return gobject.SignalConnect(x.GoPointer(), "unselect-all", purego.NewCallback(fcb)) | 1017 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1018 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1019 | + | return gobject.SignalConnect(x.GoPointer(), "unselect-all", cbRefPtr) | |||
| 954 | } | 1020 | } | ||
| 955 | 1021 | ||||
| 956 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 1022 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
| @@ -1202,9 +1268,9 @@ func (x *IconView) SetAttributes(CellVar *CellRenderer, varArgs ...interface{}) | |||||
| 1202 | // cell renderer(s) as appropriate. | 1268 | // cell renderer(s) as appropriate. | ||
| 1203 | // | 1269 | // | ||
| 1204 | // @func may be %NULL to remove a previously set function. | 1270 | // @func may be %NULL to remove a previously set function. | ||
| 1205 | - | func (x *IconView) SetCellDataFunc(CellVar *CellRenderer, FuncVar CellLayoutDataFunc, FuncDataVar uintptr, DestroyVar glib.DestroyNotify) { | 1271 | + | func (x *IconView) SetCellDataFunc(CellVar *CellRenderer, FuncVar *CellLayoutDataFunc, FuncDataVar uintptr, DestroyVar *glib.DestroyNotify) { |
| 1206 | 1272 | ||||
| 1207 | - | XGtkCellLayoutSetCellDataFunc(x.GoPointer(), CellVar.GoPointer(), purego.NewCallback(FuncVar), FuncDataVar, purego.NewCallback(DestroyVar)) | 1273 | + | XGtkCellLayoutSetCellDataFunc(x.GoPointer(), CellVar.GoPointer(), glib.NewCallback(FuncVar), FuncDataVar, glib.NewCallback(DestroyVar)) |
| 1208 | 1274 | ||||
| 1209 | } | 1275 | } | ||
| 1210 | 1276 | ||||
M v4/gtk/gtkimcontext.go +67 -18
| @@ -7,6 +7,7 @@ import ( | |||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | ||
| 10 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | 11 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 11 | "github.com/jwijenbergh/puregotk/v4/pango" | 12 | "github.com/jwijenbergh/puregotk/v4/pango" | ||
| 12 | ) | 13 | ) | ||
| @@ -284,28 +285,44 @@ func (c *IMContext) SetGoPointer(ptr uintptr) { | |||||
| 284 | // | 285 | // | ||
| 285 | // This can be a single character immediately after a key press or | 286 | // This can be a single character immediately after a key press or | ||
| 286 | // the final result of preediting. | 287 | // the final result of preediting. | ||
| 287 | - | func (x *IMContext) ConnectCommit(cb func(IMContext, string)) uint32 { | 288 | + | func (x *IMContext) ConnectCommit(cb *func(IMContext, string)) uint32 { |
| 289 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 290 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 291 | + | return gobject.SignalConnect(x.GoPointer(), "commit", cbRefPtr) | |||
| 292 | + | } | |||
| 293 | + | ||||
| 288 | fcb := func(clsPtr uintptr, StrVarp string) { | 294 | fcb := func(clsPtr uintptr, StrVarp string) { | ||
| 289 | fa := IMContext{} | 295 | fa := IMContext{} | ||
| 290 | fa.Ptr = clsPtr | 296 | fa.Ptr = clsPtr | ||
| 297 | + | cbFn := *cb | |||
| 291 | 298 | ||||
| 292 | - | cb(fa, StrVarp) | 299 | + | cbFn(fa, StrVarp) |
| 293 | 300 | ||||
| 294 | } | 301 | } | ||
| 295 | - | return gobject.SignalConnect(x.GoPointer(), "commit", purego.NewCallback(fcb)) | 302 | + | cbRefPtr := purego.NewCallback(fcb) |
| 303 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 304 | + | return gobject.SignalConnect(x.GoPointer(), "commit", cbRefPtr) | |||
| 296 | } | 305 | } | ||
| 297 | 306 | ||||
| 298 | // The ::delete-surrounding signal is emitted when the input method | 307 | // The ::delete-surrounding signal is emitted when the input method | ||
| 299 | // needs to delete all or part of the context surrounding the cursor. | 308 | // needs to delete all or part of the context surrounding the cursor. | ||
| 300 | - | func (x *IMContext) ConnectDeleteSurrounding(cb func(IMContext, int, int) bool) uint32 { | 309 | + | func (x *IMContext) ConnectDeleteSurrounding(cb *func(IMContext, int, int) bool) uint32 { |
| 310 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 311 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 312 | + | return gobject.SignalConnect(x.GoPointer(), "delete-surrounding", cbRefPtr) | |||
| 313 | + | } | |||
| 314 | + | ||||
| 301 | fcb := func(clsPtr uintptr, OffsetVarp int, NCharsVarp int) bool { | 315 | fcb := func(clsPtr uintptr, OffsetVarp int, NCharsVarp int) bool { | ||
| 302 | fa := IMContext{} | 316 | fa := IMContext{} | ||
| 303 | fa.Ptr = clsPtr | 317 | fa.Ptr = clsPtr | ||
| 318 | + | cbFn := *cb | |||
| 304 | 319 | ||||
| 305 | - | return cb(fa, OffsetVarp, NCharsVarp) | 320 | + | return cbFn(fa, OffsetVarp, NCharsVarp) |
| 306 | 321 | ||||
| 307 | } | 322 | } | ||
| 308 | - | return gobject.SignalConnect(x.GoPointer(), "delete-surrounding", purego.NewCallback(fcb)) | 323 | + | cbRefPtr := purego.NewCallback(fcb) |
| 324 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 325 | + | return gobject.SignalConnect(x.GoPointer(), "delete-surrounding", cbRefPtr) | |||
| 309 | } | 326 | } | ||
| 310 | 327 | ||||
| 311 | // The ::preedit-changed signal is emitted whenever the preedit sequence | 328 | // The ::preedit-changed signal is emitted whenever the preedit sequence | ||
| @@ -313,41 +330,65 @@ func (x *IMContext) ConnectDeleteSurrounding(cb func(IMContext, int, int) bool) | |||||
| 313 | // | 330 | // | ||
| 314 | // It is also emitted at the end of a preedit sequence, in which case | 331 | // It is also emitted at the end of a preedit sequence, in which case | ||
| 315 | // [method@Gtk.IMContext.get_preedit_string] returns the empty string. | 332 | // [method@Gtk.IMContext.get_preedit_string] returns the empty string. | ||
| 316 | - | func (x *IMContext) ConnectPreeditChanged(cb func(IMContext)) uint32 { | 333 | + | func (x *IMContext) ConnectPreeditChanged(cb *func(IMContext)) uint32 { |
| 334 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 335 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 336 | + | return gobject.SignalConnect(x.GoPointer(), "preedit-changed", cbRefPtr) | |||
| 337 | + | } | |||
| 338 | + | ||||
| 317 | fcb := func(clsPtr uintptr) { | 339 | fcb := func(clsPtr uintptr) { | ||
| 318 | fa := IMContext{} | 340 | fa := IMContext{} | ||
| 319 | fa.Ptr = clsPtr | 341 | fa.Ptr = clsPtr | ||
| 342 | + | cbFn := *cb | |||
| 320 | 343 | ||||
| 321 | - | cb(fa) | 344 | + | cbFn(fa) |
| 322 | 345 | ||||
| 323 | } | 346 | } | ||
| 324 | - | return gobject.SignalConnect(x.GoPointer(), "preedit-changed", purego.NewCallback(fcb)) | 347 | + | cbRefPtr := purego.NewCallback(fcb) |
| 348 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 349 | + | return gobject.SignalConnect(x.GoPointer(), "preedit-changed", cbRefPtr) | |||
| 325 | } | 350 | } | ||
| 326 | 351 | ||||
| 327 | // The ::preedit-end signal is emitted when a preediting sequence | 352 | // The ::preedit-end signal is emitted when a preediting sequence | ||
| 328 | // has been completed or canceled. | 353 | // has been completed or canceled. | ||
| 329 | - | func (x *IMContext) ConnectPreeditEnd(cb func(IMContext)) uint32 { | 354 | + | func (x *IMContext) ConnectPreeditEnd(cb *func(IMContext)) uint32 { |
| 355 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 356 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 357 | + | return gobject.SignalConnect(x.GoPointer(), "preedit-end", cbRefPtr) | |||
| 358 | + | } | |||
| 359 | + | ||||
| 330 | fcb := func(clsPtr uintptr) { | 360 | fcb := func(clsPtr uintptr) { | ||
| 331 | fa := IMContext{} | 361 | fa := IMContext{} | ||
| 332 | fa.Ptr = clsPtr | 362 | fa.Ptr = clsPtr | ||
| 363 | + | cbFn := *cb | |||
| 333 | 364 | ||||
| 334 | - | cb(fa) | 365 | + | cbFn(fa) |
| 335 | 366 | ||||
| 336 | } | 367 | } | ||
| 337 | - | return gobject.SignalConnect(x.GoPointer(), "preedit-end", purego.NewCallback(fcb)) | 368 | + | cbRefPtr := purego.NewCallback(fcb) |
| 369 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 370 | + | return gobject.SignalConnect(x.GoPointer(), "preedit-end", cbRefPtr) | |||
| 338 | } | 371 | } | ||
| 339 | 372 | ||||
| 340 | // The ::preedit-start signal is emitted when a new preediting sequence | 373 | // The ::preedit-start signal is emitted when a new preediting sequence | ||
| 341 | // starts. | 374 | // starts. | ||
| 342 | - | func (x *IMContext) ConnectPreeditStart(cb func(IMContext)) uint32 { | 375 | + | func (x *IMContext) ConnectPreeditStart(cb *func(IMContext)) uint32 { |
| 376 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 377 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 378 | + | return gobject.SignalConnect(x.GoPointer(), "preedit-start", cbRefPtr) | |||
| 379 | + | } | |||
| 380 | + | ||||
| 343 | fcb := func(clsPtr uintptr) { | 381 | fcb := func(clsPtr uintptr) { | ||
| 344 | fa := IMContext{} | 382 | fa := IMContext{} | ||
| 345 | fa.Ptr = clsPtr | 383 | fa.Ptr = clsPtr | ||
| 384 | + | cbFn := *cb | |||
| 346 | 385 | ||||
| 347 | - | cb(fa) | 386 | + | cbFn(fa) |
| 348 | 387 | ||||
| 349 | } | 388 | } | ||
| 350 | - | return gobject.SignalConnect(x.GoPointer(), "preedit-start", purego.NewCallback(fcb)) | 389 | + | cbRefPtr := purego.NewCallback(fcb) |
| 390 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 391 | + | return gobject.SignalConnect(x.GoPointer(), "preedit-start", cbRefPtr) | |||
| 351 | } | 392 | } | ||
| 352 | 393 | ||||
| 353 | // The ::retrieve-surrounding signal is emitted when the input method | 394 | // The ::retrieve-surrounding signal is emitted when the input method | ||
| @@ -355,15 +396,23 @@ func (x *IMContext) ConnectPreeditStart(cb func(IMContext)) uint32 { | |||||
| 355 | // | 396 | // | ||
| 356 | // The callback should set the input method surrounding context by | 397 | // The callback should set the input method surrounding context by | ||
| 357 | // calling the [method@Gtk.IMContext.set_surrounding] method. | 398 | // calling the [method@Gtk.IMContext.set_surrounding] method. | ||
| 358 | - | func (x *IMContext) ConnectRetrieveSurrounding(cb func(IMContext) bool) uint32 { | 399 | + | func (x *IMContext) ConnectRetrieveSurrounding(cb *func(IMContext) bool) uint32 { |
| 400 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 401 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 402 | + | return gobject.SignalConnect(x.GoPointer(), "retrieve-surrounding", cbRefPtr) | |||
| 403 | + | } | |||
| 404 | + | ||||
| 359 | fcb := func(clsPtr uintptr) bool { | 405 | fcb := func(clsPtr uintptr) bool { | ||
| 360 | fa := IMContext{} | 406 | fa := IMContext{} | ||
| 361 | fa.Ptr = clsPtr | 407 | fa.Ptr = clsPtr | ||
| 408 | + | cbFn := *cb | |||
| 362 | 409 | ||||
| 363 | - | return cb(fa) | 410 | + | return cbFn(fa) |
| 364 | 411 | ||||
| 365 | } | 412 | } | ||
| 366 | - | return gobject.SignalConnect(x.GoPointer(), "retrieve-surrounding", purego.NewCallback(fcb)) | 413 | + | cbRefPtr := purego.NewCallback(fcb) |
| 414 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 415 | + | return gobject.SignalConnect(x.GoPointer(), "retrieve-surrounding", cbRefPtr) | |||
| 367 | } | 416 | } | ||
| 368 | 417 | ||||
| 369 | func init() { | 418 | func init() { | ||
M v4/gtk/gtkinfobar.go +25 -6
| @@ -2,8 +2,11 @@ | |||||
| 2 | package gtk | 2 | package gtk | ||
| 3 | 3 | ||||
| 4 | import ( | 4 | import ( | ||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 5 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 6 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 7 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 8 | ) | 11 | ) | ||
| 9 | 12 | ||||
| @@ -331,15 +334,23 @@ func (c *InfoBar) SetGoPointer(ptr uintptr) { | |||||
| 331 | // The ::close signal is a [keybinding signal](class.SignalAction.html). | 334 | // The ::close signal is a [keybinding signal](class.SignalAction.html). | ||
| 332 | // | 335 | // | ||
| 333 | // The default binding for this signal is the Escape key. | 336 | // The default binding for this signal is the Escape key. | ||
| 334 | - | func (x *InfoBar) ConnectClose(cb func(InfoBar)) uint32 { | 337 | + | func (x *InfoBar) ConnectClose(cb *func(InfoBar)) uint32 { |
| 338 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 339 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 340 | + | return gobject.SignalConnect(x.GoPointer(), "close", cbRefPtr) | |||
| 341 | + | } | |||
| 342 | + | ||||
| 335 | fcb := func(clsPtr uintptr) { | 343 | fcb := func(clsPtr uintptr) { | ||
| 336 | fa := InfoBar{} | 344 | fa := InfoBar{} | ||
| 337 | fa.Ptr = clsPtr | 345 | fa.Ptr = clsPtr | ||
| 346 | + | cbFn := *cb | |||
| 338 | 347 | ||||
| 339 | - | cb(fa) | 348 | + | cbFn(fa) |
| 340 | 349 | ||||
| 341 | } | 350 | } | ||
| 342 | - | return gobject.SignalConnect(x.GoPointer(), "close", purego.NewCallback(fcb)) | 351 | + | cbRefPtr := purego.NewCallback(fcb) |
| 352 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 353 | + | return gobject.SignalConnect(x.GoPointer(), "close", cbRefPtr) | |||
| 343 | } | 354 | } | ||
| 344 | 355 | ||||
| 345 | // Emitted when an action widget is clicked. | 356 | // Emitted when an action widget is clicked. | ||
| @@ -347,15 +358,23 @@ func (x *InfoBar) ConnectClose(cb func(InfoBar)) uint32 { | |||||
| 347 | // The signal is also emitted when the application programmer | 358 | // The signal is also emitted when the application programmer | ||
| 348 | // calls [method@Gtk.InfoBar.response]. The @response_id depends | 359 | // calls [method@Gtk.InfoBar.response]. The @response_id depends | ||
| 349 | // on which action widget was clicked. | 360 | // on which action widget was clicked. | ||
| 350 | - | func (x *InfoBar) ConnectResponse(cb func(InfoBar, int)) uint32 { | 361 | + | func (x *InfoBar) ConnectResponse(cb *func(InfoBar, int)) uint32 { |
| 362 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 363 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 364 | + | return gobject.SignalConnect(x.GoPointer(), "response", cbRefPtr) | |||
| 365 | + | } | |||
| 366 | + | ||||
| 351 | fcb := func(clsPtr uintptr, ResponseIdVarp int) { | 367 | fcb := func(clsPtr uintptr, ResponseIdVarp int) { | ||
| 352 | fa := InfoBar{} | 368 | fa := InfoBar{} | ||
| 353 | fa.Ptr = clsPtr | 369 | fa.Ptr = clsPtr | ||
| 370 | + | cbFn := *cb | |||
| 354 | 371 | ||||
| 355 | - | cb(fa, ResponseIdVarp) | 372 | + | cbFn(fa, ResponseIdVarp) |
| 356 | 373 | ||||
| 357 | } | 374 | } | ||
| 358 | - | return gobject.SignalConnect(x.GoPointer(), "response", purego.NewCallback(fcb)) | 375 | + | cbRefPtr := purego.NewCallback(fcb) |
| 376 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 377 | + | return gobject.SignalConnect(x.GoPointer(), "response", cbRefPtr) | |||
| 359 | } | 378 | } | ||
| 360 | 379 | ||||
| 361 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 380 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/gtk/gtklabel.go +47 -12
| @@ -2,9 +2,12 @@ | |||||
| 2 | package gtk | 2 | package gtk | ||
| 3 | 3 | ||||
| 4 | import ( | 4 | import ( | ||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 5 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 6 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 7 | "github.com/jwijenbergh/puregotk/v4/gio" | 9 | "github.com/jwijenbergh/puregotk/v4/gio" | ||
| 10 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 8 | "github.com/jwijenbergh/puregotk/v4/gobject" | 11 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 9 | "github.com/jwijenbergh/puregotk/v4/pango" | 12 | "github.com/jwijenbergh/puregotk/v4/pango" | ||
| 10 | ) | 13 | ) | ||
| @@ -925,30 +928,46 @@ func (c *Label) SetGoPointer(ptr uintptr) { | |||||
| 925 | // if they need to control activation of URIs programmatically. | 928 | // if they need to control activation of URIs programmatically. | ||
| 926 | // | 929 | // | ||
| 927 | // The default bindings for this signal are all forms of the Enter key. | 930 | // The default bindings for this signal are all forms of the Enter key. | ||
| 928 | - | func (x *Label) ConnectActivateCurrentLink(cb func(Label)) uint32 { | 931 | + | func (x *Label) ConnectActivateCurrentLink(cb *func(Label)) uint32 { |
| 932 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 933 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 934 | + | return gobject.SignalConnect(x.GoPointer(), "activate-current-link", cbRefPtr) | |||
| 935 | + | } | |||
| 936 | + | ||||
| 929 | fcb := func(clsPtr uintptr) { | 937 | fcb := func(clsPtr uintptr) { | ||
| 930 | fa := Label{} | 938 | fa := Label{} | ||
| 931 | fa.Ptr = clsPtr | 939 | fa.Ptr = clsPtr | ||
| 940 | + | cbFn := *cb | |||
| 932 | 941 | ||||
| 933 | - | cb(fa) | 942 | + | cbFn(fa) |
| 934 | 943 | ||||
| 935 | } | 944 | } | ||
| 936 | - | return gobject.SignalConnect(x.GoPointer(), "activate-current-link", purego.NewCallback(fcb)) | 945 | + | cbRefPtr := purego.NewCallback(fcb) |
| 946 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 947 | + | return gobject.SignalConnect(x.GoPointer(), "activate-current-link", cbRefPtr) | |||
| 937 | } | 948 | } | ||
| 938 | 949 | ||||
| 939 | // Gets emitted to activate a URI. | 950 | // Gets emitted to activate a URI. | ||
| 940 | // | 951 | // | ||
| 941 | // Applications may connect to it to override the default behaviour, | 952 | // Applications may connect to it to override the default behaviour, | ||
| 942 | // which is to call gtk_show_uri(). | 953 | // which is to call gtk_show_uri(). | ||
| 943 | - | func (x *Label) ConnectActivateLink(cb func(Label, string) bool) uint32 { | 954 | + | func (x *Label) ConnectActivateLink(cb *func(Label, string) bool) uint32 { |
| 955 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 956 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 957 | + | return gobject.SignalConnect(x.GoPointer(), "activate-link", cbRefPtr) | |||
| 958 | + | } | |||
| 959 | + | ||||
| 944 | fcb := func(clsPtr uintptr, UriVarp string) bool { | 960 | fcb := func(clsPtr uintptr, UriVarp string) bool { | ||
| 945 | fa := Label{} | 961 | fa := Label{} | ||
| 946 | fa.Ptr = clsPtr | 962 | fa.Ptr = clsPtr | ||
| 963 | + | cbFn := *cb | |||
| 947 | 964 | ||||
| 948 | - | return cb(fa, UriVarp) | 965 | + | return cbFn(fa, UriVarp) |
| 949 | 966 | ||||
| 950 | } | 967 | } | ||
| 951 | - | return gobject.SignalConnect(x.GoPointer(), "activate-link", purego.NewCallback(fcb)) | 968 | + | cbRefPtr := purego.NewCallback(fcb) |
| 969 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 970 | + | return gobject.SignalConnect(x.GoPointer(), "activate-link", cbRefPtr) | |||
| 952 | } | 971 | } | ||
| 953 | 972 | ||||
| 954 | // Gets emitted to copy the slection to the clipboard. | 973 | // Gets emitted to copy the slection to the clipboard. | ||
| @@ -956,15 +975,23 @@ func (x *Label) ConnectActivateLink(cb func(Label, string) bool) uint32 { | |||||
| 956 | // The ::copy-clipboard signal is a [keybinding signal](class.SignalAction.html). | 975 | // The ::copy-clipboard signal is a [keybinding signal](class.SignalAction.html). | ||
| 957 | // | 976 | // | ||
| 958 | // The default binding for this signal is Ctrl-c. | 977 | // The default binding for this signal is Ctrl-c. | ||
| 959 | - | func (x *Label) ConnectCopyClipboard(cb func(Label)) uint32 { | 978 | + | func (x *Label) ConnectCopyClipboard(cb *func(Label)) uint32 { |
| 979 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 980 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 981 | + | return gobject.SignalConnect(x.GoPointer(), "copy-clipboard", cbRefPtr) | |||
| 982 | + | } | |||
| 983 | + | ||||
| 960 | fcb := func(clsPtr uintptr) { | 984 | fcb := func(clsPtr uintptr) { | ||
| 961 | fa := Label{} | 985 | fa := Label{} | ||
| 962 | fa.Ptr = clsPtr | 986 | fa.Ptr = clsPtr | ||
| 987 | + | cbFn := *cb | |||
| 963 | 988 | ||||
| 964 | - | cb(fa) | 989 | + | cbFn(fa) |
| 965 | 990 | ||||
| 966 | } | 991 | } | ||
| 967 | - | return gobject.SignalConnect(x.GoPointer(), "copy-clipboard", purego.NewCallback(fcb)) | 992 | + | cbRefPtr := purego.NewCallback(fcb) |
| 993 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 994 | + | return gobject.SignalConnect(x.GoPointer(), "copy-clipboard", cbRefPtr) | |||
| 968 | } | 995 | } | ||
| 969 | 996 | ||||
| 970 | // Gets emitted when the user initiates a cursor movement. | 997 | // Gets emitted when the user initiates a cursor movement. | ||
| @@ -984,15 +1011,23 @@ func (x *Label) ConnectCopyClipboard(cb func(Label)) uint32 { | |||||
| 984 | // - Arrow keys move by individual characters/lines | 1011 | // - Arrow keys move by individual characters/lines | ||
| 985 | // - Ctrl-arrow key combinations move by words/paragraphs | 1012 | // - Ctrl-arrow key combinations move by words/paragraphs | ||
| 986 | // - Home/End keys move to the ends of the buffer | 1013 | // - Home/End keys move to the ends of the buffer | ||
| 987 | - | func (x *Label) ConnectMoveCursor(cb func(Label, MovementStep, int, bool)) uint32 { | 1014 | + | func (x *Label) ConnectMoveCursor(cb *func(Label, MovementStep, int, bool)) uint32 { |
| 1015 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1016 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1017 | + | return gobject.SignalConnect(x.GoPointer(), "move-cursor", cbRefPtr) | |||
| 1018 | + | } | |||
| 1019 | + | ||||
| 988 | fcb := func(clsPtr uintptr, StepVarp MovementStep, CountVarp int, ExtendSelectionVarp bool) { | 1020 | fcb := func(clsPtr uintptr, StepVarp MovementStep, CountVarp int, ExtendSelectionVarp bool) { | ||
| 989 | fa := Label{} | 1021 | fa := Label{} | ||
| 990 | fa.Ptr = clsPtr | 1022 | fa.Ptr = clsPtr | ||
| 1023 | + | cbFn := *cb | |||
| 991 | 1024 | ||||
| 992 | - | cb(fa, StepVarp, CountVarp, ExtendSelectionVarp) | 1025 | + | cbFn(fa, StepVarp, CountVarp, ExtendSelectionVarp) |
| 993 | 1026 | ||||
| 994 | } | 1027 | } | ||
| 995 | - | return gobject.SignalConnect(x.GoPointer(), "move-cursor", purego.NewCallback(fcb)) | 1028 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1029 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1030 | + | return gobject.SignalConnect(x.GoPointer(), "move-cursor", cbRefPtr) | |||
| 996 | } | 1031 | } | ||
| 997 | 1032 | ||||
| 998 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 1033 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/gtk/gtklevelbar.go +14 -3
| @@ -2,8 +2,11 @@ | |||||
| 2 | package gtk | 2 | package gtk | ||
| 3 | 3 | ||||
| 4 | import ( | 4 | import ( | ||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 5 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 6 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 7 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 8 | ) | 11 | ) | ||
| 9 | 12 | ||||
| @@ -311,15 +314,23 @@ func (c *LevelBar) SetGoPointer(ptr uintptr) { | |||||
| 311 | // The signal supports detailed connections; you can connect to the | 314 | // The signal supports detailed connections; you can connect to the | ||
| 312 | // detailed signal "changed::x" in order to only receive callbacks when | 315 | // detailed signal "changed::x" in order to only receive callbacks when | ||
| 313 | // the value of offset "x" changes. | 316 | // the value of offset "x" changes. | ||
| 314 | - | func (x *LevelBar) ConnectOffsetChanged(cb func(LevelBar, string)) uint32 { | 317 | + | func (x *LevelBar) ConnectOffsetChanged(cb *func(LevelBar, string)) uint32 { |
| 318 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 319 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 320 | + | return gobject.SignalConnect(x.GoPointer(), "offset-changed", cbRefPtr) | |||
| 321 | + | } | |||
| 322 | + | ||||
| 315 | fcb := func(clsPtr uintptr, NameVarp string) { | 323 | fcb := func(clsPtr uintptr, NameVarp string) { | ||
| 316 | fa := LevelBar{} | 324 | fa := LevelBar{} | ||
| 317 | fa.Ptr = clsPtr | 325 | fa.Ptr = clsPtr | ||
| 326 | + | cbFn := *cb | |||
| 318 | 327 | ||||
| 319 | - | cb(fa, NameVarp) | 328 | + | cbFn(fa, NameVarp) |
| 320 | 329 | ||||
| 321 | } | 330 | } | ||
| 322 | - | return gobject.SignalConnect(x.GoPointer(), "offset-changed", purego.NewCallback(fcb)) | 331 | + | cbRefPtr := purego.NewCallback(fcb) |
| 332 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 333 | + | return gobject.SignalConnect(x.GoPointer(), "offset-changed", cbRefPtr) | |||
| 323 | } | 334 | } | ||
| 324 | 335 | ||||
| 325 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 336 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/gtk/gtklinkbutton.go +13 -3
| @@ -2,6 +2,8 @@ | |||||
| 2 | package gtk | 2 | package gtk | ||
| 3 | 3 | ||||
| 4 | import ( | 4 | import ( | ||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 5 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 6 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 7 | "github.com/jwijenbergh/puregotk/v4/glib" | 9 | "github.com/jwijenbergh/puregotk/v4/glib" | ||
| @@ -139,15 +141,23 @@ func (c *LinkButton) SetGoPointer(ptr uintptr) { | |||||
| 139 | // To override the default behavior, you can connect to the | 141 | // To override the default behavior, you can connect to the | ||
| 140 | // ::activate-link signal and stop the propagation of the signal | 142 | // ::activate-link signal and stop the propagation of the signal | ||
| 141 | // by returning %TRUE from your handler. | 143 | // by returning %TRUE from your handler. | ||
| 142 | - | func (x *LinkButton) ConnectActivateLink(cb func(LinkButton) bool) uint32 { | 144 | + | func (x *LinkButton) ConnectActivateLink(cb *func(LinkButton) bool) uint32 { |
| 145 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 146 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 147 | + | return gobject.SignalConnect(x.GoPointer(), "activate-link", cbRefPtr) | |||
| 148 | + | } | |||
| 149 | + | ||||
| 143 | fcb := func(clsPtr uintptr) bool { | 150 | fcb := func(clsPtr uintptr) bool { | ||
| 144 | fa := LinkButton{} | 151 | fa := LinkButton{} | ||
| 145 | fa.Ptr = clsPtr | 152 | fa.Ptr = clsPtr | ||
| 153 | + | cbFn := *cb | |||
| 146 | 154 | ||||
| 147 | - | return cb(fa) | 155 | + | return cbFn(fa) |
| 148 | 156 | ||||
| 149 | } | 157 | } | ||
| 150 | - | return gobject.SignalConnect(x.GoPointer(), "activate-link", purego.NewCallback(fcb)) | 158 | + | cbRefPtr := purego.NewCallback(fcb) |
| 159 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 160 | + | return gobject.SignalConnect(x.GoPointer(), "activate-link", cbRefPtr) | |||
| 151 | } | 161 | } | ||
| 152 | 162 | ||||
| 153 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 163 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/gtk/gtklistbox.go +109 -37
| @@ -153,9 +153,9 @@ var xListBoxBindModel func(uintptr, uintptr, uintptr, uintptr, uintptr) | |||||
| 153 | // Note that using a model is incompatible with the filtering and sorting | 153 | // Note that using a model is incompatible with the filtering and sorting | ||
| 154 | // functionality in `GtkListBox`. When using a model, filtering and sorting | 154 | // functionality in `GtkListBox`. When using a model, filtering and sorting | ||
| 155 | // should be implemented by the model. | 155 | // should be implemented by the model. | ||
| 156 | - | func (x *ListBox) BindModel(ModelVar gio.ListModel, CreateWidgetFuncVar ListBoxCreateWidgetFunc, UserDataVar uintptr, UserDataFreeFuncVar glib.DestroyNotify) { | 156 | + | func (x *ListBox) BindModel(ModelVar gio.ListModel, CreateWidgetFuncVar *ListBoxCreateWidgetFunc, UserDataVar uintptr, UserDataFreeFuncVar *glib.DestroyNotify) { |
| 157 | 157 | ||||
| 158 | - | xListBoxBindModel(x.GoPointer(), ModelVar.GoPointer(), purego.NewCallback(CreateWidgetFuncVar), UserDataVar, purego.NewCallback(UserDataFreeFuncVar)) | 158 | + | xListBoxBindModel(x.GoPointer(), ModelVar.GoPointer(), glib.NewCallback(CreateWidgetFuncVar), UserDataVar, glib.NewCallback(UserDataFreeFuncVar)) |
| 159 | 159 | ||||
| 160 | } | 160 | } | ||
| 161 | 161 | ||||
| @@ -399,9 +399,9 @@ var xListBoxSelectedForeach func(uintptr, uintptr, uintptr) | |||||
| 399 | // Calls a function for each selected child. | 399 | // Calls a function for each selected child. | ||
| 400 | // | 400 | // | ||
| 401 | // Note that the selection cannot be modified from within this function. | 401 | // Note that the selection cannot be modified from within this function. | ||
| 402 | - | func (x *ListBox) SelectedForeach(FuncVar ListBoxForeachFunc, DataVar uintptr) { | 402 | + | func (x *ListBox) SelectedForeach(FuncVar *ListBoxForeachFunc, DataVar uintptr) { |
| 403 | 403 | ||||
| 404 | - | xListBoxSelectedForeach(x.GoPointer(), purego.NewCallback(FuncVar), DataVar) | 404 | + | xListBoxSelectedForeach(x.GoPointer(), glib.NewCallback(FuncVar), DataVar) |
| 405 | 405 | ||||
| 406 | } | 406 | } | ||
| 407 | 407 | ||||
| @@ -448,9 +448,9 @@ var xListBoxSetFilterFunc func(uintptr, uintptr, uintptr, uintptr) | |||||
| 448 | // | 448 | // | ||
| 449 | // Note that using a filter function is incompatible with using a model | 449 | // Note that using a filter function is incompatible with using a model | ||
| 450 | // (see [method@Gtk.ListBox.bind_model]). | 450 | // (see [method@Gtk.ListBox.bind_model]). | ||
| 451 | - | func (x *ListBox) SetFilterFunc(FilterFuncVar ListBoxFilterFunc, UserDataVar uintptr, DestroyVar glib.DestroyNotify) { | 451 | + | func (x *ListBox) SetFilterFunc(FilterFuncVar *ListBoxFilterFunc, UserDataVar uintptr, DestroyVar *glib.DestroyNotify) { |
| 452 | 452 | ||||
| 453 | - | xListBoxSetFilterFunc(x.GoPointer(), purego.NewCallback(FilterFuncVar), UserDataVar, purego.NewCallback(DestroyVar)) | 453 | + | xListBoxSetFilterFunc(x.GoPointer(), glib.NewCallback(FilterFuncVar), UserDataVar, glib.NewCallback(DestroyVar)) |
| 454 | 454 | ||||
| 455 | } | 455 | } | ||
| 456 | 456 | ||||
| @@ -481,9 +481,9 @@ var xListBoxSetHeaderFunc func(uintptr, uintptr, uintptr, uintptr) | |||||
| 481 | // by [method@Gtk.ListBoxRow.changed] on the previous row, or when the previous | 481 | // by [method@Gtk.ListBoxRow.changed] on the previous row, or when the previous | ||
| 482 | // row becomes a different row). It is also called for all rows when | 482 | // row becomes a different row). It is also called for all rows when | ||
| 483 | // [method@Gtk.ListBox.invalidate_headers] is called. | 483 | // [method@Gtk.ListBox.invalidate_headers] is called. | ||
| 484 | - | func (x *ListBox) SetHeaderFunc(UpdateHeaderVar ListBoxUpdateHeaderFunc, UserDataVar uintptr, DestroyVar glib.DestroyNotify) { | 484 | + | func (x *ListBox) SetHeaderFunc(UpdateHeaderVar *ListBoxUpdateHeaderFunc, UserDataVar uintptr, DestroyVar *glib.DestroyNotify) { |
| 485 | 485 | ||||
| 486 | - | xListBoxSetHeaderFunc(x.GoPointer(), purego.NewCallback(UpdateHeaderVar), UserDataVar, purego.NewCallback(DestroyVar)) | 486 | + | xListBoxSetHeaderFunc(x.GoPointer(), glib.NewCallback(UpdateHeaderVar), UserDataVar, glib.NewCallback(DestroyVar)) |
| 487 | 487 | ||||
| 488 | } | 488 | } | ||
| 489 | 489 | ||||
| @@ -530,9 +530,9 @@ var xListBoxSetSortFunc func(uintptr, uintptr, uintptr, uintptr) | |||||
| 530 | // | 530 | // | ||
| 531 | // Note that using a sort function is incompatible with using a model | 531 | // Note that using a sort function is incompatible with using a model | ||
| 532 | // (see [method@Gtk.ListBox.bind_model]). | 532 | // (see [method@Gtk.ListBox.bind_model]). | ||
| 533 | - | func (x *ListBox) SetSortFunc(SortFuncVar ListBoxSortFunc, UserDataVar uintptr, DestroyVar glib.DestroyNotify) { | 533 | + | func (x *ListBox) SetSortFunc(SortFuncVar *ListBoxSortFunc, UserDataVar uintptr, DestroyVar *glib.DestroyNotify) { |
| 534 | 534 | ||||
| 535 | - | xListBoxSetSortFunc(x.GoPointer(), purego.NewCallback(SortFuncVar), UserDataVar, purego.NewCallback(DestroyVar)) | 535 | + | xListBoxSetSortFunc(x.GoPointer(), glib.NewCallback(SortFuncVar), UserDataVar, glib.NewCallback(DestroyVar)) |
| 536 | 536 | ||||
| 537 | } | 537 | } | ||
| 538 | 538 | ||||
| @@ -562,38 +562,62 @@ func (c *ListBox) SetGoPointer(ptr uintptr) { | |||||
| 562 | c.Ptr = ptr | 562 | c.Ptr = ptr | ||
| 563 | } | 563 | } | ||
| 564 | 564 | ||||
| 565 | - | func (x *ListBox) ConnectActivateCursorRow(cb func(ListBox)) uint32 { | 565 | + | func (x *ListBox) ConnectActivateCursorRow(cb *func(ListBox)) uint32 { |
| 566 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 567 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 568 | + | return gobject.SignalConnect(x.GoPointer(), "activate-cursor-row", cbRefPtr) | |||
| 569 | + | } | |||
| 570 | + | ||||
| 566 | fcb := func(clsPtr uintptr) { | 571 | fcb := func(clsPtr uintptr) { | ||
| 567 | fa := ListBox{} | 572 | fa := ListBox{} | ||
| 568 | fa.Ptr = clsPtr | 573 | fa.Ptr = clsPtr | ||
| 574 | + | cbFn := *cb | |||
| 569 | 575 | ||||
| 570 | - | cb(fa) | 576 | + | cbFn(fa) |
| 571 | 577 | ||||
| 572 | } | 578 | } | ||
| 573 | - | return gobject.SignalConnect(x.GoPointer(), "activate-cursor-row", purego.NewCallback(fcb)) | 579 | + | cbRefPtr := purego.NewCallback(fcb) |
| 580 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 581 | + | return gobject.SignalConnect(x.GoPointer(), "activate-cursor-row", cbRefPtr) | |||
| 574 | } | 582 | } | ||
| 575 | 583 | ||||
| 576 | - | func (x *ListBox) ConnectMoveCursor(cb func(ListBox, MovementStep, int, bool, bool)) uint32 { | 584 | + | func (x *ListBox) ConnectMoveCursor(cb *func(ListBox, MovementStep, int, bool, bool)) uint32 { |
| 585 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 586 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 587 | + | return gobject.SignalConnect(x.GoPointer(), "move-cursor", cbRefPtr) | |||
| 588 | + | } | |||
| 589 | + | ||||
| 577 | fcb := func(clsPtr uintptr, ObjectVarp MovementStep, P0Varp int, P1Varp bool, P2Varp bool) { | 590 | fcb := func(clsPtr uintptr, ObjectVarp MovementStep, P0Varp int, P1Varp bool, P2Varp bool) { | ||
| 578 | fa := ListBox{} | 591 | fa := ListBox{} | ||
| 579 | fa.Ptr = clsPtr | 592 | fa.Ptr = clsPtr | ||
| 593 | + | cbFn := *cb | |||
| 580 | 594 | ||||
| 581 | - | cb(fa, ObjectVarp, P0Varp, P1Varp, P2Varp) | 595 | + | cbFn(fa, ObjectVarp, P0Varp, P1Varp, P2Varp) |
| 582 | 596 | ||||
| 583 | } | 597 | } | ||
| 584 | - | return gobject.SignalConnect(x.GoPointer(), "move-cursor", purego.NewCallback(fcb)) | 598 | + | cbRefPtr := purego.NewCallback(fcb) |
| 599 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 600 | + | return gobject.SignalConnect(x.GoPointer(), "move-cursor", cbRefPtr) | |||
| 585 | } | 601 | } | ||
| 586 | 602 | ||||
| 587 | // Emitted when a row has been activated by the user. | 603 | // Emitted when a row has been activated by the user. | ||
| 588 | - | func (x *ListBox) ConnectRowActivated(cb func(ListBox, uintptr)) uint32 { | 604 | + | func (x *ListBox) ConnectRowActivated(cb *func(ListBox, uintptr)) uint32 { |
| 605 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 606 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 607 | + | return gobject.SignalConnect(x.GoPointer(), "row-activated", cbRefPtr) | |||
| 608 | + | } | |||
| 609 | + | ||||
| 589 | fcb := func(clsPtr uintptr, RowVarp uintptr) { | 610 | fcb := func(clsPtr uintptr, RowVarp uintptr) { | ||
| 590 | fa := ListBox{} | 611 | fa := ListBox{} | ||
| 591 | fa.Ptr = clsPtr | 612 | fa.Ptr = clsPtr | ||
| 613 | + | cbFn := *cb | |||
| 592 | 614 | ||||
| 593 | - | cb(fa, RowVarp) | 615 | + | cbFn(fa, RowVarp) |
| 594 | 616 | ||||
| 595 | } | 617 | } | ||
| 596 | - | return gobject.SignalConnect(x.GoPointer(), "row-activated", purego.NewCallback(fcb)) | 618 | + | cbRefPtr := purego.NewCallback(fcb) |
| 619 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 620 | + | return gobject.SignalConnect(x.GoPointer(), "row-activated", cbRefPtr) | |||
| 597 | } | 621 | } | ||
| 598 | 622 | ||||
| 599 | // Emitted when a new row is selected, or (with a %NULL @row) | 623 | // Emitted when a new row is selected, or (with a %NULL @row) | ||
| @@ -602,15 +626,23 @@ func (x *ListBox) ConnectRowActivated(cb func(ListBox, uintptr)) uint32 { | |||||
| 602 | // When the @box is using %GTK_SELECTION_MULTIPLE, this signal will not | 626 | // When the @box is using %GTK_SELECTION_MULTIPLE, this signal will not | ||
| 603 | // give you the full picture of selection changes, and you should use | 627 | // give you the full picture of selection changes, and you should use | ||
| 604 | // the [signal@Gtk.ListBox::selected-rows-changed] signal instead. | 628 | // the [signal@Gtk.ListBox::selected-rows-changed] signal instead. | ||
| 605 | - | func (x *ListBox) ConnectRowSelected(cb func(ListBox, uintptr)) uint32 { | 629 | + | func (x *ListBox) ConnectRowSelected(cb *func(ListBox, uintptr)) uint32 { |
| 630 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 631 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 632 | + | return gobject.SignalConnect(x.GoPointer(), "row-selected", cbRefPtr) | |||
| 633 | + | } | |||
| 634 | + | ||||
| 606 | fcb := func(clsPtr uintptr, RowVarp uintptr) { | 635 | fcb := func(clsPtr uintptr, RowVarp uintptr) { | ||
| 607 | fa := ListBox{} | 636 | fa := ListBox{} | ||
| 608 | fa.Ptr = clsPtr | 637 | fa.Ptr = clsPtr | ||
| 638 | + | cbFn := *cb | |||
| 609 | 639 | ||||
| 610 | - | cb(fa, RowVarp) | 640 | + | cbFn(fa, RowVarp) |
| 611 | 641 | ||||
| 612 | } | 642 | } | ||
| 613 | - | return gobject.SignalConnect(x.GoPointer(), "row-selected", purego.NewCallback(fcb)) | 643 | + | cbRefPtr := purego.NewCallback(fcb) |
| 644 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 645 | + | return gobject.SignalConnect(x.GoPointer(), "row-selected", cbRefPtr) | |||
| 614 | } | 646 | } | ||
| 615 | 647 | ||||
| 616 | // Emitted to select all children of the box, if the selection | 648 | // Emitted to select all children of the box, if the selection | ||
| @@ -619,38 +651,62 @@ func (x *ListBox) ConnectRowSelected(cb func(ListBox, uintptr)) uint32 { | |||||
| 619 | // This is a [keybinding signal](class.SignalAction.html). | 651 | // This is a [keybinding signal](class.SignalAction.html). | ||
| 620 | // | 652 | // | ||
| 621 | // The default binding for this signal is <kbd>Ctrl</kbd>-<kbd>a</kbd>. | 653 | // The default binding for this signal is <kbd>Ctrl</kbd>-<kbd>a</kbd>. | ||
| 622 | - | func (x *ListBox) ConnectSelectAll(cb func(ListBox)) uint32 { | 654 | + | func (x *ListBox) ConnectSelectAll(cb *func(ListBox)) uint32 { |
| 655 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 656 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 657 | + | return gobject.SignalConnect(x.GoPointer(), "select-all", cbRefPtr) | |||
| 658 | + | } | |||
| 659 | + | ||||
| 623 | fcb := func(clsPtr uintptr) { | 660 | fcb := func(clsPtr uintptr) { | ||
| 624 | fa := ListBox{} | 661 | fa := ListBox{} | ||
| 625 | fa.Ptr = clsPtr | 662 | fa.Ptr = clsPtr | ||
| 663 | + | cbFn := *cb | |||
| 626 | 664 | ||||
| 627 | - | cb(fa) | 665 | + | cbFn(fa) |
| 628 | 666 | ||||
| 629 | } | 667 | } | ||
| 630 | - | return gobject.SignalConnect(x.GoPointer(), "select-all", purego.NewCallback(fcb)) | 668 | + | cbRefPtr := purego.NewCallback(fcb) |
| 669 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 670 | + | return gobject.SignalConnect(x.GoPointer(), "select-all", cbRefPtr) | |||
| 631 | } | 671 | } | ||
| 632 | 672 | ||||
| 633 | // Emitted when the set of selected rows changes. | 673 | // Emitted when the set of selected rows changes. | ||
| 634 | - | func (x *ListBox) ConnectSelectedRowsChanged(cb func(ListBox)) uint32 { | 674 | + | func (x *ListBox) ConnectSelectedRowsChanged(cb *func(ListBox)) uint32 { |
| 675 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 676 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 677 | + | return gobject.SignalConnect(x.GoPointer(), "selected-rows-changed", cbRefPtr) | |||
| 678 | + | } | |||
| 679 | + | ||||
| 635 | fcb := func(clsPtr uintptr) { | 680 | fcb := func(clsPtr uintptr) { | ||
| 636 | fa := ListBox{} | 681 | fa := ListBox{} | ||
| 637 | fa.Ptr = clsPtr | 682 | fa.Ptr = clsPtr | ||
| 683 | + | cbFn := *cb | |||
| 638 | 684 | ||||
| 639 | - | cb(fa) | 685 | + | cbFn(fa) |
| 640 | 686 | ||||
| 641 | } | 687 | } | ||
| 642 | - | return gobject.SignalConnect(x.GoPointer(), "selected-rows-changed", purego.NewCallback(fcb)) | 688 | + | cbRefPtr := purego.NewCallback(fcb) |
| 689 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 690 | + | return gobject.SignalConnect(x.GoPointer(), "selected-rows-changed", cbRefPtr) | |||
| 643 | } | 691 | } | ||
| 644 | 692 | ||||
| 645 | - | func (x *ListBox) ConnectToggleCursorRow(cb func(ListBox)) uint32 { | 693 | + | func (x *ListBox) ConnectToggleCursorRow(cb *func(ListBox)) uint32 { |
| 694 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 695 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 696 | + | return gobject.SignalConnect(x.GoPointer(), "toggle-cursor-row", cbRefPtr) | |||
| 697 | + | } | |||
| 698 | + | ||||
| 646 | fcb := func(clsPtr uintptr) { | 699 | fcb := func(clsPtr uintptr) { | ||
| 647 | fa := ListBox{} | 700 | fa := ListBox{} | ||
| 648 | fa.Ptr = clsPtr | 701 | fa.Ptr = clsPtr | ||
| 702 | + | cbFn := *cb | |||
| 649 | 703 | ||||
| 650 | - | cb(fa) | 704 | + | cbFn(fa) |
| 651 | 705 | ||||
| 652 | } | 706 | } | ||
| 653 | - | return gobject.SignalConnect(x.GoPointer(), "toggle-cursor-row", purego.NewCallback(fcb)) | 707 | + | cbRefPtr := purego.NewCallback(fcb) |
| 708 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 709 | + | return gobject.SignalConnect(x.GoPointer(), "toggle-cursor-row", cbRefPtr) | |||
| 654 | } | 710 | } | ||
| 655 | 711 | ||||
| 656 | // Emitted to unselect all children of the box, if the selection | 712 | // Emitted to unselect all children of the box, if the selection | ||
| @@ -660,15 +716,23 @@ func (x *ListBox) ConnectToggleCursorRow(cb func(ListBox)) uint32 { | |||||
| 660 | // | 716 | // | ||
| 661 | // The default binding for this signal is | 717 | // The default binding for this signal is | ||
| 662 | // <kbd>Ctrl</kbd>-<kbd>Shift</kbd>-<kbd>a</kbd>. | 718 | // <kbd>Ctrl</kbd>-<kbd>Shift</kbd>-<kbd>a</kbd>. | ||
| 663 | - | func (x *ListBox) ConnectUnselectAll(cb func(ListBox)) uint32 { | 719 | + | func (x *ListBox) ConnectUnselectAll(cb *func(ListBox)) uint32 { |
| 720 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 721 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 722 | + | return gobject.SignalConnect(x.GoPointer(), "unselect-all", cbRefPtr) | |||
| 723 | + | } | |||
| 724 | + | ||||
| 664 | fcb := func(clsPtr uintptr) { | 725 | fcb := func(clsPtr uintptr) { | ||
| 665 | fa := ListBox{} | 726 | fa := ListBox{} | ||
| 666 | fa.Ptr = clsPtr | 727 | fa.Ptr = clsPtr | ||
| 728 | + | cbFn := *cb | |||
| 667 | 729 | ||||
| 668 | - | cb(fa) | 730 | + | cbFn(fa) |
| 669 | 731 | ||||
| 670 | } | 732 | } | ||
| 671 | - | return gobject.SignalConnect(x.GoPointer(), "unselect-all", purego.NewCallback(fcb)) | 733 | + | cbRefPtr := purego.NewCallback(fcb) |
| 734 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 735 | + | return gobject.SignalConnect(x.GoPointer(), "unselect-all", cbRefPtr) | |||
| 672 | } | 736 | } | ||
| 673 | 737 | ||||
| 674 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 738 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
| @@ -998,15 +1062,23 @@ func (c *ListBoxRow) SetGoPointer(ptr uintptr) { | |||||
| 998 | // If you want to be notified when the user activates a row (by key or not), | 1062 | // If you want to be notified when the user activates a row (by key or not), | ||
| 999 | // use the [signal@Gtk.ListBox::row-activated] signal on the row’s parent | 1063 | // use the [signal@Gtk.ListBox::row-activated] signal on the row’s parent | ||
| 1000 | // `GtkListBox`. | 1064 | // `GtkListBox`. | ||
| 1001 | - | func (x *ListBoxRow) ConnectActivate(cb func(ListBoxRow)) uint32 { | 1065 | + | func (x *ListBoxRow) ConnectActivate(cb *func(ListBoxRow)) uint32 { |
| 1066 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1067 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1068 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 1069 | + | } | |||
| 1070 | + | ||||
| 1002 | fcb := func(clsPtr uintptr) { | 1071 | fcb := func(clsPtr uintptr) { | ||
| 1003 | fa := ListBoxRow{} | 1072 | fa := ListBoxRow{} | ||
| 1004 | fa.Ptr = clsPtr | 1073 | fa.Ptr = clsPtr | ||
| 1074 | + | cbFn := *cb | |||
| 1005 | 1075 | ||||
| 1006 | - | cb(fa) | 1076 | + | cbFn(fa) |
| 1007 | 1077 | ||||
| 1008 | } | 1078 | } | ||
| 1009 | - | return gobject.SignalConnect(x.GoPointer(), "activate", purego.NewCallback(fcb)) | 1079 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1080 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1081 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 1010 | } | 1082 | } | ||
| 1011 | 1083 | ||||
| 1012 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 1084 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/gtk/gtkliststore.go +6 -6
| @@ -566,9 +566,9 @@ func (x *ListStore) FilterNew(RootVar *TreePath) *TreeModelBase { | |||||
| 566 | // | 566 | // | ||
| 567 | // If @func returns %TRUE, then the tree ceases to be walked, | 567 | // If @func returns %TRUE, then the tree ceases to be walked, | ||
| 568 | // and gtk_tree_model_foreach() returns. | 568 | // and gtk_tree_model_foreach() returns. | ||
| 569 | - | func (x *ListStore) Foreach(FuncVar TreeModelForeachFunc, UserDataVar uintptr) { | 569 | + | func (x *ListStore) Foreach(FuncVar *TreeModelForeachFunc, UserDataVar uintptr) { |
| 570 | 570 | ||||
| 571 | - | XGtkTreeModelForeach(x.GoPointer(), purego.NewCallback(FuncVar), UserDataVar) | 571 | + | XGtkTreeModelForeach(x.GoPointer(), glib.NewCallback(FuncVar), UserDataVar) |
| 572 | 572 | ||||
| 573 | } | 573 | } | ||
| 574 | 574 | ||||
| @@ -900,9 +900,9 @@ func (x *ListStore) HasDefaultSortFunc() bool { | |||||
| 900 | // This means that once the model has been sorted, it can’t go back to the | 900 | // This means that once the model has been sorted, it can’t go back to the | ||
| 901 | // default state. In this case, when the current sort column id of @sortable | 901 | // default state. In this case, when the current sort column id of @sortable | ||
| 902 | // is %GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, the model will be unsorted. | 902 | // is %GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, the model will be unsorted. | ||
| 903 | - | func (x *ListStore) SetDefaultSortFunc(SortFuncVar TreeIterCompareFunc, UserDataVar uintptr, DestroyVar glib.DestroyNotify) { | 903 | + | func (x *ListStore) SetDefaultSortFunc(SortFuncVar *TreeIterCompareFunc, UserDataVar uintptr, DestroyVar *glib.DestroyNotify) { |
| 904 | 904 | ||||
| 905 | - | XGtkTreeSortableSetDefaultSortFunc(x.GoPointer(), purego.NewCallback(SortFuncVar), UserDataVar, purego.NewCallback(DestroyVar)) | 905 | + | XGtkTreeSortableSetDefaultSortFunc(x.GoPointer(), glib.NewCallback(SortFuncVar), UserDataVar, glib.NewCallback(DestroyVar)) |
| 906 | 906 | ||||
| 907 | } | 907 | } | ||
| 908 | 908 | ||||
| @@ -924,9 +924,9 @@ func (x *ListStore) SetSortColumnId(SortColumnIdVar int, OrderVar SortType) { | |||||
| 924 | // Sets the comparison function used when sorting to be @sort_func. If the | 924 | // Sets the comparison function used when sorting to be @sort_func. If the | ||
| 925 | // current sort column id of @sortable is the same as @sort_column_id, then | 925 | // current sort column id of @sortable is the same as @sort_column_id, then | ||
| 926 | // the model will sort using this function. | 926 | // the model will sort using this function. | ||
| 927 | - | func (x *ListStore) SetSortFunc(SortColumnIdVar int, SortFuncVar TreeIterCompareFunc, UserDataVar uintptr, DestroyVar glib.DestroyNotify) { | 927 | + | func (x *ListStore) SetSortFunc(SortColumnIdVar int, SortFuncVar *TreeIterCompareFunc, UserDataVar uintptr, DestroyVar *glib.DestroyNotify) { |
| 928 | 928 | ||||
| 929 | - | XGtkTreeSortableSetSortFunc(x.GoPointer(), SortColumnIdVar, purego.NewCallback(SortFuncVar), UserDataVar, purego.NewCallback(DestroyVar)) | 929 | + | XGtkTreeSortableSetSortFunc(x.GoPointer(), SortColumnIdVar, glib.NewCallback(SortFuncVar), UserDataVar, glib.NewCallback(DestroyVar)) |
| 930 | 930 | ||||
| 931 | } | 931 | } | ||
| 932 | 932 | ||||
M v4/gtk/gtklistview.go +12 -3
| @@ -6,6 +6,7 @@ import ( | |||||
| 6 | 6 | ||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 9 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 10 | ) | 11 | ) | ||
| 11 | 12 | ||||
| @@ -283,15 +284,23 @@ func (c *ListView) SetGoPointer(ptr uintptr) { | |||||
| 283 | // This allows for a convenient way to handle activation in a listview. | 284 | // This allows for a convenient way to handle activation in a listview. | ||
| 284 | // See [method@Gtk.ListItem.set_activatable] for details on how to use | 285 | // See [method@Gtk.ListItem.set_activatable] for details on how to use | ||
| 285 | // this signal. | 286 | // this signal. | ||
| 286 | - | func (x *ListView) ConnectActivate(cb func(ListView, uint)) uint32 { | 287 | + | func (x *ListView) ConnectActivate(cb *func(ListView, uint)) uint32 { |
| 288 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 289 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 290 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 291 | + | } | |||
| 292 | + | ||||
| 287 | fcb := func(clsPtr uintptr, PositionVarp uint) { | 293 | fcb := func(clsPtr uintptr, PositionVarp uint) { | ||
| 288 | fa := ListView{} | 294 | fa := ListView{} | ||
| 289 | fa.Ptr = clsPtr | 295 | fa.Ptr = clsPtr | ||
| 296 | + | cbFn := *cb | |||
| 290 | 297 | ||||
| 291 | - | cb(fa, PositionVarp) | 298 | + | cbFn(fa, PositionVarp) |
| 292 | 299 | ||||
| 293 | } | 300 | } | ||
| 294 | - | return gobject.SignalConnect(x.GoPointer(), "activate", purego.NewCallback(fcb)) | 301 | + | cbRefPtr := purego.NewCallback(fcb) |
| 302 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 303 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 295 | } | 304 | } | ||
| 296 | 305 | ||||
| 297 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 306 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/gtk/gtkmaplistmodel.go +4 -4
| @@ -71,10 +71,10 @@ func MapListModelNewFromInternalPtr(ptr uintptr) *MapListModel { | |||||
| 71 | var xNewMapListModel func(uintptr, uintptr, uintptr, uintptr) uintptr | 71 | var xNewMapListModel func(uintptr, uintptr, uintptr, uintptr) uintptr | ||
| 72 | 72 | ||||
| 73 | // Creates a new `GtkMapListModel` for the given arguments. | 73 | // Creates a new `GtkMapListModel` for the given arguments. | ||
| 74 | - | func NewMapListModel(ModelVar gio.ListModel, MapFuncVar MapListModelMapFunc, UserDataVar uintptr, UserDestroyVar glib.DestroyNotify) *MapListModel { | 74 | + | func NewMapListModel(ModelVar gio.ListModel, MapFuncVar *MapListModelMapFunc, UserDataVar uintptr, UserDestroyVar *glib.DestroyNotify) *MapListModel { |
| 75 | var cls *MapListModel | 75 | var cls *MapListModel | ||
| 76 | 76 | ||||
| 77 | - | cret := xNewMapListModel(ModelVar.GoPointer(), purego.NewCallback(MapFuncVar), UserDataVar, purego.NewCallback(UserDestroyVar)) | 77 | + | cret := xNewMapListModel(ModelVar.GoPointer(), glib.NewCallback(MapFuncVar), UserDataVar, glib.NewCallback(UserDestroyVar)) |
| 78 | 78 | ||||
| 79 | if cret == 0 { | 79 | if cret == 0 { | ||
| 80 | return nil | 80 | return nil | ||
| @@ -123,9 +123,9 @@ var xMapListModelSetMapFunc func(uintptr, uintptr, uintptr, uintptr) | |||||
| 123 | // GTK makes no effort to ensure that @map_func conforms to the item type | 123 | // GTK makes no effort to ensure that @map_func conforms to the item type | ||
| 124 | // of @self. It assumes that the caller knows what they are doing and the map | 124 | // of @self. It assumes that the caller knows what they are doing and the map | ||
| 125 | // function returns items of the appropriate type. | 125 | // function returns items of the appropriate type. | ||
| 126 | - | func (x *MapListModel) SetMapFunc(MapFuncVar MapListModelMapFunc, UserDataVar uintptr, UserDestroyVar glib.DestroyNotify) { | 126 | + | func (x *MapListModel) SetMapFunc(MapFuncVar *MapListModelMapFunc, UserDataVar uintptr, UserDestroyVar *glib.DestroyNotify) { |
| 127 | 127 | ||||
| 128 | - | xMapListModelSetMapFunc(x.GoPointer(), purego.NewCallback(MapFuncVar), UserDataVar, purego.NewCallback(UserDestroyVar)) | 128 | + | xMapListModelSetMapFunc(x.GoPointer(), glib.NewCallback(MapFuncVar), UserDataVar, glib.NewCallback(UserDestroyVar)) |
| 129 | 129 | ||||
| 130 | } | 130 | } | ||
| 131 | 131 | ||||
M v4/gtk/gtkmenubutton.go +15 -5
| @@ -2,6 +2,8 @@ | |||||
| 2 | package gtk | 2 | package gtk | ||
| 3 | 3 | ||||
| 4 | import ( | 4 | import ( | ||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 5 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 6 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 7 | "github.com/jwijenbergh/puregotk/v4/gio" | 9 | "github.com/jwijenbergh/puregotk/v4/gio" | ||
| @@ -288,9 +290,9 @@ var xMenuButtonSetCreatePopupFunc func(uintptr, uintptr, uintptr, uintptr) | |||||
| 288 | // | 290 | // | ||
| 289 | // Using this function will not reset the menu widget attached to | 291 | // Using this function will not reset the menu widget attached to | ||
| 290 | // @menu_button. Instead, this can be done manually in @func. | 292 | // @menu_button. Instead, this can be done manually in @func. | ||
| 291 | - | func (x *MenuButton) SetCreatePopupFunc(FuncVar MenuButtonCreatePopupFunc, UserDataVar uintptr, DestroyNotifyVar glib.DestroyNotify) { | 293 | + | func (x *MenuButton) SetCreatePopupFunc(FuncVar *MenuButtonCreatePopupFunc, UserDataVar uintptr, DestroyNotifyVar *glib.DestroyNotify) { |
| 292 | 294 | ||||
| 293 | - | xMenuButtonSetCreatePopupFunc(x.GoPointer(), purego.NewCallback(FuncVar), UserDataVar, purego.NewCallback(DestroyNotifyVar)) | 295 | + | xMenuButtonSetCreatePopupFunc(x.GoPointer(), glib.NewCallback(FuncVar), UserDataVar, glib.NewCallback(DestroyNotifyVar)) |
| 294 | 296 | ||||
| 295 | } | 297 | } | ||
| 296 | 298 | ||||
| @@ -416,15 +418,23 @@ func (c *MenuButton) SetGoPointer(ptr uintptr) { | |||||
| 416 | // | 418 | // | ||
| 417 | // The `::activate` signal on `GtkMenuButton` is an action signal and | 419 | // The `::activate` signal on `GtkMenuButton` is an action signal and | ||
| 418 | // emitting it causes the button to pop up its menu. | 420 | // emitting it causes the button to pop up its menu. | ||
| 419 | - | func (x *MenuButton) ConnectActivate(cb func(MenuButton)) uint32 { | 421 | + | func (x *MenuButton) ConnectActivate(cb *func(MenuButton)) uint32 { |
| 422 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 423 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 424 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 425 | + | } | |||
| 426 | + | ||||
| 420 | fcb := func(clsPtr uintptr) { | 427 | fcb := func(clsPtr uintptr) { | ||
| 421 | fa := MenuButton{} | 428 | fa := MenuButton{} | ||
| 422 | fa.Ptr = clsPtr | 429 | fa.Ptr = clsPtr | ||
| 430 | + | cbFn := *cb | |||
| 423 | 431 | ||||
| 424 | - | cb(fa) | 432 | + | cbFn(fa) |
| 425 | 433 | ||||
| 426 | } | 434 | } | ||
| 427 | - | return gobject.SignalConnect(x.GoPointer(), "activate", purego.NewCallback(fcb)) | 435 | + | cbRefPtr := purego.NewCallback(fcb) |
| 436 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 437 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 428 | } | 438 | } | ||
| 429 | 439 | ||||
| 430 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 440 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/gtk/gtknativedialog.go +12 -3
| @@ -6,6 +6,7 @@ import ( | |||||
| 6 | 6 | ||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 9 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 10 | ) | 11 | ) | ||
| 11 | 12 | ||||
| @@ -191,15 +192,23 @@ func (c *NativeDialog) SetGoPointer(ptr uintptr) { | |||||
| 191 | // | 192 | // | ||
| 192 | // If you call [method@Gtk.NativeDialog.hide] before the user | 193 | // If you call [method@Gtk.NativeDialog.hide] before the user | ||
| 193 | // responds to the dialog this signal will not be emitted. | 194 | // responds to the dialog this signal will not be emitted. | ||
| 194 | - | func (x *NativeDialog) ConnectResponse(cb func(NativeDialog, int)) uint32 { | 195 | + | func (x *NativeDialog) ConnectResponse(cb *func(NativeDialog, int)) uint32 { |
| 196 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 197 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 198 | + | return gobject.SignalConnect(x.GoPointer(), "response", cbRefPtr) | |||
| 199 | + | } | |||
| 200 | + | ||||
| 195 | fcb := func(clsPtr uintptr, ResponseIdVarp int) { | 201 | fcb := func(clsPtr uintptr, ResponseIdVarp int) { | ||
| 196 | fa := NativeDialog{} | 202 | fa := NativeDialog{} | ||
| 197 | fa.Ptr = clsPtr | 203 | fa.Ptr = clsPtr | ||
| 204 | + | cbFn := *cb | |||
| 198 | 205 | ||||
| 199 | - | cb(fa, ResponseIdVarp) | 206 | + | cbFn(fa, ResponseIdVarp) |
| 200 | 207 | ||||
| 201 | } | 208 | } | ||
| 202 | - | return gobject.SignalConnect(x.GoPointer(), "response", purego.NewCallback(fcb)) | 209 | + | cbRefPtr := purego.NewCallback(fcb) |
| 210 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 211 | + | return gobject.SignalConnect(x.GoPointer(), "response", cbRefPtr) | |||
| 203 | } | 212 | } | ||
| 204 | 213 | ||||
| 205 | func init() { | 214 | func init() { | ||
M v4/gtk/gtknotebook.go +113 -30
| @@ -2,9 +2,12 @@ | |||||
| 2 | package gtk | 2 | package gtk | ||
| 3 | 3 | ||||
| 4 | import ( | 4 | import ( | ||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 5 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 6 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 7 | "github.com/jwijenbergh/puregotk/v4/gio" | 9 | "github.com/jwijenbergh/puregotk/v4/gio" | ||
| 10 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 8 | "github.com/jwijenbergh/puregotk/v4/gobject" | 11 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 9 | ) | 12 | ) | ||
| 10 | 13 | ||||
| @@ -692,15 +695,23 @@ func (c *Notebook) SetGoPointer(ptr uintptr) { | |||||
| 692 | c.Ptr = ptr | 695 | c.Ptr = ptr | ||
| 693 | } | 696 | } | ||
| 694 | 697 | ||||
| 695 | - | func (x *Notebook) ConnectChangeCurrentPage(cb func(Notebook, int) bool) uint32 { | 698 | + | func (x *Notebook) ConnectChangeCurrentPage(cb *func(Notebook, int) bool) uint32 { |
| 699 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 700 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 701 | + | return gobject.SignalConnect(x.GoPointer(), "change-current-page", cbRefPtr) | |||
| 702 | + | } | |||
| 703 | + | ||||
| 696 | fcb := func(clsPtr uintptr, ObjectVarp int) bool { | 704 | fcb := func(clsPtr uintptr, ObjectVarp int) bool { | ||
| 697 | fa := Notebook{} | 705 | fa := Notebook{} | ||
| 698 | fa.Ptr = clsPtr | 706 | fa.Ptr = clsPtr | ||
| 707 | + | cbFn := *cb | |||
| 699 | 708 | ||||
| 700 | - | return cb(fa, ObjectVarp) | 709 | + | return cbFn(fa, ObjectVarp) |
| 701 | 710 | ||||
| 702 | } | 711 | } | ||
| 703 | - | return gobject.SignalConnect(x.GoPointer(), "change-current-page", purego.NewCallback(fcb)) | 712 | + | cbRefPtr := purego.NewCallback(fcb) |
| 713 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 714 | + | return gobject.SignalConnect(x.GoPointer(), "change-current-page", cbRefPtr) | |||
| 704 | } | 715 | } | ||
| 705 | 716 | ||||
| 706 | // The ::create-window signal is emitted when a detachable | 717 | // The ::create-window signal is emitted when a detachable | ||
| @@ -711,111 +722,183 @@ func (x *Notebook) ConnectChangeCurrentPage(cb func(Notebook, int) bool) uint32 | |||||
| 711 | // responsible for moving/resizing the window and adding the | 722 | // responsible for moving/resizing the window and adding the | ||
| 712 | // necessary properties to the notebook (e.g. the | 723 | // necessary properties to the notebook (e.g. the | ||
| 713 | // `GtkNotebook`:group-name ). | 724 | // `GtkNotebook`:group-name ). | ||
| 714 | - | func (x *Notebook) ConnectCreateWindow(cb func(Notebook, uintptr) Notebook) uint32 { | 725 | + | func (x *Notebook) ConnectCreateWindow(cb *func(Notebook, uintptr) Notebook) uint32 { |
| 726 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 727 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 728 | + | return gobject.SignalConnect(x.GoPointer(), "create-window", cbRefPtr) | |||
| 729 | + | } | |||
| 730 | + | ||||
| 715 | fcb := func(clsPtr uintptr, PageVarp uintptr) uintptr { | 731 | fcb := func(clsPtr uintptr, PageVarp uintptr) uintptr { | ||
| 716 | fa := Notebook{} | 732 | fa := Notebook{} | ||
| 717 | fa.Ptr = clsPtr | 733 | fa.Ptr = clsPtr | ||
| 734 | + | cbFn := *cb | |||
| 718 | 735 | ||||
| 719 | - | CreateWindowCls := cb(fa, PageVarp) | 736 | + | CreateWindowCls := cbFn(fa, PageVarp) |
| 720 | return CreateWindowCls.Ptr | 737 | return CreateWindowCls.Ptr | ||
| 721 | 738 | ||||
| 722 | } | 739 | } | ||
| 723 | - | return gobject.SignalConnect(x.GoPointer(), "create-window", purego.NewCallback(fcb)) | 740 | + | cbRefPtr := purego.NewCallback(fcb) |
| 741 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 742 | + | return gobject.SignalConnect(x.GoPointer(), "create-window", cbRefPtr) | |||
| 724 | } | 743 | } | ||
| 725 | 744 | ||||
| 726 | - | func (x *Notebook) ConnectFocusTab(cb func(Notebook, NotebookTab) bool) uint32 { | 745 | + | func (x *Notebook) ConnectFocusTab(cb *func(Notebook, NotebookTab) bool) uint32 { |
| 746 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 747 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 748 | + | return gobject.SignalConnect(x.GoPointer(), "focus-tab", cbRefPtr) | |||
| 749 | + | } | |||
| 750 | + | ||||
| 727 | fcb := func(clsPtr uintptr, ObjectVarp NotebookTab) bool { | 751 | fcb := func(clsPtr uintptr, ObjectVarp NotebookTab) bool { | ||
| 728 | fa := Notebook{} | 752 | fa := Notebook{} | ||
| 729 | fa.Ptr = clsPtr | 753 | fa.Ptr = clsPtr | ||
| 754 | + | cbFn := *cb | |||
| 730 | 755 | ||||
| 731 | - | return cb(fa, ObjectVarp) | 756 | + | return cbFn(fa, ObjectVarp) |
| 732 | 757 | ||||
| 733 | } | 758 | } | ||
| 734 | - | return gobject.SignalConnect(x.GoPointer(), "focus-tab", purego.NewCallback(fcb)) | 759 | + | cbRefPtr := purego.NewCallback(fcb) |
| 760 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 761 | + | return gobject.SignalConnect(x.GoPointer(), "focus-tab", cbRefPtr) | |||
| 735 | } | 762 | } | ||
| 736 | 763 | ||||
| 737 | - | func (x *Notebook) ConnectMoveFocusOut(cb func(Notebook, DirectionType)) uint32 { | 764 | + | func (x *Notebook) ConnectMoveFocusOut(cb *func(Notebook, DirectionType)) uint32 { |
| 765 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 766 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 767 | + | return gobject.SignalConnect(x.GoPointer(), "move-focus-out", cbRefPtr) | |||
| 768 | + | } | |||
| 769 | + | ||||
| 738 | fcb := func(clsPtr uintptr, ObjectVarp DirectionType) { | 770 | fcb := func(clsPtr uintptr, ObjectVarp DirectionType) { | ||
| 739 | fa := Notebook{} | 771 | fa := Notebook{} | ||
| 740 | fa.Ptr = clsPtr | 772 | fa.Ptr = clsPtr | ||
| 773 | + | cbFn := *cb | |||
| 741 | 774 | ||||
| 742 | - | cb(fa, ObjectVarp) | 775 | + | cbFn(fa, ObjectVarp) |
| 743 | 776 | ||||
| 744 | } | 777 | } | ||
| 745 | - | return gobject.SignalConnect(x.GoPointer(), "move-focus-out", purego.NewCallback(fcb)) | 778 | + | cbRefPtr := purego.NewCallback(fcb) |
| 779 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 780 | + | return gobject.SignalConnect(x.GoPointer(), "move-focus-out", cbRefPtr) | |||
| 746 | } | 781 | } | ||
| 747 | 782 | ||||
| 748 | // the ::page-added signal is emitted in the notebook | 783 | // the ::page-added signal is emitted in the notebook | ||
| 749 | // right after a page is added to the notebook. | 784 | // right after a page is added to the notebook. | ||
| 750 | - | func (x *Notebook) ConnectPageAdded(cb func(Notebook, uintptr, uint)) uint32 { | 785 | + | func (x *Notebook) ConnectPageAdded(cb *func(Notebook, uintptr, uint)) uint32 { |
| 786 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 787 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 788 | + | return gobject.SignalConnect(x.GoPointer(), "page-added", cbRefPtr) | |||
| 789 | + | } | |||
| 790 | + | ||||
| 751 | fcb := func(clsPtr uintptr, ChildVarp uintptr, PageNumVarp uint) { | 791 | fcb := func(clsPtr uintptr, ChildVarp uintptr, PageNumVarp uint) { | ||
| 752 | fa := Notebook{} | 792 | fa := Notebook{} | ||
| 753 | fa.Ptr = clsPtr | 793 | fa.Ptr = clsPtr | ||
| 794 | + | cbFn := *cb | |||
| 754 | 795 | ||||
| 755 | - | cb(fa, ChildVarp, PageNumVarp) | 796 | + | cbFn(fa, ChildVarp, PageNumVarp) |
| 756 | 797 | ||||
| 757 | } | 798 | } | ||
| 758 | - | return gobject.SignalConnect(x.GoPointer(), "page-added", purego.NewCallback(fcb)) | 799 | + | cbRefPtr := purego.NewCallback(fcb) |
| 800 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 801 | + | return gobject.SignalConnect(x.GoPointer(), "page-added", cbRefPtr) | |||
| 759 | } | 802 | } | ||
| 760 | 803 | ||||
| 761 | // the ::page-removed signal is emitted in the notebook | 804 | // the ::page-removed signal is emitted in the notebook | ||
| 762 | // right after a page is removed from the notebook. | 805 | // right after a page is removed from the notebook. | ||
| 763 | - | func (x *Notebook) ConnectPageRemoved(cb func(Notebook, uintptr, uint)) uint32 { | 806 | + | func (x *Notebook) ConnectPageRemoved(cb *func(Notebook, uintptr, uint)) uint32 { |
| 807 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 808 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 809 | + | return gobject.SignalConnect(x.GoPointer(), "page-removed", cbRefPtr) | |||
| 810 | + | } | |||
| 811 | + | ||||
| 764 | fcb := func(clsPtr uintptr, ChildVarp uintptr, PageNumVarp uint) { | 812 | fcb := func(clsPtr uintptr, ChildVarp uintptr, PageNumVarp uint) { | ||
| 765 | fa := Notebook{} | 813 | fa := Notebook{} | ||
| 766 | fa.Ptr = clsPtr | 814 | fa.Ptr = clsPtr | ||
| 815 | + | cbFn := *cb | |||
| 767 | 816 | ||||
| 768 | - | cb(fa, ChildVarp, PageNumVarp) | 817 | + | cbFn(fa, ChildVarp, PageNumVarp) |
| 769 | 818 | ||||
| 770 | } | 819 | } | ||
| 771 | - | return gobject.SignalConnect(x.GoPointer(), "page-removed", purego.NewCallback(fcb)) | 820 | + | cbRefPtr := purego.NewCallback(fcb) |
| 821 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 822 | + | return gobject.SignalConnect(x.GoPointer(), "page-removed", cbRefPtr) | |||
| 772 | } | 823 | } | ||
| 773 | 824 | ||||
| 774 | // the ::page-reordered signal is emitted in the notebook | 825 | // the ::page-reordered signal is emitted in the notebook | ||
| 775 | // right after a page has been reordered. | 826 | // right after a page has been reordered. | ||
| 776 | - | func (x *Notebook) ConnectPageReordered(cb func(Notebook, uintptr, uint)) uint32 { | 827 | + | func (x *Notebook) ConnectPageReordered(cb *func(Notebook, uintptr, uint)) uint32 { |
| 828 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 829 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 830 | + | return gobject.SignalConnect(x.GoPointer(), "page-reordered", cbRefPtr) | |||
| 831 | + | } | |||
| 832 | + | ||||
| 777 | fcb := func(clsPtr uintptr, ChildVarp uintptr, PageNumVarp uint) { | 833 | fcb := func(clsPtr uintptr, ChildVarp uintptr, PageNumVarp uint) { | ||
| 778 | fa := Notebook{} | 834 | fa := Notebook{} | ||
| 779 | fa.Ptr = clsPtr | 835 | fa.Ptr = clsPtr | ||
| 836 | + | cbFn := *cb | |||
| 780 | 837 | ||||
| 781 | - | cb(fa, ChildVarp, PageNumVarp) | 838 | + | cbFn(fa, ChildVarp, PageNumVarp) |
| 782 | 839 | ||||
| 783 | } | 840 | } | ||
| 784 | - | return gobject.SignalConnect(x.GoPointer(), "page-reordered", purego.NewCallback(fcb)) | 841 | + | cbRefPtr := purego.NewCallback(fcb) |
| 842 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 843 | + | return gobject.SignalConnect(x.GoPointer(), "page-reordered", cbRefPtr) | |||
| 785 | } | 844 | } | ||
| 786 | 845 | ||||
| 787 | - | func (x *Notebook) ConnectReorderTab(cb func(Notebook, DirectionType, bool) bool) uint32 { | 846 | + | func (x *Notebook) ConnectReorderTab(cb *func(Notebook, DirectionType, bool) bool) uint32 { |
| 847 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 848 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 849 | + | return gobject.SignalConnect(x.GoPointer(), "reorder-tab", cbRefPtr) | |||
| 850 | + | } | |||
| 851 | + | ||||
| 788 | fcb := func(clsPtr uintptr, ObjectVarp DirectionType, P0Varp bool) bool { | 852 | fcb := func(clsPtr uintptr, ObjectVarp DirectionType, P0Varp bool) bool { | ||
| 789 | fa := Notebook{} | 853 | fa := Notebook{} | ||
| 790 | fa.Ptr = clsPtr | 854 | fa.Ptr = clsPtr | ||
| 855 | + | cbFn := *cb | |||
| 791 | 856 | ||||
| 792 | - | return cb(fa, ObjectVarp, P0Varp) | 857 | + | return cbFn(fa, ObjectVarp, P0Varp) |
| 793 | 858 | ||||
| 794 | } | 859 | } | ||
| 795 | - | return gobject.SignalConnect(x.GoPointer(), "reorder-tab", purego.NewCallback(fcb)) | 860 | + | cbRefPtr := purego.NewCallback(fcb) |
| 861 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 862 | + | return gobject.SignalConnect(x.GoPointer(), "reorder-tab", cbRefPtr) | |||
| 796 | } | 863 | } | ||
| 797 | 864 | ||||
| 798 | - | func (x *Notebook) ConnectSelectPage(cb func(Notebook, bool) bool) uint32 { | 865 | + | func (x *Notebook) ConnectSelectPage(cb *func(Notebook, bool) bool) uint32 { |
| 866 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 867 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 868 | + | return gobject.SignalConnect(x.GoPointer(), "select-page", cbRefPtr) | |||
| 869 | + | } | |||
| 870 | + | ||||
| 799 | fcb := func(clsPtr uintptr, ObjectVarp bool) bool { | 871 | fcb := func(clsPtr uintptr, ObjectVarp bool) bool { | ||
| 800 | fa := Notebook{} | 872 | fa := Notebook{} | ||
| 801 | fa.Ptr = clsPtr | 873 | fa.Ptr = clsPtr | ||
| 874 | + | cbFn := *cb | |||
| 802 | 875 | ||||
| 803 | - | return cb(fa, ObjectVarp) | 876 | + | return cbFn(fa, ObjectVarp) |
| 804 | 877 | ||||
| 805 | } | 878 | } | ||
| 806 | - | return gobject.SignalConnect(x.GoPointer(), "select-page", purego.NewCallback(fcb)) | 879 | + | cbRefPtr := purego.NewCallback(fcb) |
| 880 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 881 | + | return gobject.SignalConnect(x.GoPointer(), "select-page", cbRefPtr) | |||
| 807 | } | 882 | } | ||
| 808 | 883 | ||||
| 809 | // Emitted when the user or a function changes the current page. | 884 | // Emitted when the user or a function changes the current page. | ||
| 810 | - | func (x *Notebook) ConnectSwitchPage(cb func(Notebook, uintptr, uint)) uint32 { | 885 | + | func (x *Notebook) ConnectSwitchPage(cb *func(Notebook, uintptr, uint)) uint32 { |
| 886 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 887 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 888 | + | return gobject.SignalConnect(x.GoPointer(), "switch-page", cbRefPtr) | |||
| 889 | + | } | |||
| 890 | + | ||||
| 811 | fcb := func(clsPtr uintptr, PageVarp uintptr, PageNumVarp uint) { | 891 | fcb := func(clsPtr uintptr, PageVarp uintptr, PageNumVarp uint) { | ||
| 812 | fa := Notebook{} | 892 | fa := Notebook{} | ||
| 813 | fa.Ptr = clsPtr | 893 | fa.Ptr = clsPtr | ||
| 894 | + | cbFn := *cb | |||
| 814 | 895 | ||||
| 815 | - | cb(fa, PageVarp, PageNumVarp) | 896 | + | cbFn(fa, PageVarp, PageNumVarp) |
| 816 | 897 | ||||
| 817 | } | 898 | } | ||
| 818 | - | return gobject.SignalConnect(x.GoPointer(), "switch-page", purego.NewCallback(fcb)) | 899 | + | cbRefPtr := purego.NewCallback(fcb) |
| 900 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 901 | + | return gobject.SignalConnect(x.GoPointer(), "switch-page", cbRefPtr) | |||
| 819 | } | 902 | } | ||
| 820 | 903 | ||||
| 821 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 904 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/gtk/gtkoverlay.go +14 -3
| @@ -2,8 +2,11 @@ | |||||
| 2 | package gtk | 2 | package gtk | ||
| 3 | 3 | ||||
| 4 | import ( | 4 | import ( | ||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 5 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 6 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 7 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 8 | ) | 11 | ) | ||
| 9 | 12 | ||||
| @@ -180,15 +183,23 @@ func (c *Overlay) SetGoPointer(ptr uintptr) { | |||||
| 180 | // be full-width/height). If the main child is a | 183 | // be full-width/height). If the main child is a | ||
| 181 | // `GtkScrolledWindow`, the overlays are placed relative | 184 | // `GtkScrolledWindow`, the overlays are placed relative | ||
| 182 | // to its contents. | 185 | // to its contents. | ||
| 183 | - | func (x *Overlay) ConnectGetChildPosition(cb func(Overlay, uintptr, uintptr) bool) uint32 { | 186 | + | func (x *Overlay) ConnectGetChildPosition(cb *func(Overlay, uintptr, uintptr) bool) uint32 { |
| 187 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 188 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 189 | + | return gobject.SignalConnect(x.GoPointer(), "get-child-position", cbRefPtr) | |||
| 190 | + | } | |||
| 191 | + | ||||
| 184 | fcb := func(clsPtr uintptr, WidgetVarp uintptr, AllocationVarp uintptr) bool { | 192 | fcb := func(clsPtr uintptr, WidgetVarp uintptr, AllocationVarp uintptr) bool { | ||
| 185 | fa := Overlay{} | 193 | fa := Overlay{} | ||
| 186 | fa.Ptr = clsPtr | 194 | fa.Ptr = clsPtr | ||
| 195 | + | cbFn := *cb | |||
| 187 | 196 | ||||
| 188 | - | return cb(fa, WidgetVarp, AllocationVarp) | 197 | + | return cbFn(fa, WidgetVarp, AllocationVarp) |
| 189 | 198 | ||||
| 190 | } | 199 | } | ||
| 191 | - | return gobject.SignalConnect(x.GoPointer(), "get-child-position", purego.NewCallback(fcb)) | 200 | + | cbRefPtr := purego.NewCallback(fcb) |
| 201 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 202 | + | return gobject.SignalConnect(x.GoPointer(), "get-child-position", cbRefPtr) | |||
| 192 | } | 203 | } | ||
| 193 | 204 | ||||
| 194 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 205 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/gtk/gtkpaned.go +69 -18
| @@ -2,8 +2,11 @@ | |||||
| 2 | package gtk | 2 | package gtk | ||
| 3 | 3 | ||||
| 4 | import ( | 4 | import ( | ||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 5 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 6 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 7 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 8 | ) | 11 | ) | ||
| 9 | 12 | ||||
| @@ -280,15 +283,23 @@ func (c *Paned) SetGoPointer(ptr uintptr) { | |||||
| 280 | // | 283 | // | ||
| 281 | // The default binding for this signal is <kbd>Return</kbd> or | 284 | // The default binding for this signal is <kbd>Return</kbd> or | ||
| 282 | // <kbd>Space</kbd>. | 285 | // <kbd>Space</kbd>. | ||
| 283 | - | func (x *Paned) ConnectAcceptPosition(cb func(Paned) bool) uint32 { | 286 | + | func (x *Paned) ConnectAcceptPosition(cb *func(Paned) bool) uint32 { |
| 287 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 288 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 289 | + | return gobject.SignalConnect(x.GoPointer(), "accept-position", cbRefPtr) | |||
| 290 | + | } | |||
| 291 | + | ||||
| 284 | fcb := func(clsPtr uintptr) bool { | 292 | fcb := func(clsPtr uintptr) bool { | ||
| 285 | fa := Paned{} | 293 | fa := Paned{} | ||
| 286 | fa.Ptr = clsPtr | 294 | fa.Ptr = clsPtr | ||
| 295 | + | cbFn := *cb | |||
| 287 | 296 | ||||
| 288 | - | return cb(fa) | 297 | + | return cbFn(fa) |
| 289 | 298 | ||||
| 290 | } | 299 | } | ||
| 291 | - | return gobject.SignalConnect(x.GoPointer(), "accept-position", purego.NewCallback(fcb)) | 300 | + | cbRefPtr := purego.NewCallback(fcb) |
| 301 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 302 | + | return gobject.SignalConnect(x.GoPointer(), "accept-position", cbRefPtr) | |||
| 292 | } | 303 | } | ||
| 293 | 304 | ||||
| 294 | // Emitted to cancel moving the position of the handle using key | 305 | // Emitted to cancel moving the position of the handle using key | ||
| @@ -300,15 +311,23 @@ func (x *Paned) ConnectAcceptPosition(cb func(Paned) bool) uint32 { | |||||
| 300 | // This is a [keybinding signal](class.SignalAction.html). | 311 | // This is a [keybinding signal](class.SignalAction.html). | ||
| 301 | // | 312 | // | ||
| 302 | // The default binding for this signal is <kbd>Escape</kbd>. | 313 | // The default binding for this signal is <kbd>Escape</kbd>. | ||
| 303 | - | func (x *Paned) ConnectCancelPosition(cb func(Paned) bool) uint32 { | 314 | + | func (x *Paned) ConnectCancelPosition(cb *func(Paned) bool) uint32 { |
| 315 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 316 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 317 | + | return gobject.SignalConnect(x.GoPointer(), "cancel-position", cbRefPtr) | |||
| 318 | + | } | |||
| 319 | + | ||||
| 304 | fcb := func(clsPtr uintptr) bool { | 320 | fcb := func(clsPtr uintptr) bool { | ||
| 305 | fa := Paned{} | 321 | fa := Paned{} | ||
| 306 | fa.Ptr = clsPtr | 322 | fa.Ptr = clsPtr | ||
| 323 | + | cbFn := *cb | |||
| 307 | 324 | ||||
| 308 | - | return cb(fa) | 325 | + | return cbFn(fa) |
| 309 | 326 | ||||
| 310 | } | 327 | } | ||
| 311 | - | return gobject.SignalConnect(x.GoPointer(), "cancel-position", purego.NewCallback(fcb)) | 328 | + | cbRefPtr := purego.NewCallback(fcb) |
| 329 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 330 | + | return gobject.SignalConnect(x.GoPointer(), "cancel-position", cbRefPtr) | |||
| 312 | } | 331 | } | ||
| 313 | 332 | ||||
| 314 | // Emitted to cycle the focus between the children of the paned. | 333 | // Emitted to cycle the focus between the children of the paned. | ||
| @@ -316,15 +335,23 @@ func (x *Paned) ConnectCancelPosition(cb func(Paned) bool) uint32 { | |||||
| 316 | // This is a [keybinding signal](class.SignalAction.html). | 335 | // This is a [keybinding signal](class.SignalAction.html). | ||
| 317 | // | 336 | // | ||
| 318 | // The default binding is <kbd>F6</kbd>. | 337 | // The default binding is <kbd>F6</kbd>. | ||
| 319 | - | func (x *Paned) ConnectCycleChildFocus(cb func(Paned, bool) bool) uint32 { | 338 | + | func (x *Paned) ConnectCycleChildFocus(cb *func(Paned, bool) bool) uint32 { |
| 339 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 340 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 341 | + | return gobject.SignalConnect(x.GoPointer(), "cycle-child-focus", cbRefPtr) | |||
| 342 | + | } | |||
| 343 | + | ||||
| 320 | fcb := func(clsPtr uintptr, ReversedVarp bool) bool { | 344 | fcb := func(clsPtr uintptr, ReversedVarp bool) bool { | ||
| 321 | fa := Paned{} | 345 | fa := Paned{} | ||
| 322 | fa.Ptr = clsPtr | 346 | fa.Ptr = clsPtr | ||
| 347 | + | cbFn := *cb | |||
| 323 | 348 | ||||
| 324 | - | return cb(fa, ReversedVarp) | 349 | + | return cbFn(fa, ReversedVarp) |
| 325 | 350 | ||||
| 326 | } | 351 | } | ||
| 327 | - | return gobject.SignalConnect(x.GoPointer(), "cycle-child-focus", purego.NewCallback(fcb)) | 352 | + | cbRefPtr := purego.NewCallback(fcb) |
| 353 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 354 | + | return gobject.SignalConnect(x.GoPointer(), "cycle-child-focus", cbRefPtr) | |||
| 328 | } | 355 | } | ||
| 329 | 356 | ||||
| 330 | // Emitted to cycle whether the paned should grab focus to allow | 357 | // Emitted to cycle whether the paned should grab focus to allow | ||
| @@ -333,29 +360,45 @@ func (x *Paned) ConnectCycleChildFocus(cb func(Paned, bool) bool) uint32 { | |||||
| 333 | // This is a [keybinding signal](class.SignalAction.html). | 360 | // This is a [keybinding signal](class.SignalAction.html). | ||
| 334 | // | 361 | // | ||
| 335 | // The default binding for this signal is <kbd>F8</kbd>. | 362 | // The default binding for this signal is <kbd>F8</kbd>. | ||
| 336 | - | func (x *Paned) ConnectCycleHandleFocus(cb func(Paned, bool) bool) uint32 { | 363 | + | func (x *Paned) ConnectCycleHandleFocus(cb *func(Paned, bool) bool) uint32 { |
| 364 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 365 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 366 | + | return gobject.SignalConnect(x.GoPointer(), "cycle-handle-focus", cbRefPtr) | |||
| 367 | + | } | |||
| 368 | + | ||||
| 337 | fcb := func(clsPtr uintptr, ReversedVarp bool) bool { | 369 | fcb := func(clsPtr uintptr, ReversedVarp bool) bool { | ||
| 338 | fa := Paned{} | 370 | fa := Paned{} | ||
| 339 | fa.Ptr = clsPtr | 371 | fa.Ptr = clsPtr | ||
| 372 | + | cbFn := *cb | |||
| 340 | 373 | ||||
| 341 | - | return cb(fa, ReversedVarp) | 374 | + | return cbFn(fa, ReversedVarp) |
| 342 | 375 | ||||
| 343 | } | 376 | } | ||
| 344 | - | return gobject.SignalConnect(x.GoPointer(), "cycle-handle-focus", purego.NewCallback(fcb)) | 377 | + | cbRefPtr := purego.NewCallback(fcb) |
| 378 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 379 | + | return gobject.SignalConnect(x.GoPointer(), "cycle-handle-focus", cbRefPtr) | |||
| 345 | } | 380 | } | ||
| 346 | 381 | ||||
| 347 | // Emitted to move the handle with key bindings. | 382 | // Emitted to move the handle with key bindings. | ||
| 348 | // | 383 | // | ||
| 349 | // This is a [keybinding signal](class.SignalAction.html). | 384 | // This is a [keybinding signal](class.SignalAction.html). | ||
| 350 | - | func (x *Paned) ConnectMoveHandle(cb func(Paned, ScrollType) bool) uint32 { | 385 | + | func (x *Paned) ConnectMoveHandle(cb *func(Paned, ScrollType) bool) uint32 { |
| 386 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 387 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 388 | + | return gobject.SignalConnect(x.GoPointer(), "move-handle", cbRefPtr) | |||
| 389 | + | } | |||
| 390 | + | ||||
| 351 | fcb := func(clsPtr uintptr, ScrollTypeVarp ScrollType) bool { | 391 | fcb := func(clsPtr uintptr, ScrollTypeVarp ScrollType) bool { | ||
| 352 | fa := Paned{} | 392 | fa := Paned{} | ||
| 353 | fa.Ptr = clsPtr | 393 | fa.Ptr = clsPtr | ||
| 394 | + | cbFn := *cb | |||
| 354 | 395 | ||||
| 355 | - | return cb(fa, ScrollTypeVarp) | 396 | + | return cbFn(fa, ScrollTypeVarp) |
| 356 | 397 | ||||
| 357 | } | 398 | } | ||
| 358 | - | return gobject.SignalConnect(x.GoPointer(), "move-handle", purego.NewCallback(fcb)) | 399 | + | cbRefPtr := purego.NewCallback(fcb) |
| 400 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 401 | + | return gobject.SignalConnect(x.GoPointer(), "move-handle", cbRefPtr) | |||
| 359 | } | 402 | } | ||
| 360 | 403 | ||||
| 361 | // Emitted to accept the current position of the handle and then | 404 | // Emitted to accept the current position of the handle and then | ||
| @@ -364,15 +407,23 @@ func (x *Paned) ConnectMoveHandle(cb func(Paned, ScrollType) bool) uint32 { | |||||
| 364 | // This is a [keybinding signal](class.SignalAction.html). | 407 | // This is a [keybinding signal](class.SignalAction.html). | ||
| 365 | // | 408 | // | ||
| 366 | // The default binding is <kbd>Tab</kbd>. | 409 | // The default binding is <kbd>Tab</kbd>. | ||
| 367 | - | func (x *Paned) ConnectToggleHandleFocus(cb func(Paned) bool) uint32 { | 410 | + | func (x *Paned) ConnectToggleHandleFocus(cb *func(Paned) bool) uint32 { |
| 411 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 412 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 413 | + | return gobject.SignalConnect(x.GoPointer(), "toggle-handle-focus", cbRefPtr) | |||
| 414 | + | } | |||
| 415 | + | ||||
| 368 | fcb := func(clsPtr uintptr) bool { | 416 | fcb := func(clsPtr uintptr) bool { | ||
| 369 | fa := Paned{} | 417 | fa := Paned{} | ||
| 370 | fa.Ptr = clsPtr | 418 | fa.Ptr = clsPtr | ||
| 419 | + | cbFn := *cb | |||
| 371 | 420 | ||||
| 372 | - | return cb(fa) | 421 | + | return cbFn(fa) |
| 373 | 422 | ||||
| 374 | } | 423 | } | ||
| 375 | - | return gobject.SignalConnect(x.GoPointer(), "toggle-handle-focus", purego.NewCallback(fcb)) | 424 | + | cbRefPtr := purego.NewCallback(fcb) |
| 425 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 426 | + | return gobject.SignalConnect(x.GoPointer(), "toggle-handle-focus", cbRefPtr) | |||
| 376 | } | 427 | } | ||
| 377 | 428 | ||||
| 378 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 429 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/gtk/gtkpasswordentry.go +12 -3
| @@ -7,6 +7,7 @@ import ( | |||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | "github.com/jwijenbergh/puregotk/v4/gio" | 9 | "github.com/jwijenbergh/puregotk/v4/gio" | ||
| 10 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | 11 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 11 | ) | 12 | ) | ||
| 12 | 13 | ||||
| @@ -138,15 +139,23 @@ func (c *PasswordEntry) SetGoPointer(ptr uintptr) { | |||||
| 138 | // Emitted when the entry is activated. | 139 | // Emitted when the entry is activated. | ||
| 139 | // | 140 | // | ||
| 140 | // The keybindings for this signal are all forms of the Enter key. | 141 | // The keybindings for this signal are all forms of the Enter key. | ||
| 141 | - | func (x *PasswordEntry) ConnectActivate(cb func(PasswordEntry)) uint32 { | 142 | + | func (x *PasswordEntry) ConnectActivate(cb *func(PasswordEntry)) uint32 { |
| 143 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 144 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 145 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 146 | + | } | |||
| 147 | + | ||||
| 142 | fcb := func(clsPtr uintptr) { | 148 | fcb := func(clsPtr uintptr) { | ||
| 143 | fa := PasswordEntry{} | 149 | fa := PasswordEntry{} | ||
| 144 | fa.Ptr = clsPtr | 150 | fa.Ptr = clsPtr | ||
| 151 | + | cbFn := *cb | |||
| 145 | 152 | ||||
| 146 | - | cb(fa) | 153 | + | cbFn(fa) |
| 147 | 154 | ||||
| 148 | } | 155 | } | ||
| 149 | - | return gobject.SignalConnect(x.GoPointer(), "activate", purego.NewCallback(fcb)) | 156 | + | cbRefPtr := purego.NewCallback(fcb) |
| 157 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 158 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 150 | } | 159 | } | ||
| 151 | 160 | ||||
| 152 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 161 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/gtk/gtkpopover.go +23 -6
| @@ -7,6 +7,7 @@ import ( | |||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | ||
| 10 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | 11 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 11 | "github.com/jwijenbergh/puregotk/v4/gsk" | 12 | "github.com/jwijenbergh/puregotk/v4/gsk" | ||
| 12 | ) | 13 | ) | ||
| @@ -368,27 +369,43 @@ func (c *Popover) SetGoPointer(ptr uintptr) { | |||||
| 368 | // Emitted whend the user activates the default widget. | 369 | // Emitted whend the user activates the default widget. | ||
| 369 | // | 370 | // | ||
| 370 | // This is a [keybinding signal](class.SignalAction.html). | 371 | // This is a [keybinding signal](class.SignalAction.html). | ||
| 371 | - | func (x *Popover) ConnectActivateDefault(cb func(Popover)) uint32 { | 372 | + | func (x *Popover) ConnectActivateDefault(cb *func(Popover)) uint32 { |
| 373 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 374 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 375 | + | return gobject.SignalConnect(x.GoPointer(), "activate-default", cbRefPtr) | |||
| 376 | + | } | |||
| 377 | + | ||||
| 372 | fcb := func(clsPtr uintptr) { | 378 | fcb := func(clsPtr uintptr) { | ||
| 373 | fa := Popover{} | 379 | fa := Popover{} | ||
| 374 | fa.Ptr = clsPtr | 380 | fa.Ptr = clsPtr | ||
| 381 | + | cbFn := *cb | |||
| 375 | 382 | ||||
| 376 | - | cb(fa) | 383 | + | cbFn(fa) |
| 377 | 384 | ||||
| 378 | } | 385 | } | ||
| 379 | - | return gobject.SignalConnect(x.GoPointer(), "activate-default", purego.NewCallback(fcb)) | 386 | + | cbRefPtr := purego.NewCallback(fcb) |
| 387 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 388 | + | return gobject.SignalConnect(x.GoPointer(), "activate-default", cbRefPtr) | |||
| 380 | } | 389 | } | ||
| 381 | 390 | ||||
| 382 | // Emitted when the popover is closed. | 391 | // Emitted when the popover is closed. | ||
| 383 | - | func (x *Popover) ConnectClosed(cb func(Popover)) uint32 { | 392 | + | func (x *Popover) ConnectClosed(cb *func(Popover)) uint32 { |
| 393 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 394 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 395 | + | return gobject.SignalConnect(x.GoPointer(), "closed", cbRefPtr) | |||
| 396 | + | } | |||
| 397 | + | ||||
| 384 | fcb := func(clsPtr uintptr) { | 398 | fcb := func(clsPtr uintptr) { | ||
| 385 | fa := Popover{} | 399 | fa := Popover{} | ||
| 386 | fa.Ptr = clsPtr | 400 | fa.Ptr = clsPtr | ||
| 401 | + | cbFn := *cb | |||
| 387 | 402 | ||||
| 388 | - | cb(fa) | 403 | + | cbFn(fa) |
| 389 | 404 | ||||
| 390 | } | 405 | } | ||
| 391 | - | return gobject.SignalConnect(x.GoPointer(), "closed", purego.NewCallback(fcb)) | 406 | + | cbRefPtr := purego.NewCallback(fcb) |
| 407 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 408 | + | return gobject.SignalConnect(x.GoPointer(), "closed", cbRefPtr) | |||
| 392 | } | 409 | } | ||
| 393 | 410 | ||||
| 394 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 411 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/gtk/gtkprinter.go +13 -5
| @@ -63,9 +63,9 @@ var xEnumeratePrinters func(uintptr, uintptr, uintptr, bool) | |||||
| 63 | // Calls a function for all `GtkPrinter`s. | 63 | // Calls a function for all `GtkPrinter`s. | ||
| 64 | // | 64 | // | ||
| 65 | // If @func returns %TRUE, the enumeration is stopped. | 65 | // If @func returns %TRUE, the enumeration is stopped. | ||
| 66 | - | func EnumeratePrinters(FuncVar PrinterFunc, DataVar uintptr, DestroyVar glib.DestroyNotify, WaitVar bool) { | 66 | + | func EnumeratePrinters(FuncVar *PrinterFunc, DataVar uintptr, DestroyVar *glib.DestroyNotify, WaitVar bool) { |
| 67 | 67 | ||||
| 68 | - | xEnumeratePrinters(purego.NewCallback(FuncVar), DataVar, purego.NewCallback(DestroyVar), WaitVar) | 68 | + | xEnumeratePrinters(glib.NewCallback(FuncVar), DataVar, glib.NewCallback(DestroyVar), WaitVar) |
| 69 | 69 | ||||
| 70 | } | 70 | } | ||
| 71 | 71 | ||||
| @@ -361,15 +361,23 @@ func (c *Printer) SetGoPointer(ptr uintptr) { | |||||
| 361 | // | 361 | // | ||
| 362 | // The @success parameter indicates if the information was | 362 | // The @success parameter indicates if the information was | ||
| 363 | // actually obtained. | 363 | // actually obtained. | ||
| 364 | - | func (x *Printer) ConnectDetailsAcquired(cb func(Printer, bool)) uint32 { | 364 | + | func (x *Printer) ConnectDetailsAcquired(cb *func(Printer, bool)) uint32 { |
| 365 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 366 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 367 | + | return gobject.SignalConnect(x.GoPointer(), "details-acquired", cbRefPtr) | |||
| 368 | + | } | |||
| 369 | + | ||||
| 365 | fcb := func(clsPtr uintptr, SuccessVarp bool) { | 370 | fcb := func(clsPtr uintptr, SuccessVarp bool) { | ||
| 366 | fa := Printer{} | 371 | fa := Printer{} | ||
| 367 | fa.Ptr = clsPtr | 372 | fa.Ptr = clsPtr | ||
| 373 | + | cbFn := *cb | |||
| 368 | 374 | ||||
| 369 | - | cb(fa, SuccessVarp) | 375 | + | cbFn(fa, SuccessVarp) |
| 370 | 376 | ||||
| 371 | } | 377 | } | ||
| 372 | - | return gobject.SignalConnect(x.GoPointer(), "details-acquired", purego.NewCallback(fcb)) | 378 | + | cbRefPtr := purego.NewCallback(fcb) |
| 379 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 380 | + | return gobject.SignalConnect(x.GoPointer(), "details-acquired", cbRefPtr) | |||
| 373 | } | 381 | } | ||
| 374 | 382 | ||||
| 375 | func init() { | 383 | func init() { | ||
M v4/gtk/gtkprintjob.go +15 -5
| @@ -2,6 +2,8 @@ | |||||
| 2 | package gtk | 2 | package gtk | ||
| 3 | 3 | ||||
| 4 | import ( | 4 | import ( | ||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 5 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 6 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 7 | "github.com/jwijenbergh/puregotk/v4/cairo" | 9 | "github.com/jwijenbergh/puregotk/v4/cairo" | ||
| @@ -221,9 +223,9 @@ func (x *PrintJob) GetTrackPrintStatus() bool { | |||||
| 221 | var xPrintJobSend func(uintptr, uintptr, uintptr, uintptr) | 223 | var xPrintJobSend func(uintptr, uintptr, uintptr, uintptr) | ||
| 222 | 224 | ||||
| 223 | // Sends the print job off to the printer. | 225 | // Sends the print job off to the printer. | ||
| 224 | - | func (x *PrintJob) Send(CallbackVar PrintJobCompleteFunc, UserDataVar uintptr, DnotifyVar glib.DestroyNotify) { | 226 | + | func (x *PrintJob) Send(CallbackVar *PrintJobCompleteFunc, UserDataVar uintptr, DnotifyVar *glib.DestroyNotify) { |
| 225 | 227 | ||||
| 226 | - | xPrintJobSend(x.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar, purego.NewCallback(DnotifyVar)) | 228 | + | xPrintJobSend(x.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar, glib.NewCallback(DnotifyVar)) |
| 227 | 229 | ||||
| 228 | } | 230 | } | ||
| 229 | 231 | ||||
| @@ -391,15 +393,23 @@ func (c *PrintJob) SetGoPointer(ptr uintptr) { | |||||
| 391 | // | 393 | // | ||
| 392 | // The signal handler can use [method@Gtk.PrintJob.get_status] | 394 | // The signal handler can use [method@Gtk.PrintJob.get_status] | ||
| 393 | // to obtain the new status. | 395 | // to obtain the new status. | ||
| 394 | - | func (x *PrintJob) ConnectStatusChanged(cb func(PrintJob)) uint32 { | 396 | + | func (x *PrintJob) ConnectStatusChanged(cb *func(PrintJob)) uint32 { |
| 397 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 398 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 399 | + | return gobject.SignalConnect(x.GoPointer(), "status-changed", cbRefPtr) | |||
| 400 | + | } | |||
| 401 | + | ||||
| 395 | fcb := func(clsPtr uintptr) { | 402 | fcb := func(clsPtr uintptr) { | ||
| 396 | fa := PrintJob{} | 403 | fa := PrintJob{} | ||
| 397 | fa.Ptr = clsPtr | 404 | fa.Ptr = clsPtr | ||
| 405 | + | cbFn := *cb | |||
| 398 | 406 | ||||
| 399 | - | cb(fa) | 407 | + | cbFn(fa) |
| 400 | 408 | ||||
| 401 | } | 409 | } | ||
| 402 | - | return gobject.SignalConnect(x.GoPointer(), "status-changed", purego.NewCallback(fcb)) | 410 | + | cbRefPtr := purego.NewCallback(fcb) |
| 411 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 412 | + | return gobject.SignalConnect(x.GoPointer(), "status-changed", cbRefPtr) | |||
| 403 | } | 413 | } | ||
| 404 | 414 | ||||
| 405 | func init() { | 415 | func init() { | ||
M v4/gtk/gtkprintoperation.go +123 -35
| @@ -160,9 +160,9 @@ var xPrintRunPageSetupDialogAsync func(uintptr, uintptr, uintptr, uintptr, uintp | |||||
| 160 | // In contrast to gtk_print_run_page_setup_dialog(), this function returns after | 160 | // In contrast to gtk_print_run_page_setup_dialog(), this function returns after | ||
| 161 | // showing the page setup dialog on platforms that support this, and calls @done_cb | 161 | // showing the page setup dialog on platforms that support this, and calls @done_cb | ||
| 162 | // from a signal handler for the ::response signal of the dialog. | 162 | // from a signal handler for the ::response signal of the dialog. | ||
| 163 | - | func PrintRunPageSetupDialogAsync(ParentVar *Window, PageSetupVar *PageSetup, SettingsVar *PrintSettings, DoneCbVar PageSetupDoneFunc, DataVar uintptr) { | 163 | + | func PrintRunPageSetupDialogAsync(ParentVar *Window, PageSetupVar *PageSetup, SettingsVar *PrintSettings, DoneCbVar *PageSetupDoneFunc, DataVar uintptr) { |
| 164 | 164 | ||||
| 165 | - | xPrintRunPageSetupDialogAsync(ParentVar.GoPointer(), PageSetupVar.GoPointer(), SettingsVar.GoPointer(), purego.NewCallback(DoneCbVar), DataVar) | 165 | + | xPrintRunPageSetupDialogAsync(ParentVar.GoPointer(), PageSetupVar.GoPointer(), SettingsVar.GoPointer(), glib.NewCallback(DoneCbVar), DataVar) |
| 166 | 166 | ||||
| 167 | } | 167 | } | ||
| 168 | 168 | ||||
| @@ -739,15 +739,23 @@ func (c *PrintOperation) SetGoPointer(ptr uintptr) { | |||||
| 739 | // [class@Gtk.PrintContext] and paginate the document accordingly, | 739 | // [class@Gtk.PrintContext] and paginate the document accordingly, | ||
| 740 | // and then set the number of pages with | 740 | // and then set the number of pages with | ||
| 741 | // [method@Gtk.PrintOperation.set_n_pages]. | 741 | // [method@Gtk.PrintOperation.set_n_pages]. | ||
| 742 | - | func (x *PrintOperation) ConnectBeginPrint(cb func(PrintOperation, uintptr)) uint32 { | 742 | + | func (x *PrintOperation) ConnectBeginPrint(cb *func(PrintOperation, uintptr)) uint32 { |
| 743 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 744 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 745 | + | return gobject.SignalConnect(x.GoPointer(), "begin-print", cbRefPtr) | |||
| 746 | + | } | |||
| 747 | + | ||||
| 743 | fcb := func(clsPtr uintptr, ContextVarp uintptr) { | 748 | fcb := func(clsPtr uintptr, ContextVarp uintptr) { | ||
| 744 | fa := PrintOperation{} | 749 | fa := PrintOperation{} | ||
| 745 | fa.Ptr = clsPtr | 750 | fa.Ptr = clsPtr | ||
| 751 | + | cbFn := *cb | |||
| 746 | 752 | ||||
| 747 | - | cb(fa, ContextVarp) | 753 | + | cbFn(fa, ContextVarp) |
| 748 | 754 | ||||
| 749 | } | 755 | } | ||
| 750 | - | return gobject.SignalConnect(x.GoPointer(), "begin-print", purego.NewCallback(fcb)) | 756 | + | cbRefPtr := purego.NewCallback(fcb) |
| 757 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 758 | + | return gobject.SignalConnect(x.GoPointer(), "begin-print", cbRefPtr) | |||
| 751 | } | 759 | } | ||
| 752 | 760 | ||||
| 753 | // Emitted when displaying the print dialog. | 761 | // Emitted when displaying the print dialog. | ||
| @@ -761,16 +769,24 @@ func (x *PrintOperation) ConnectBeginPrint(cb func(PrintOperation, uintptr)) uin | |||||
| 761 | // to stay around until the [signal@Gtk.PrintOperation::custom-widget-apply] | 769 | // to stay around until the [signal@Gtk.PrintOperation::custom-widget-apply] | ||
| 762 | // signal is emitted on the operation. Then you can read out any | 770 | // signal is emitted on the operation. Then you can read out any | ||
| 763 | // information you need from the widgets. | 771 | // information you need from the widgets. | ||
| 764 | - | func (x *PrintOperation) ConnectCreateCustomWidget(cb func(PrintOperation) gobject.Object) uint32 { | 772 | + | func (x *PrintOperation) ConnectCreateCustomWidget(cb *func(PrintOperation) gobject.Object) uint32 { |
| 773 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 774 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 775 | + | return gobject.SignalConnect(x.GoPointer(), "create-custom-widget", cbRefPtr) | |||
| 776 | + | } | |||
| 777 | + | ||||
| 765 | fcb := func(clsPtr uintptr) uintptr { | 778 | fcb := func(clsPtr uintptr) uintptr { | ||
| 766 | fa := PrintOperation{} | 779 | fa := PrintOperation{} | ||
| 767 | fa.Ptr = clsPtr | 780 | fa.Ptr = clsPtr | ||
| 781 | + | cbFn := *cb | |||
| 768 | 782 | ||||
| 769 | - | CreateCustomWidgetCls := cb(fa) | 783 | + | CreateCustomWidgetCls := cbFn(fa) |
| 770 | return CreateCustomWidgetCls.Ptr | 784 | return CreateCustomWidgetCls.Ptr | ||
| 771 | 785 | ||||
| 772 | } | 786 | } | ||
| 773 | - | return gobject.SignalConnect(x.GoPointer(), "create-custom-widget", purego.NewCallback(fcb)) | 787 | + | cbRefPtr := purego.NewCallback(fcb) |
| 788 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 789 | + | return gobject.SignalConnect(x.GoPointer(), "create-custom-widget", cbRefPtr) | |||
| 774 | } | 790 | } | ||
| 775 | 791 | ||||
| 776 | // Emitted right before ::begin-print if you added | 792 | // Emitted right before ::begin-print if you added | ||
| @@ -779,15 +795,23 @@ func (x *PrintOperation) ConnectCreateCustomWidget(cb func(PrintOperation) gobje | |||||
| 779 | // When you get this signal you should read the information from the | 795 | // When you get this signal you should read the information from the | ||
| 780 | // custom widgets, as the widgets are not guaranteed to be around at a | 796 | // custom widgets, as the widgets are not guaranteed to be around at a | ||
| 781 | // later time. | 797 | // later time. | ||
| 782 | - | func (x *PrintOperation) ConnectCustomWidgetApply(cb func(PrintOperation, uintptr)) uint32 { | 798 | + | func (x *PrintOperation) ConnectCustomWidgetApply(cb *func(PrintOperation, uintptr)) uint32 { |
| 799 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 800 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 801 | + | return gobject.SignalConnect(x.GoPointer(), "custom-widget-apply", cbRefPtr) | |||
| 802 | + | } | |||
| 803 | + | ||||
| 783 | fcb := func(clsPtr uintptr, WidgetVarp uintptr) { | 804 | fcb := func(clsPtr uintptr, WidgetVarp uintptr) { | ||
| 784 | fa := PrintOperation{} | 805 | fa := PrintOperation{} | ||
| 785 | fa.Ptr = clsPtr | 806 | fa.Ptr = clsPtr | ||
| 807 | + | cbFn := *cb | |||
| 786 | 808 | ||||
| 787 | - | cb(fa, WidgetVarp) | 809 | + | cbFn(fa, WidgetVarp) |
| 788 | 810 | ||||
| 789 | } | 811 | } | ||
| 790 | - | return gobject.SignalConnect(x.GoPointer(), "custom-widget-apply", purego.NewCallback(fcb)) | 812 | + | cbRefPtr := purego.NewCallback(fcb) |
| 813 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 814 | + | return gobject.SignalConnect(x.GoPointer(), "custom-widget-apply", cbRefPtr) | |||
| 791 | } | 815 | } | ||
| 792 | 816 | ||||
| 793 | // Emitted when the print operation run has finished doing | 817 | // Emitted when the print operation run has finished doing | ||
| @@ -800,15 +824,23 @@ func (x *PrintOperation) ConnectCustomWidgetApply(cb func(PrintOperation, uintpt | |||||
| 800 | // If you enabled print status tracking then | 824 | // If you enabled print status tracking then | ||
| 801 | // [method@Gtk.PrintOperation.is_finished] may still return %FALSE | 825 | // [method@Gtk.PrintOperation.is_finished] may still return %FALSE | ||
| 802 | // after the ::done signal was emitted. | 826 | // after the ::done signal was emitted. | ||
| 803 | - | func (x *PrintOperation) ConnectDone(cb func(PrintOperation, PrintOperationResult)) uint32 { | 827 | + | func (x *PrintOperation) ConnectDone(cb *func(PrintOperation, PrintOperationResult)) uint32 { |
| 828 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 829 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 830 | + | return gobject.SignalConnect(x.GoPointer(), "done", cbRefPtr) | |||
| 831 | + | } | |||
| 832 | + | ||||
| 804 | fcb := func(clsPtr uintptr, ResultVarp PrintOperationResult) { | 833 | fcb := func(clsPtr uintptr, ResultVarp PrintOperationResult) { | ||
| 805 | fa := PrintOperation{} | 834 | fa := PrintOperation{} | ||
| 806 | fa.Ptr = clsPtr | 835 | fa.Ptr = clsPtr | ||
| 836 | + | cbFn := *cb | |||
| 807 | 837 | ||||
| 808 | - | cb(fa, ResultVarp) | 838 | + | cbFn(fa, ResultVarp) |
| 809 | 839 | ||||
| 810 | } | 840 | } | ||
| 811 | - | return gobject.SignalConnect(x.GoPointer(), "done", purego.NewCallback(fcb)) | 841 | + | cbRefPtr := purego.NewCallback(fcb) |
| 842 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 843 | + | return gobject.SignalConnect(x.GoPointer(), "done", cbRefPtr) | |||
| 812 | } | 844 | } | ||
| 813 | 845 | ||||
| 814 | // Emitted for every page that is printed. | 846 | // Emitted for every page that is printed. | ||
| @@ -865,30 +897,46 @@ func (x *PrintOperation) ConnectDone(cb func(PrintOperation, PrintOperationResul | |||||
| 865 | // [method@Gtk.PrintOperation.set_unit] before starting the print | 897 | // [method@Gtk.PrintOperation.set_unit] before starting the print | ||
| 866 | // operation to set up the transformation of the cairo context | 898 | // operation to set up the transformation of the cairo context | ||
| 867 | // according to your needs. | 899 | // according to your needs. | ||
| 868 | - | func (x *PrintOperation) ConnectDrawPage(cb func(PrintOperation, uintptr, int)) uint32 { | 900 | + | func (x *PrintOperation) ConnectDrawPage(cb *func(PrintOperation, uintptr, int)) uint32 { |
| 901 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 902 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 903 | + | return gobject.SignalConnect(x.GoPointer(), "draw-page", cbRefPtr) | |||
| 904 | + | } | |||
| 905 | + | ||||
| 869 | fcb := func(clsPtr uintptr, ContextVarp uintptr, PageNrVarp int) { | 906 | fcb := func(clsPtr uintptr, ContextVarp uintptr, PageNrVarp int) { | ||
| 870 | fa := PrintOperation{} | 907 | fa := PrintOperation{} | ||
| 871 | fa.Ptr = clsPtr | 908 | fa.Ptr = clsPtr | ||
| 909 | + | cbFn := *cb | |||
| 872 | 910 | ||||
| 873 | - | cb(fa, ContextVarp, PageNrVarp) | 911 | + | cbFn(fa, ContextVarp, PageNrVarp) |
| 874 | 912 | ||||
| 875 | } | 913 | } | ||
| 876 | - | return gobject.SignalConnect(x.GoPointer(), "draw-page", purego.NewCallback(fcb)) | 914 | + | cbRefPtr := purego.NewCallback(fcb) |
| 915 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 916 | + | return gobject.SignalConnect(x.GoPointer(), "draw-page", cbRefPtr) | |||
| 877 | } | 917 | } | ||
| 878 | 918 | ||||
| 879 | // Emitted after all pages have been rendered. | 919 | // Emitted after all pages have been rendered. | ||
| 880 | // | 920 | // | ||
| 881 | // A handler for this signal can clean up any resources that have | 921 | // A handler for this signal can clean up any resources that have | ||
| 882 | // been allocated in the [signal@Gtk.PrintOperation::begin-print] handler. | 922 | // been allocated in the [signal@Gtk.PrintOperation::begin-print] handler. | ||
| 883 | - | func (x *PrintOperation) ConnectEndPrint(cb func(PrintOperation, uintptr)) uint32 { | 923 | + | func (x *PrintOperation) ConnectEndPrint(cb *func(PrintOperation, uintptr)) uint32 { |
| 924 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 925 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 926 | + | return gobject.SignalConnect(x.GoPointer(), "end-print", cbRefPtr) | |||
| 927 | + | } | |||
| 928 | + | ||||
| 884 | fcb := func(clsPtr uintptr, ContextVarp uintptr) { | 929 | fcb := func(clsPtr uintptr, ContextVarp uintptr) { | ||
| 885 | fa := PrintOperation{} | 930 | fa := PrintOperation{} | ||
| 886 | fa.Ptr = clsPtr | 931 | fa.Ptr = clsPtr | ||
| 932 | + | cbFn := *cb | |||
| 887 | 933 | ||||
| 888 | - | cb(fa, ContextVarp) | 934 | + | cbFn(fa, ContextVarp) |
| 889 | 935 | ||||
| 890 | } | 936 | } | ||
| 891 | - | return gobject.SignalConnect(x.GoPointer(), "end-print", purego.NewCallback(fcb)) | 937 | + | cbRefPtr := purego.NewCallback(fcb) |
| 938 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 939 | + | return gobject.SignalConnect(x.GoPointer(), "end-print", cbRefPtr) | |||
| 892 | } | 940 | } | ||
| 893 | 941 | ||||
| 894 | // Emitted after the ::begin-print signal, but before the actual rendering | 942 | // Emitted after the ::begin-print signal, but before the actual rendering | ||
| @@ -905,15 +953,23 @@ func (x *PrintOperation) ConnectEndPrint(cb func(PrintOperation, uintptr)) uint3 | |||||
| 905 | // If you don't need to do pagination in chunks, you can simply do | 953 | // If you don't need to do pagination in chunks, you can simply do | ||
| 906 | // it all in the ::begin-print handler, and set the number of pages | 954 | // it all in the ::begin-print handler, and set the number of pages | ||
| 907 | // from there. | 955 | // from there. | ||
| 908 | - | func (x *PrintOperation) ConnectPaginate(cb func(PrintOperation, uintptr) bool) uint32 { | 956 | + | func (x *PrintOperation) ConnectPaginate(cb *func(PrintOperation, uintptr) bool) uint32 { |
| 957 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 958 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 959 | + | return gobject.SignalConnect(x.GoPointer(), "paginate", cbRefPtr) | |||
| 960 | + | } | |||
| 961 | + | ||||
| 909 | fcb := func(clsPtr uintptr, ContextVarp uintptr) bool { | 962 | fcb := func(clsPtr uintptr, ContextVarp uintptr) bool { | ||
| 910 | fa := PrintOperation{} | 963 | fa := PrintOperation{} | ||
| 911 | fa.Ptr = clsPtr | 964 | fa.Ptr = clsPtr | ||
| 965 | + | cbFn := *cb | |||
| 912 | 966 | ||||
| 913 | - | return cb(fa, ContextVarp) | 967 | + | return cbFn(fa, ContextVarp) |
| 914 | 968 | ||||
| 915 | } | 969 | } | ||
| 916 | - | return gobject.SignalConnect(x.GoPointer(), "paginate", purego.NewCallback(fcb)) | 970 | + | cbRefPtr := purego.NewCallback(fcb) |
| 971 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 972 | + | return gobject.SignalConnect(x.GoPointer(), "paginate", cbRefPtr) | |||
| 917 | } | 973 | } | ||
| 918 | 974 | ||||
| 919 | // Gets emitted when a preview is requested from the native dialog. | 975 | // Gets emitted when a preview is requested from the native dialog. | ||
| @@ -933,15 +989,23 @@ func (x *PrintOperation) ConnectPaginate(cb func(PrintOperation, uintptr) bool) | |||||
| 933 | // are selected for print and render them. The preview must be | 989 | // are selected for print and render them. The preview must be | ||
| 934 | // finished by calling [method@Gtk.PrintOperationPreview.end_preview] | 990 | // finished by calling [method@Gtk.PrintOperationPreview.end_preview] | ||
| 935 | // (typically in response to the user clicking a close button). | 991 | // (typically in response to the user clicking a close button). | ||
| 936 | - | func (x *PrintOperation) ConnectPreview(cb func(PrintOperation, uintptr, uintptr, uintptr) bool) uint32 { | 992 | + | func (x *PrintOperation) ConnectPreview(cb *func(PrintOperation, uintptr, uintptr, uintptr) bool) uint32 { |
| 993 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 994 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 995 | + | return gobject.SignalConnect(x.GoPointer(), "preview", cbRefPtr) | |||
| 996 | + | } | |||
| 997 | + | ||||
| 937 | fcb := func(clsPtr uintptr, PreviewVarp uintptr, ContextVarp uintptr, ParentVarp uintptr) bool { | 998 | fcb := func(clsPtr uintptr, PreviewVarp uintptr, ContextVarp uintptr, ParentVarp uintptr) bool { | ||
| 938 | fa := PrintOperation{} | 999 | fa := PrintOperation{} | ||
| 939 | fa.Ptr = clsPtr | 1000 | fa.Ptr = clsPtr | ||
| 1001 | + | cbFn := *cb | |||
| 940 | 1002 | ||||
| 941 | - | return cb(fa, PreviewVarp, ContextVarp, ParentVarp) | 1003 | + | return cbFn(fa, PreviewVarp, ContextVarp, ParentVarp) |
| 942 | 1004 | ||||
| 943 | } | 1005 | } | ||
| 944 | - | return gobject.SignalConnect(x.GoPointer(), "preview", purego.NewCallback(fcb)) | 1006 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1007 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1008 | + | return gobject.SignalConnect(x.GoPointer(), "preview", cbRefPtr) | |||
| 945 | } | 1009 | } | ||
| 946 | 1010 | ||||
| 947 | // Emitted once for every page that is printed. | 1011 | // Emitted once for every page that is printed. | ||
| @@ -949,15 +1013,23 @@ func (x *PrintOperation) ConnectPreview(cb func(PrintOperation, uintptr, uintptr | |||||
| 949 | // This gives the application a chance to modify the page setup. | 1013 | // This gives the application a chance to modify the page setup. | ||
| 950 | // Any changes done to @setup will be in force only for printing | 1014 | // Any changes done to @setup will be in force only for printing | ||
| 951 | // this page. | 1015 | // this page. | ||
| 952 | - | func (x *PrintOperation) ConnectRequestPageSetup(cb func(PrintOperation, uintptr, int, uintptr)) uint32 { | 1016 | + | func (x *PrintOperation) ConnectRequestPageSetup(cb *func(PrintOperation, uintptr, int, uintptr)) uint32 { |
| 1017 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1018 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1019 | + | return gobject.SignalConnect(x.GoPointer(), "request-page-setup", cbRefPtr) | |||
| 1020 | + | } | |||
| 1021 | + | ||||
| 953 | fcb := func(clsPtr uintptr, ContextVarp uintptr, PageNrVarp int, SetupVarp uintptr) { | 1022 | fcb := func(clsPtr uintptr, ContextVarp uintptr, PageNrVarp int, SetupVarp uintptr) { | ||
| 954 | fa := PrintOperation{} | 1023 | fa := PrintOperation{} | ||
| 955 | fa.Ptr = clsPtr | 1024 | fa.Ptr = clsPtr | ||
| 1025 | + | cbFn := *cb | |||
| 956 | 1026 | ||||
| 957 | - | cb(fa, ContextVarp, PageNrVarp, SetupVarp) | 1027 | + | cbFn(fa, ContextVarp, PageNrVarp, SetupVarp) |
| 958 | 1028 | ||||
| 959 | } | 1029 | } | ||
| 960 | - | return gobject.SignalConnect(x.GoPointer(), "request-page-setup", purego.NewCallback(fcb)) | 1030 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1031 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1032 | + | return gobject.SignalConnect(x.GoPointer(), "request-page-setup", cbRefPtr) | |||
| 961 | } | 1033 | } | ||
| 962 | 1034 | ||||
| 963 | // Emitted at between the various phases of the print operation. | 1035 | // Emitted at between the various phases of the print operation. | ||
| @@ -965,30 +1037,46 @@ func (x *PrintOperation) ConnectRequestPageSetup(cb func(PrintOperation, uintptr | |||||
| 965 | // See [enum@Gtk.PrintStatus] for the phases that are being discriminated. | 1037 | // See [enum@Gtk.PrintStatus] for the phases that are being discriminated. | ||
| 966 | // Use [method@Gtk.PrintOperation.get_status] to find out the current | 1038 | // Use [method@Gtk.PrintOperation.get_status] to find out the current | ||
| 967 | // status. | 1039 | // status. | ||
| 968 | - | func (x *PrintOperation) ConnectStatusChanged(cb func(PrintOperation)) uint32 { | 1040 | + | func (x *PrintOperation) ConnectStatusChanged(cb *func(PrintOperation)) uint32 { |
| 1041 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1042 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1043 | + | return gobject.SignalConnect(x.GoPointer(), "status-changed", cbRefPtr) | |||
| 1044 | + | } | |||
| 1045 | + | ||||
| 969 | fcb := func(clsPtr uintptr) { | 1046 | fcb := func(clsPtr uintptr) { | ||
| 970 | fa := PrintOperation{} | 1047 | fa := PrintOperation{} | ||
| 971 | fa.Ptr = clsPtr | 1048 | fa.Ptr = clsPtr | ||
| 1049 | + | cbFn := *cb | |||
| 972 | 1050 | ||||
| 973 | - | cb(fa) | 1051 | + | cbFn(fa) |
| 974 | 1052 | ||||
| 975 | } | 1053 | } | ||
| 976 | - | return gobject.SignalConnect(x.GoPointer(), "status-changed", purego.NewCallback(fcb)) | 1054 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1055 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1056 | + | return gobject.SignalConnect(x.GoPointer(), "status-changed", cbRefPtr) | |||
| 977 | } | 1057 | } | ||
| 978 | 1058 | ||||
| 979 | // Emitted after change of selected printer. | 1059 | // Emitted after change of selected printer. | ||
| 980 | // | 1060 | // | ||
| 981 | // The actual page setup and print settings are passed to the custom | 1061 | // The actual page setup and print settings are passed to the custom | ||
| 982 | // widget, which can actualize itself according to this change. | 1062 | // widget, which can actualize itself according to this change. | ||
| 983 | - | func (x *PrintOperation) ConnectUpdateCustomWidget(cb func(PrintOperation, uintptr, uintptr, uintptr)) uint32 { | 1063 | + | func (x *PrintOperation) ConnectUpdateCustomWidget(cb *func(PrintOperation, uintptr, uintptr, uintptr)) uint32 { |
| 1064 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1065 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1066 | + | return gobject.SignalConnect(x.GoPointer(), "update-custom-widget", cbRefPtr) | |||
| 1067 | + | } | |||
| 1068 | + | ||||
| 984 | fcb := func(clsPtr uintptr, WidgetVarp uintptr, SetupVarp uintptr, SettingsVarp uintptr) { | 1069 | fcb := func(clsPtr uintptr, WidgetVarp uintptr, SetupVarp uintptr, SettingsVarp uintptr) { | ||
| 985 | fa := PrintOperation{} | 1070 | fa := PrintOperation{} | ||
| 986 | fa.Ptr = clsPtr | 1071 | fa.Ptr = clsPtr | ||
| 1072 | + | cbFn := *cb | |||
| 987 | 1073 | ||||
| 988 | - | cb(fa, WidgetVarp, SetupVarp, SettingsVarp) | 1074 | + | cbFn(fa, WidgetVarp, SetupVarp, SettingsVarp) |
| 989 | 1075 | ||||
| 990 | } | 1076 | } | ||
| 991 | - | return gobject.SignalConnect(x.GoPointer(), "update-custom-widget", purego.NewCallback(fcb)) | 1077 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1078 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1079 | + | return gobject.SignalConnect(x.GoPointer(), "update-custom-widget", cbRefPtr) | |||
| 992 | } | 1080 | } | ||
| 993 | 1081 | ||||
| 994 | // Ends a preview. | 1082 | // Ends a preview. | ||
M v4/gtk/gtkprintsettings.go +2 -2
| @@ -225,9 +225,9 @@ func (x *PrintSettings) Copy() *PrintSettings { | |||||
| 225 | var xPrintSettingsForeach func(uintptr, uintptr, uintptr) | 225 | var xPrintSettingsForeach func(uintptr, uintptr, uintptr) | ||
| 226 | 226 | ||||
| 227 | // Calls @func for each key-value pair of @settings. | 227 | // Calls @func for each key-value pair of @settings. | ||
| 228 | - | func (x *PrintSettings) Foreach(FuncVar PrintSettingsFunc, UserDataVar uintptr) { | 228 | + | func (x *PrintSettings) Foreach(FuncVar *PrintSettingsFunc, UserDataVar uintptr) { |
| 229 | 229 | ||||
| 230 | - | xPrintSettingsForeach(x.GoPointer(), purego.NewCallback(FuncVar), UserDataVar) | 230 | + | xPrintSettingsForeach(x.GoPointer(), glib.NewCallback(FuncVar), UserDataVar) |
| 231 | 231 | ||||
| 232 | } | 232 | } | ||
| 233 | 233 | ||||
M v4/gtk/gtkrange.go +45 -12
| @@ -7,6 +7,7 @@ import ( | |||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | ||
| 10 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | 11 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 11 | ) | 12 | ) | ||
| 12 | 13 | ||||
| @@ -328,15 +329,23 @@ func (c *Range) SetGoPointer(ptr uintptr) { | |||||
| 328 | 329 | ||||
| 329 | // Emitted before clamping a value, to give the application a | 330 | // Emitted before clamping a value, to give the application a | ||
| 330 | // chance to adjust the bounds. | 331 | // chance to adjust the bounds. | ||
| 331 | - | func (x *Range) ConnectAdjustBounds(cb func(Range, float64)) uint32 { | 332 | + | func (x *Range) ConnectAdjustBounds(cb *func(Range, float64)) uint32 { |
| 333 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 334 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 335 | + | return gobject.SignalConnect(x.GoPointer(), "adjust-bounds", cbRefPtr) | |||
| 336 | + | } | |||
| 337 | + | ||||
| 332 | fcb := func(clsPtr uintptr, ValueVarp float64) { | 338 | fcb := func(clsPtr uintptr, ValueVarp float64) { | ||
| 333 | fa := Range{} | 339 | fa := Range{} | ||
| 334 | fa.Ptr = clsPtr | 340 | fa.Ptr = clsPtr | ||
| 341 | + | cbFn := *cb | |||
| 335 | 342 | ||||
| 336 | - | cb(fa, ValueVarp) | 343 | + | cbFn(fa, ValueVarp) |
| 337 | 344 | ||||
| 338 | } | 345 | } | ||
| 339 | - | return gobject.SignalConnect(x.GoPointer(), "adjust-bounds", purego.NewCallback(fcb)) | 346 | + | cbRefPtr := purego.NewCallback(fcb) |
| 347 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 348 | + | return gobject.SignalConnect(x.GoPointer(), "adjust-bounds", cbRefPtr) | |||
| 340 | } | 349 | } | ||
| 341 | 350 | ||||
| 342 | // Emitted when a scroll action is performed on a range. | 351 | // Emitted when a scroll action is performed on a range. | ||
| @@ -351,41 +360,65 @@ func (x *Range) ConnectAdjustBounds(cb func(Range, float64)) uint32 { | |||||
| 351 | // the ::change-value signal is responsible for clamping the value | 360 | // the ::change-value signal is responsible for clamping the value | ||
| 352 | // to the desired number of decimal digits; the default GTK | 361 | // to the desired number of decimal digits; the default GTK | ||
| 353 | // handler clamps the value based on [property@Gtk.Range:round-digits]. | 362 | // handler clamps the value based on [property@Gtk.Range:round-digits]. | ||
| 354 | - | func (x *Range) ConnectChangeValue(cb func(Range, ScrollType, float64) bool) uint32 { | 363 | + | func (x *Range) ConnectChangeValue(cb *func(Range, ScrollType, float64) bool) uint32 { |
| 364 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 365 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 366 | + | return gobject.SignalConnect(x.GoPointer(), "change-value", cbRefPtr) | |||
| 367 | + | } | |||
| 368 | + | ||||
| 355 | fcb := func(clsPtr uintptr, ScrollVarp ScrollType, ValueVarp float64) bool { | 369 | fcb := func(clsPtr uintptr, ScrollVarp ScrollType, ValueVarp float64) bool { | ||
| 356 | fa := Range{} | 370 | fa := Range{} | ||
| 357 | fa.Ptr = clsPtr | 371 | fa.Ptr = clsPtr | ||
| 372 | + | cbFn := *cb | |||
| 358 | 373 | ||||
| 359 | - | return cb(fa, ScrollVarp, ValueVarp) | 374 | + | return cbFn(fa, ScrollVarp, ValueVarp) |
| 360 | 375 | ||||
| 361 | } | 376 | } | ||
| 362 | - | return gobject.SignalConnect(x.GoPointer(), "change-value", purego.NewCallback(fcb)) | 377 | + | cbRefPtr := purego.NewCallback(fcb) |
| 378 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 379 | + | return gobject.SignalConnect(x.GoPointer(), "change-value", cbRefPtr) | |||
| 363 | } | 380 | } | ||
| 364 | 381 | ||||
| 365 | // Virtual function that moves the slider. | 382 | // Virtual function that moves the slider. | ||
| 366 | // | 383 | // | ||
| 367 | // Used for keybindings. | 384 | // Used for keybindings. | ||
| 368 | - | func (x *Range) ConnectMoveSlider(cb func(Range, ScrollType)) uint32 { | 385 | + | func (x *Range) ConnectMoveSlider(cb *func(Range, ScrollType)) uint32 { |
| 386 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 387 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 388 | + | return gobject.SignalConnect(x.GoPointer(), "move-slider", cbRefPtr) | |||
| 389 | + | } | |||
| 390 | + | ||||
| 369 | fcb := func(clsPtr uintptr, StepVarp ScrollType) { | 391 | fcb := func(clsPtr uintptr, StepVarp ScrollType) { | ||
| 370 | fa := Range{} | 392 | fa := Range{} | ||
| 371 | fa.Ptr = clsPtr | 393 | fa.Ptr = clsPtr | ||
| 394 | + | cbFn := *cb | |||
| 372 | 395 | ||||
| 373 | - | cb(fa, StepVarp) | 396 | + | cbFn(fa, StepVarp) |
| 374 | 397 | ||||
| 375 | } | 398 | } | ||
| 376 | - | return gobject.SignalConnect(x.GoPointer(), "move-slider", purego.NewCallback(fcb)) | 399 | + | cbRefPtr := purego.NewCallback(fcb) |
| 400 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 401 | + | return gobject.SignalConnect(x.GoPointer(), "move-slider", cbRefPtr) | |||
| 377 | } | 402 | } | ||
| 378 | 403 | ||||
| 379 | // Emitted when the range value changes. | 404 | // Emitted when the range value changes. | ||
| 380 | - | func (x *Range) ConnectValueChanged(cb func(Range)) uint32 { | 405 | + | func (x *Range) ConnectValueChanged(cb *func(Range)) uint32 { |
| 406 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 407 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 408 | + | return gobject.SignalConnect(x.GoPointer(), "value-changed", cbRefPtr) | |||
| 409 | + | } | |||
| 410 | + | ||||
| 381 | fcb := func(clsPtr uintptr) { | 411 | fcb := func(clsPtr uintptr) { | ||
| 382 | fa := Range{} | 412 | fa := Range{} | ||
| 383 | fa.Ptr = clsPtr | 413 | fa.Ptr = clsPtr | ||
| 414 | + | cbFn := *cb | |||
| 384 | 415 | ||||
| 385 | - | cb(fa) | 416 | + | cbFn(fa) |
| 386 | 417 | ||||
| 387 | } | 418 | } | ||
| 388 | - | return gobject.SignalConnect(x.GoPointer(), "value-changed", purego.NewCallback(fcb)) | 419 | + | cbRefPtr := purego.NewCallback(fcb) |
| 420 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 421 | + | return gobject.SignalConnect(x.GoPointer(), "value-changed", cbRefPtr) | |||
| 389 | } | 422 | } | ||
| 390 | 423 | ||||
| 391 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 424 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/gtk/gtkrecentmanager.go +11 -3
| @@ -589,15 +589,23 @@ func (c *RecentManager) SetGoPointer(ptr uintptr) { | |||||
| 589 | // | 589 | // | ||
| 590 | // This can happen either by calling [method@Gtk.RecentManager.add_item] | 590 | // This can happen either by calling [method@Gtk.RecentManager.add_item] | ||
| 591 | // or by another application. | 591 | // or by another application. | ||
| 592 | - | func (x *RecentManager) ConnectChanged(cb func(RecentManager)) uint32 { | 592 | + | func (x *RecentManager) ConnectChanged(cb *func(RecentManager)) uint32 { |
| 593 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 594 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 595 | + | return gobject.SignalConnect(x.GoPointer(), "changed", cbRefPtr) | |||
| 596 | + | } | |||
| 597 | + | ||||
| 593 | fcb := func(clsPtr uintptr) { | 598 | fcb := func(clsPtr uintptr) { | ||
| 594 | fa := RecentManager{} | 599 | fa := RecentManager{} | ||
| 595 | fa.Ptr = clsPtr | 600 | fa.Ptr = clsPtr | ||
| 601 | + | cbFn := *cb | |||
| 596 | 602 | ||||
| 597 | - | cb(fa) | 603 | + | cbFn(fa) |
| 598 | 604 | ||||
| 599 | } | 605 | } | ||
| 600 | - | return gobject.SignalConnect(x.GoPointer(), "changed", purego.NewCallback(fcb)) | 606 | + | cbRefPtr := purego.NewCallback(fcb) |
| 607 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 608 | + | return gobject.SignalConnect(x.GoPointer(), "changed", cbRefPtr) | |||
| 601 | } | 609 | } | ||
| 602 | 610 | ||||
| 603 | var xRecentManagerGetDefault func() uintptr | 611 | var xRecentManagerGetDefault func() uintptr | ||
M v4/gtk/gtkscale.go +2 -2
| @@ -298,9 +298,9 @@ var xScaleSetFormatValueFunc func(uintptr, uintptr, uintptr, uintptr) | |||||
| 298 | // If #NULL is passed as @func, the value will be displayed on | 298 | // If #NULL is passed as @func, the value will be displayed on | ||
| 299 | // its own, rounded according to the value of the | 299 | // its own, rounded according to the value of the | ||
| 300 | // [property@GtkScale:digits] property. | 300 | // [property@GtkScale:digits] property. | ||
| 301 | - | func (x *Scale) SetFormatValueFunc(FuncVar ScaleFormatValueFunc, UserDataVar uintptr, DestroyNotifyVar glib.DestroyNotify) { | 301 | + | func (x *Scale) SetFormatValueFunc(FuncVar *ScaleFormatValueFunc, UserDataVar uintptr, DestroyNotifyVar *glib.DestroyNotify) { |
| 302 | 302 | ||||
| 303 | - | xScaleSetFormatValueFunc(x.GoPointer(), purego.NewCallback(FuncVar), UserDataVar, purego.NewCallback(DestroyNotifyVar)) | 303 | + | xScaleSetFormatValueFunc(x.GoPointer(), glib.NewCallback(FuncVar), UserDataVar, glib.NewCallback(DestroyNotifyVar)) |
| 304 | 304 | ||||
| 305 | } | 305 | } | ||
| 306 | 306 | ||||
M v4/gtk/gtkscalebutton.go +34 -9
| @@ -6,6 +6,7 @@ import ( | |||||
| 6 | 6 | ||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 9 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 10 | ) | 11 | ) | ||
| 11 | 12 | ||||
| @@ -187,15 +188,23 @@ func (c *ScaleButton) SetGoPointer(ptr uintptr) { | |||||
| 187 | // This is a [keybinding signal](class.SignalAction.html). | 188 | // This is a [keybinding signal](class.SignalAction.html). | ||
| 188 | // | 189 | // | ||
| 189 | // The default binding for this signal is <kbd>Escape</kbd>. | 190 | // The default binding for this signal is <kbd>Escape</kbd>. | ||
| 190 | - | func (x *ScaleButton) ConnectPopdown(cb func(ScaleButton)) uint32 { | 191 | + | func (x *ScaleButton) ConnectPopdown(cb *func(ScaleButton)) uint32 { |
| 192 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 193 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 194 | + | return gobject.SignalConnect(x.GoPointer(), "popdown", cbRefPtr) | |||
| 195 | + | } | |||
| 196 | + | ||||
| 191 | fcb := func(clsPtr uintptr) { | 197 | fcb := func(clsPtr uintptr) { | ||
| 192 | fa := ScaleButton{} | 198 | fa := ScaleButton{} | ||
| 193 | fa.Ptr = clsPtr | 199 | fa.Ptr = clsPtr | ||
| 200 | + | cbFn := *cb | |||
| 194 | 201 | ||||
| 195 | - | cb(fa) | 202 | + | cbFn(fa) |
| 196 | 203 | ||||
| 197 | } | 204 | } | ||
| 198 | - | return gobject.SignalConnect(x.GoPointer(), "popdown", purego.NewCallback(fcb)) | 205 | + | cbRefPtr := purego.NewCallback(fcb) |
| 206 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 207 | + | return gobject.SignalConnect(x.GoPointer(), "popdown", cbRefPtr) | |||
| 199 | } | 208 | } | ||
| 200 | 209 | ||||
| 201 | // Emitted to popup the scale widget. | 210 | // Emitted to popup the scale widget. | ||
| @@ -204,27 +213,43 @@ func (x *ScaleButton) ConnectPopdown(cb func(ScaleButton)) uint32 { | |||||
| 204 | // | 213 | // | ||
| 205 | // The default bindings for this signal are <kbd>Space</kbd>, | 214 | // The default bindings for this signal are <kbd>Space</kbd>, | ||
| 206 | // <kbd>Enter</kbd> and <kbd>Return</kbd>. | 215 | // <kbd>Enter</kbd> and <kbd>Return</kbd>. | ||
| 207 | - | func (x *ScaleButton) ConnectPopup(cb func(ScaleButton)) uint32 { | 216 | + | func (x *ScaleButton) ConnectPopup(cb *func(ScaleButton)) uint32 { |
| 217 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 218 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 219 | + | return gobject.SignalConnect(x.GoPointer(), "popup", cbRefPtr) | |||
| 220 | + | } | |||
| 221 | + | ||||
| 208 | fcb := func(clsPtr uintptr) { | 222 | fcb := func(clsPtr uintptr) { | ||
| 209 | fa := ScaleButton{} | 223 | fa := ScaleButton{} | ||
| 210 | fa.Ptr = clsPtr | 224 | fa.Ptr = clsPtr | ||
| 225 | + | cbFn := *cb | |||
| 211 | 226 | ||||
| 212 | - | cb(fa) | 227 | + | cbFn(fa) |
| 213 | 228 | ||||
| 214 | } | 229 | } | ||
| 215 | - | return gobject.SignalConnect(x.GoPointer(), "popup", purego.NewCallback(fcb)) | 230 | + | cbRefPtr := purego.NewCallback(fcb) |
| 231 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 232 | + | return gobject.SignalConnect(x.GoPointer(), "popup", cbRefPtr) | |||
| 216 | } | 233 | } | ||
| 217 | 234 | ||||
| 218 | // Emitted when the value field has changed. | 235 | // Emitted when the value field has changed. | ||
| 219 | - | func (x *ScaleButton) ConnectValueChanged(cb func(ScaleButton, float64)) uint32 { | 236 | + | func (x *ScaleButton) ConnectValueChanged(cb *func(ScaleButton, float64)) uint32 { |
| 237 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 238 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 239 | + | return gobject.SignalConnect(x.GoPointer(), "value-changed", cbRefPtr) | |||
| 240 | + | } | |||
| 241 | + | ||||
| 220 | fcb := func(clsPtr uintptr, ValueVarp float64) { | 242 | fcb := func(clsPtr uintptr, ValueVarp float64) { | ||
| 221 | fa := ScaleButton{} | 243 | fa := ScaleButton{} | ||
| 222 | fa.Ptr = clsPtr | 244 | fa.Ptr = clsPtr | ||
| 245 | + | cbFn := *cb | |||
| 223 | 246 | ||||
| 224 | - | cb(fa, ValueVarp) | 247 | + | cbFn(fa, ValueVarp) |
| 225 | 248 | ||||
| 226 | } | 249 | } | ||
| 227 | - | return gobject.SignalConnect(x.GoPointer(), "value-changed", purego.NewCallback(fcb)) | 250 | + | cbRefPtr := purego.NewCallback(fcb) |
| 251 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 252 | + | return gobject.SignalConnect(x.GoPointer(), "value-changed", cbRefPtr) | |||
| 228 | } | 253 | } | ||
| 229 | 254 | ||||
| 230 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 255 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/gtk/gtkscrolledwindow.go +47 -12
| @@ -2,8 +2,11 @@ | |||||
| 2 | package gtk | 2 | package gtk | ||
| 3 | 3 | ||||
| 4 | import ( | 4 | import ( | ||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 5 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 6 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 7 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 8 | ) | 11 | ) | ||
| 9 | 12 | ||||
| @@ -557,15 +560,23 @@ func (c *ScrolledWindow) SetGoPointer(ptr uintptr) { | |||||
| 557 | // | 560 | // | ||
| 558 | // Note: The @pos argument is LTR/RTL aware, so callers should be | 561 | // Note: The @pos argument is LTR/RTL aware, so callers should be | ||
| 559 | // aware too if intending to provide behavior on horizontal edges. | 562 | // aware too if intending to provide behavior on horizontal edges. | ||
| 560 | - | func (x *ScrolledWindow) ConnectEdgeOvershot(cb func(ScrolledWindow, PositionType)) uint32 { | 563 | + | func (x *ScrolledWindow) ConnectEdgeOvershot(cb *func(ScrolledWindow, PositionType)) uint32 { |
| 564 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 565 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 566 | + | return gobject.SignalConnect(x.GoPointer(), "edge-overshot", cbRefPtr) | |||
| 567 | + | } | |||
| 568 | + | ||||
| 561 | fcb := func(clsPtr uintptr, PosVarp PositionType) { | 569 | fcb := func(clsPtr uintptr, PosVarp PositionType) { | ||
| 562 | fa := ScrolledWindow{} | 570 | fa := ScrolledWindow{} | ||
| 563 | fa.Ptr = clsPtr | 571 | fa.Ptr = clsPtr | ||
| 572 | + | cbFn := *cb | |||
| 564 | 573 | ||||
| 565 | - | cb(fa, PosVarp) | 574 | + | cbFn(fa, PosVarp) |
| 566 | 575 | ||||
| 567 | } | 576 | } | ||
| 568 | - | return gobject.SignalConnect(x.GoPointer(), "edge-overshot", purego.NewCallback(fcb)) | 577 | + | cbRefPtr := purego.NewCallback(fcb) |
| 578 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 579 | + | return gobject.SignalConnect(x.GoPointer(), "edge-overshot", cbRefPtr) | |||
| 569 | } | 580 | } | ||
| 570 | 581 | ||||
| 571 | // Emitted whenever user-initiated scrolling makes the scrolled | 582 | // Emitted whenever user-initiated scrolling makes the scrolled | ||
| @@ -577,15 +588,23 @@ func (x *ScrolledWindow) ConnectEdgeOvershot(cb func(ScrolledWindow, PositionTyp | |||||
| 577 | // | 588 | // | ||
| 578 | // Note: The @pos argument is LTR/RTL aware, so callers should be | 589 | // Note: The @pos argument is LTR/RTL aware, so callers should be | ||
| 579 | // aware too if intending to provide behavior on horizontal edges. | 590 | // aware too if intending to provide behavior on horizontal edges. | ||
| 580 | - | func (x *ScrolledWindow) ConnectEdgeReached(cb func(ScrolledWindow, PositionType)) uint32 { | 591 | + | func (x *ScrolledWindow) ConnectEdgeReached(cb *func(ScrolledWindow, PositionType)) uint32 { |
| 592 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 593 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 594 | + | return gobject.SignalConnect(x.GoPointer(), "edge-reached", cbRefPtr) | |||
| 595 | + | } | |||
| 596 | + | ||||
| 581 | fcb := func(clsPtr uintptr, PosVarp PositionType) { | 597 | fcb := func(clsPtr uintptr, PosVarp PositionType) { | ||
| 582 | fa := ScrolledWindow{} | 598 | fa := ScrolledWindow{} | ||
| 583 | fa.Ptr = clsPtr | 599 | fa.Ptr = clsPtr | ||
| 600 | + | cbFn := *cb | |||
| 584 | 601 | ||||
| 585 | - | cb(fa, PosVarp) | 602 | + | cbFn(fa, PosVarp) |
| 586 | 603 | ||||
| 587 | } | 604 | } | ||
| 588 | - | return gobject.SignalConnect(x.GoPointer(), "edge-reached", purego.NewCallback(fcb)) | 605 | + | cbRefPtr := purego.NewCallback(fcb) |
| 606 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 607 | + | return gobject.SignalConnect(x.GoPointer(), "edge-reached", cbRefPtr) | |||
| 589 | } | 608 | } | ||
| 590 | 609 | ||||
| 591 | // Emitted when focus is moved away from the scrolled window by a | 610 | // Emitted when focus is moved away from the scrolled window by a | ||
| @@ -596,15 +615,23 @@ func (x *ScrolledWindow) ConnectEdgeReached(cb func(ScrolledWindow, PositionType | |||||
| 596 | // The default bindings for this signal are | 615 | // The default bindings for this signal are | ||
| 597 | // `Ctrl + Tab` to move forward and `Ctrl + Shift + Tab` to | 616 | // `Ctrl + Tab` to move forward and `Ctrl + Shift + Tab` to | ||
| 598 | // move backward. | 617 | // move backward. | ||
| 599 | - | func (x *ScrolledWindow) ConnectMoveFocusOut(cb func(ScrolledWindow, DirectionType)) uint32 { | 618 | + | func (x *ScrolledWindow) ConnectMoveFocusOut(cb *func(ScrolledWindow, DirectionType)) uint32 { |
| 619 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 620 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 621 | + | return gobject.SignalConnect(x.GoPointer(), "move-focus-out", cbRefPtr) | |||
| 622 | + | } | |||
| 623 | + | ||||
| 600 | fcb := func(clsPtr uintptr, DirectionTypeVarp DirectionType) { | 624 | fcb := func(clsPtr uintptr, DirectionTypeVarp DirectionType) { | ||
| 601 | fa := ScrolledWindow{} | 625 | fa := ScrolledWindow{} | ||
| 602 | fa.Ptr = clsPtr | 626 | fa.Ptr = clsPtr | ||
| 627 | + | cbFn := *cb | |||
| 603 | 628 | ||||
| 604 | - | cb(fa, DirectionTypeVarp) | 629 | + | cbFn(fa, DirectionTypeVarp) |
| 605 | 630 | ||||
| 606 | } | 631 | } | ||
| 607 | - | return gobject.SignalConnect(x.GoPointer(), "move-focus-out", purego.NewCallback(fcb)) | 632 | + | cbRefPtr := purego.NewCallback(fcb) |
| 633 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 634 | + | return gobject.SignalConnect(x.GoPointer(), "move-focus-out", cbRefPtr) | |||
| 608 | } | 635 | } | ||
| 609 | 636 | ||||
| 610 | // Emitted when a keybinding that scrolls is pressed. | 637 | // Emitted when a keybinding that scrolls is pressed. | ||
| @@ -613,15 +640,23 @@ func (x *ScrolledWindow) ConnectMoveFocusOut(cb func(ScrolledWindow, DirectionTy | |||||
| 613 | // | 640 | // | ||
| 614 | // The horizontal or vertical adjustment is updated which triggers a | 641 | // The horizontal or vertical adjustment is updated which triggers a | ||
| 615 | // signal that the scrolled window’s child may listen to and scroll itself. | 642 | // signal that the scrolled window’s child may listen to and scroll itself. | ||
| 616 | - | func (x *ScrolledWindow) ConnectScrollChild(cb func(ScrolledWindow, ScrollType, bool) bool) uint32 { | 643 | + | func (x *ScrolledWindow) ConnectScrollChild(cb *func(ScrolledWindow, ScrollType, bool) bool) uint32 { |
| 644 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 645 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 646 | + | return gobject.SignalConnect(x.GoPointer(), "scroll-child", cbRefPtr) | |||
| 647 | + | } | |||
| 648 | + | ||||
| 617 | fcb := func(clsPtr uintptr, ScrollVarp ScrollType, HorizontalVarp bool) bool { | 649 | fcb := func(clsPtr uintptr, ScrollVarp ScrollType, HorizontalVarp bool) bool { | ||
| 618 | fa := ScrolledWindow{} | 650 | fa := ScrolledWindow{} | ||
| 619 | fa.Ptr = clsPtr | 651 | fa.Ptr = clsPtr | ||
| 652 | + | cbFn := *cb | |||
| 620 | 653 | ||||
| 621 | - | return cb(fa, ScrollVarp, HorizontalVarp) | 654 | + | return cbFn(fa, ScrollVarp, HorizontalVarp) |
| 622 | 655 | ||||
| 623 | } | 656 | } | ||
| 624 | - | return gobject.SignalConnect(x.GoPointer(), "scroll-child", purego.NewCallback(fcb)) | 657 | + | cbRefPtr := purego.NewCallback(fcb) |
| 658 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 659 | + | return gobject.SignalConnect(x.GoPointer(), "scroll-child", cbRefPtr) | |||
| 625 | } | 660 | } | ||
| 626 | 661 | ||||
| 627 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 662 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/gtk/gtksearchentry.go +69 -18
| @@ -2,8 +2,11 @@ | |||||
| 2 | package gtk | 2 | package gtk | ||
| 3 | 3 | ||||
| 4 | import ( | 4 | import ( | ||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 5 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 6 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 7 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 8 | ) | 11 | ) | ||
| 9 | 12 | ||||
| @@ -151,15 +154,23 @@ func (c *SearchEntry) SetGoPointer(ptr uintptr) { | |||||
| 151 | // Emitted when the entry is activated. | 154 | // Emitted when the entry is activated. | ||
| 152 | // | 155 | // | ||
| 153 | // The keybindings for this signal are all forms of the Enter key. | 156 | // The keybindings for this signal are all forms of the Enter key. | ||
| 154 | - | func (x *SearchEntry) ConnectActivate(cb func(SearchEntry)) uint32 { | 157 | + | func (x *SearchEntry) ConnectActivate(cb *func(SearchEntry)) uint32 { |
| 158 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 159 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 160 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 161 | + | } | |||
| 162 | + | ||||
| 155 | fcb := func(clsPtr uintptr) { | 163 | fcb := func(clsPtr uintptr) { | ||
| 156 | fa := SearchEntry{} | 164 | fa := SearchEntry{} | ||
| 157 | fa.Ptr = clsPtr | 165 | fa.Ptr = clsPtr | ||
| 166 | + | cbFn := *cb | |||
| 158 | 167 | ||||
| 159 | - | cb(fa) | 168 | + | cbFn(fa) |
| 160 | 169 | ||||
| 161 | } | 170 | } | ||
| 162 | - | return gobject.SignalConnect(x.GoPointer(), "activate", purego.NewCallback(fcb)) | 171 | + | cbRefPtr := purego.NewCallback(fcb) |
| 172 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 173 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 163 | } | 174 | } | ||
| 164 | 175 | ||||
| 165 | // Emitted when the user initiates a move to the next match | 176 | // Emitted when the user initiates a move to the next match | ||
| @@ -171,15 +182,23 @@ func (x *SearchEntry) ConnectActivate(cb func(SearchEntry)) uint32 { | |||||
| 171 | // between matches. | 182 | // between matches. | ||
| 172 | // | 183 | // | ||
| 173 | // The default bindings for this signal is Ctrl-g. | 184 | // The default bindings for this signal is Ctrl-g. | ||
| 174 | - | func (x *SearchEntry) ConnectNextMatch(cb func(SearchEntry)) uint32 { | 185 | + | func (x *SearchEntry) ConnectNextMatch(cb *func(SearchEntry)) uint32 { |
| 186 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 187 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 188 | + | return gobject.SignalConnect(x.GoPointer(), "next-match", cbRefPtr) | |||
| 189 | + | } | |||
| 190 | + | ||||
| 175 | fcb := func(clsPtr uintptr) { | 191 | fcb := func(clsPtr uintptr) { | ||
| 176 | fa := SearchEntry{} | 192 | fa := SearchEntry{} | ||
| 177 | fa.Ptr = clsPtr | 193 | fa.Ptr = clsPtr | ||
| 194 | + | cbFn := *cb | |||
| 178 | 195 | ||||
| 179 | - | cb(fa) | 196 | + | cbFn(fa) |
| 180 | 197 | ||||
| 181 | } | 198 | } | ||
| 182 | - | return gobject.SignalConnect(x.GoPointer(), "next-match", purego.NewCallback(fcb)) | 199 | + | cbRefPtr := purego.NewCallback(fcb) |
| 200 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 201 | + | return gobject.SignalConnect(x.GoPointer(), "next-match", cbRefPtr) | |||
| 183 | } | 202 | } | ||
| 184 | 203 | ||||
| 185 | // Emitted when the user initiates a move to the previous match | 204 | // Emitted when the user initiates a move to the previous match | ||
| @@ -191,41 +210,65 @@ func (x *SearchEntry) ConnectNextMatch(cb func(SearchEntry)) uint32 { | |||||
| 191 | // between matches. | 210 | // between matches. | ||
| 192 | // | 211 | // | ||
| 193 | // The default bindings for this signal is Ctrl-Shift-g. | 212 | // The default bindings for this signal is Ctrl-Shift-g. | ||
| 194 | - | func (x *SearchEntry) ConnectPreviousMatch(cb func(SearchEntry)) uint32 { | 213 | + | func (x *SearchEntry) ConnectPreviousMatch(cb *func(SearchEntry)) uint32 { |
| 214 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 215 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 216 | + | return gobject.SignalConnect(x.GoPointer(), "previous-match", cbRefPtr) | |||
| 217 | + | } | |||
| 218 | + | ||||
| 195 | fcb := func(clsPtr uintptr) { | 219 | fcb := func(clsPtr uintptr) { | ||
| 196 | fa := SearchEntry{} | 220 | fa := SearchEntry{} | ||
| 197 | fa.Ptr = clsPtr | 221 | fa.Ptr = clsPtr | ||
| 222 | + | cbFn := *cb | |||
| 198 | 223 | ||||
| 199 | - | cb(fa) | 224 | + | cbFn(fa) |
| 200 | 225 | ||||
| 201 | } | 226 | } | ||
| 202 | - | return gobject.SignalConnect(x.GoPointer(), "previous-match", purego.NewCallback(fcb)) | 227 | + | cbRefPtr := purego.NewCallback(fcb) |
| 228 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 229 | + | return gobject.SignalConnect(x.GoPointer(), "previous-match", cbRefPtr) | |||
| 203 | } | 230 | } | ||
| 204 | 231 | ||||
| 205 | // Emitted with a delay. The length of the delay can be | 232 | // Emitted with a delay. The length of the delay can be | ||
| 206 | // changed with the [property@Gtk.SearchEntry:search-delay] | 233 | // changed with the [property@Gtk.SearchEntry:search-delay] | ||
| 207 | // property. | 234 | // property. | ||
| 208 | - | func (x *SearchEntry) ConnectSearchChanged(cb func(SearchEntry)) uint32 { | 235 | + | func (x *SearchEntry) ConnectSearchChanged(cb *func(SearchEntry)) uint32 { |
| 236 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 237 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 238 | + | return gobject.SignalConnect(x.GoPointer(), "search-changed", cbRefPtr) | |||
| 239 | + | } | |||
| 240 | + | ||||
| 209 | fcb := func(clsPtr uintptr) { | 241 | fcb := func(clsPtr uintptr) { | ||
| 210 | fa := SearchEntry{} | 242 | fa := SearchEntry{} | ||
| 211 | fa.Ptr = clsPtr | 243 | fa.Ptr = clsPtr | ||
| 244 | + | cbFn := *cb | |||
| 212 | 245 | ||||
| 213 | - | cb(fa) | 246 | + | cbFn(fa) |
| 214 | 247 | ||||
| 215 | } | 248 | } | ||
| 216 | - | return gobject.SignalConnect(x.GoPointer(), "search-changed", purego.NewCallback(fcb)) | 249 | + | cbRefPtr := purego.NewCallback(fcb) |
| 250 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 251 | + | return gobject.SignalConnect(x.GoPointer(), "search-changed", cbRefPtr) | |||
| 217 | } | 252 | } | ||
| 218 | 253 | ||||
| 219 | // Emitted when the user initiated a search on the entry. | 254 | // Emitted when the user initiated a search on the entry. | ||
| 220 | - | func (x *SearchEntry) ConnectSearchStarted(cb func(SearchEntry)) uint32 { | 255 | + | func (x *SearchEntry) ConnectSearchStarted(cb *func(SearchEntry)) uint32 { |
| 256 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 257 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 258 | + | return gobject.SignalConnect(x.GoPointer(), "search-started", cbRefPtr) | |||
| 259 | + | } | |||
| 260 | + | ||||
| 221 | fcb := func(clsPtr uintptr) { | 261 | fcb := func(clsPtr uintptr) { | ||
| 222 | fa := SearchEntry{} | 262 | fa := SearchEntry{} | ||
| 223 | fa.Ptr = clsPtr | 263 | fa.Ptr = clsPtr | ||
| 264 | + | cbFn := *cb | |||
| 224 | 265 | ||||
| 225 | - | cb(fa) | 266 | + | cbFn(fa) |
| 226 | 267 | ||||
| 227 | } | 268 | } | ||
| 228 | - | return gobject.SignalConnect(x.GoPointer(), "search-started", purego.NewCallback(fcb)) | 269 | + | cbRefPtr := purego.NewCallback(fcb) |
| 270 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 271 | + | return gobject.SignalConnect(x.GoPointer(), "search-started", cbRefPtr) | |||
| 229 | } | 272 | } | ||
| 230 | 273 | ||||
| 231 | // Emitted when the user stops a search via keyboard input. | 274 | // Emitted when the user stops a search via keyboard input. | ||
| @@ -236,15 +279,23 @@ func (x *SearchEntry) ConnectSearchStarted(cb func(SearchEntry)) uint32 { | |||||
| 236 | // the search entry in this case. | 279 | // the search entry in this case. | ||
| 237 | // | 280 | // | ||
| 238 | // The default bindings for this signal is Escape. | 281 | // The default bindings for this signal is Escape. | ||
| 239 | - | func (x *SearchEntry) ConnectStopSearch(cb func(SearchEntry)) uint32 { | 282 | + | func (x *SearchEntry) ConnectStopSearch(cb *func(SearchEntry)) uint32 { |
| 283 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 284 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 285 | + | return gobject.SignalConnect(x.GoPointer(), "stop-search", cbRefPtr) | |||
| 286 | + | } | |||
| 287 | + | ||||
| 240 | fcb := func(clsPtr uintptr) { | 288 | fcb := func(clsPtr uintptr) { | ||
| 241 | fa := SearchEntry{} | 289 | fa := SearchEntry{} | ||
| 242 | fa.Ptr = clsPtr | 290 | fa.Ptr = clsPtr | ||
| 291 | + | cbFn := *cb | |||
| 243 | 292 | ||||
| 244 | - | cb(fa) | 293 | + | cbFn(fa) |
| 245 | 294 | ||||
| 246 | } | 295 | } | ||
| 247 | - | return gobject.SignalConnect(x.GoPointer(), "stop-search", purego.NewCallback(fcb)) | 296 | + | cbRefPtr := purego.NewCallback(fcb) |
| 297 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 298 | + | return gobject.SignalConnect(x.GoPointer(), "stop-search", cbRefPtr) | |||
| 248 | } | 299 | } | ||
| 249 | 300 | ||||
| 250 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 301 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/gtk/gtkshortcutaction.go +2 -2
| @@ -129,10 +129,10 @@ var xNewCallbackAction func(uintptr, uintptr, uintptr) uintptr | |||||
| 129 | 129 | ||||
| 130 | // Create a custom action that calls the given @callback when | 130 | // Create a custom action that calls the given @callback when | ||
| 131 | // activated. | 131 | // activated. | ||
| 132 | - | func NewCallbackAction(CallbackVar ShortcutFunc, DataVar uintptr, DestroyVar glib.DestroyNotify) *CallbackAction { | 132 | + | func NewCallbackAction(CallbackVar *ShortcutFunc, DataVar uintptr, DestroyVar *glib.DestroyNotify) *CallbackAction { |
| 133 | var cls *CallbackAction | 133 | var cls *CallbackAction | ||
| 134 | 134 | ||||
| 135 | - | cret := xNewCallbackAction(purego.NewCallback(CallbackVar), DataVar, purego.NewCallback(DestroyVar)) | 135 | + | cret := xNewCallbackAction(glib.NewCallback(CallbackVar), DataVar, glib.NewCallback(DestroyVar)) |
| 136 | 136 | ||||
| 137 | if cret == 0 { | 137 | if cret == 0 { | ||
| 138 | return nil | 138 | return nil | ||
M v4/gtk/gtkshortcutssection.go +12 -3
| @@ -5,6 +5,7 @@ import ( | |||||
| 5 | "unsafe" | 5 | "unsafe" | ||
| 6 | 6 | ||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 8 | "github.com/jwijenbergh/puregotk/v4/gobject" | 9 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 9 | ) | 10 | ) | ||
| 10 | 11 | ||||
| @@ -46,15 +47,23 @@ func (c *ShortcutsSection) SetGoPointer(ptr uintptr) { | |||||
| 46 | c.Ptr = ptr | 47 | c.Ptr = ptr | ||
| 47 | } | 48 | } | ||
| 48 | 49 | ||||
| 49 | - | func (x *ShortcutsSection) ConnectChangeCurrentPage(cb func(ShortcutsSection, int) bool) uint32 { | 50 | + | func (x *ShortcutsSection) ConnectChangeCurrentPage(cb *func(ShortcutsSection, int) bool) uint32 { |
| 51 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 52 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 53 | + | return gobject.SignalConnect(x.GoPointer(), "change-current-page", cbRefPtr) | |||
| 54 | + | } | |||
| 55 | + | ||||
| 50 | fcb := func(clsPtr uintptr, ObjectVarp int) bool { | 56 | fcb := func(clsPtr uintptr, ObjectVarp int) bool { | ||
| 51 | fa := ShortcutsSection{} | 57 | fa := ShortcutsSection{} | ||
| 52 | fa.Ptr = clsPtr | 58 | fa.Ptr = clsPtr | ||
| 59 | + | cbFn := *cb | |||
| 53 | 60 | ||||
| 54 | - | return cb(fa, ObjectVarp) | 61 | + | return cbFn(fa, ObjectVarp) |
| 55 | 62 | ||||
| 56 | } | 63 | } | ||
| 57 | - | return gobject.SignalConnect(x.GoPointer(), "change-current-page", purego.NewCallback(fcb)) | 64 | + | cbRefPtr := purego.NewCallback(fcb) |
| 65 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 66 | + | return gobject.SignalConnect(x.GoPointer(), "change-current-page", cbRefPtr) | |||
| 58 | } | 67 | } | ||
| 59 | 68 | ||||
| 60 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 69 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/gtk/gtkshortcutswindow.go +25 -6
| @@ -2,8 +2,11 @@ | |||||
| 2 | package gtk | 2 | package gtk | ||
| 3 | 3 | ||||
| 4 | import ( | 4 | import ( | ||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 5 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 6 | "github.com/jwijenbergh/puregotk/v4/gdk" | 8 | "github.com/jwijenbergh/puregotk/v4/gdk" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 7 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 8 | "github.com/jwijenbergh/puregotk/v4/gsk" | 11 | "github.com/jwijenbergh/puregotk/v4/gsk" | ||
| 9 | ) | 12 | ) | ||
| @@ -72,15 +75,23 @@ func (c *ShortcutsWindow) SetGoPointer(ptr uintptr) { | |||||
| 72 | // This is a [keybinding signal](class.SignalAction.html). | 75 | // This is a [keybinding signal](class.SignalAction.html). | ||
| 73 | // | 76 | // | ||
| 74 | // The default binding for this signal is the Escape key. | 77 | // The default binding for this signal is the Escape key. | ||
| 75 | - | func (x *ShortcutsWindow) ConnectClose(cb func(ShortcutsWindow)) uint32 { | 78 | + | func (x *ShortcutsWindow) ConnectClose(cb *func(ShortcutsWindow)) uint32 { |
| 79 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 80 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 81 | + | return gobject.SignalConnect(x.GoPointer(), "close", cbRefPtr) | |||
| 82 | + | } | |||
| 83 | + | ||||
| 76 | fcb := func(clsPtr uintptr) { | 84 | fcb := func(clsPtr uintptr) { | ||
| 77 | fa := ShortcutsWindow{} | 85 | fa := ShortcutsWindow{} | ||
| 78 | fa.Ptr = clsPtr | 86 | fa.Ptr = clsPtr | ||
| 87 | + | cbFn := *cb | |||
| 79 | 88 | ||||
| 80 | - | cb(fa) | 89 | + | cbFn(fa) |
| 81 | 90 | ||||
| 82 | } | 91 | } | ||
| 83 | - | return gobject.SignalConnect(x.GoPointer(), "close", purego.NewCallback(fcb)) | 92 | + | cbRefPtr := purego.NewCallback(fcb) |
| 93 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 94 | + | return gobject.SignalConnect(x.GoPointer(), "close", cbRefPtr) | |||
| 84 | } | 95 | } | ||
| 85 | 96 | ||||
| 86 | // Emitted when the user uses a keybinding to start a search. | 97 | // Emitted when the user uses a keybinding to start a search. | ||
| @@ -88,15 +99,23 @@ func (x *ShortcutsWindow) ConnectClose(cb func(ShortcutsWindow)) uint32 { | |||||
| 88 | // This is a [keybinding signal](class.SignalAction.html). | 99 | // This is a [keybinding signal](class.SignalAction.html). | ||
| 89 | // | 100 | // | ||
| 90 | // The default binding for this signal is Control-F. | 101 | // The default binding for this signal is Control-F. | ||
| 91 | - | func (x *ShortcutsWindow) ConnectSearch(cb func(ShortcutsWindow)) uint32 { | 102 | + | func (x *ShortcutsWindow) ConnectSearch(cb *func(ShortcutsWindow)) uint32 { |
| 103 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 104 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 105 | + | return gobject.SignalConnect(x.GoPointer(), "search", cbRefPtr) | |||
| 106 | + | } | |||
| 107 | + | ||||
| 92 | fcb := func(clsPtr uintptr) { | 108 | fcb := func(clsPtr uintptr) { | ||
| 93 | fa := ShortcutsWindow{} | 109 | fa := ShortcutsWindow{} | ||
| 94 | fa.Ptr = clsPtr | 110 | fa.Ptr = clsPtr | ||
| 111 | + | cbFn := *cb | |||
| 95 | 112 | ||||
| 96 | - | cb(fa) | 113 | + | cbFn(fa) |
| 97 | 114 | ||||
| 98 | } | 115 | } | ||
| 99 | - | return gobject.SignalConnect(x.GoPointer(), "search", purego.NewCallback(fcb)) | 116 | + | cbRefPtr := purego.NewCallback(fcb) |
| 117 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 118 | + | return gobject.SignalConnect(x.GoPointer(), "search", cbRefPtr) | |||
| 100 | } | 119 | } | ||
| 101 | 120 | ||||
| 102 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 121 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/gtk/gtkshow.go +2 -2
| @@ -28,9 +28,9 @@ var xShowUriFull func(uintptr, string, uint32, uintptr, uintptr, uintptr) | |||||
| 28 | // | 28 | // | ||
| 29 | // This is the recommended call to be used as it passes information | 29 | // This is the recommended call to be used as it passes information | ||
| 30 | // necessary for sandbox helpers to parent their dialogs properly. | 30 | // necessary for sandbox helpers to parent their dialogs properly. | ||
| 31 | - | func ShowUriFull(ParentVar *Window, UriVar string, TimestampVar uint32, CancellableVar *gio.Cancellable, CallbackVar gio.AsyncReadyCallback, UserDataVar uintptr) { | 31 | + | func ShowUriFull(ParentVar *Window, UriVar string, TimestampVar uint32, CancellableVar *gio.Cancellable, CallbackVar *gio.AsyncReadyCallback, UserDataVar uintptr) { |
| 32 | 32 | ||||
| 33 | - | xShowUriFull(ParentVar.GoPointer(), UriVar, TimestampVar, CancellableVar.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar) | 33 | + | xShowUriFull(ParentVar.GoPointer(), UriVar, TimestampVar, CancellableVar.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar) |
| 34 | 34 | ||||
| 35 | } | 35 | } | ||
| 36 | 36 | ||||
M v4/gtk/gtksignallistitemfactory.go +45 -12
| @@ -6,6 +6,7 @@ import ( | |||||
| 6 | 6 | ||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 9 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 10 | ) | 11 | ) | ||
| 11 | 12 | ||||
| @@ -102,15 +103,23 @@ func (c *SignalListItemFactory) SetGoPointer(ptr uintptr) { | |||||
| 102 | // The [signal@Gtk.SignalListItemFactory::unbind] signal is the | 103 | // The [signal@Gtk.SignalListItemFactory::unbind] signal is the | ||
| 103 | // opposite of this signal and can be used to undo everything done | 104 | // opposite of this signal and can be used to undo everything done | ||
| 104 | // in this signal. | 105 | // in this signal. | ||
| 105 | - | func (x *SignalListItemFactory) ConnectBind(cb func(SignalListItemFactory, uintptr)) uint32 { | 106 | + | func (x *SignalListItemFactory) ConnectBind(cb *func(SignalListItemFactory, uintptr)) uint32 { |
| 107 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 108 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 109 | + | return gobject.SignalConnect(x.GoPointer(), "bind", cbRefPtr) | |||
| 110 | + | } | |||
| 111 | + | ||||
| 106 | fcb := func(clsPtr uintptr, ObjectVarp uintptr) { | 112 | fcb := func(clsPtr uintptr, ObjectVarp uintptr) { | ||
| 107 | fa := SignalListItemFactory{} | 113 | fa := SignalListItemFactory{} | ||
| 108 | fa.Ptr = clsPtr | 114 | fa.Ptr = clsPtr | ||
| 115 | + | cbFn := *cb | |||
| 109 | 116 | ||||
| 110 | - | cb(fa, ObjectVarp) | 117 | + | cbFn(fa, ObjectVarp) |
| 111 | 118 | ||||
| 112 | } | 119 | } | ||
| 113 | - | return gobject.SignalConnect(x.GoPointer(), "bind", purego.NewCallback(fcb)) | 120 | + | cbRefPtr := purego.NewCallback(fcb) |
| 121 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 122 | + | return gobject.SignalConnect(x.GoPointer(), "bind", cbRefPtr) | |||
| 114 | } | 123 | } | ||
| 115 | 124 | ||||
| 116 | // Emitted when a new listitem has been created and needs to be setup for use. | 125 | // Emitted when a new listitem has been created and needs to be setup for use. | ||
| @@ -119,15 +128,23 @@ func (x *SignalListItemFactory) ConnectBind(cb func(SignalListItemFactory, uintp | |||||
| 119 | // | 128 | // | ||
| 120 | // The [signal@Gtk.SignalListItemFactory::teardown] signal is the opposite | 129 | // The [signal@Gtk.SignalListItemFactory::teardown] signal is the opposite | ||
| 121 | // of this signal and can be used to undo everything done in this signal. | 130 | // of this signal and can be used to undo everything done in this signal. | ||
| 122 | - | func (x *SignalListItemFactory) ConnectSetup(cb func(SignalListItemFactory, uintptr)) uint32 { | 131 | + | func (x *SignalListItemFactory) ConnectSetup(cb *func(SignalListItemFactory, uintptr)) uint32 { |
| 132 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 133 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 134 | + | return gobject.SignalConnect(x.GoPointer(), "setup", cbRefPtr) | |||
| 135 | + | } | |||
| 136 | + | ||||
| 123 | fcb := func(clsPtr uintptr, ObjectVarp uintptr) { | 137 | fcb := func(clsPtr uintptr, ObjectVarp uintptr) { | ||
| 124 | fa := SignalListItemFactory{} | 138 | fa := SignalListItemFactory{} | ||
| 125 | fa.Ptr = clsPtr | 139 | fa.Ptr = clsPtr | ||
| 140 | + | cbFn := *cb | |||
| 126 | 141 | ||||
| 127 | - | cb(fa, ObjectVarp) | 142 | + | cbFn(fa, ObjectVarp) |
| 128 | 143 | ||||
| 129 | } | 144 | } | ||
| 130 | - | return gobject.SignalConnect(x.GoPointer(), "setup", purego.NewCallback(fcb)) | 145 | + | cbRefPtr := purego.NewCallback(fcb) |
| 146 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 147 | + | return gobject.SignalConnect(x.GoPointer(), "setup", cbRefPtr) | |||
| 131 | } | 148 | } | ||
| 132 | 149 | ||||
| 133 | // Emitted when an object is about to be destroyed. | 150 | // Emitted when an object is about to be destroyed. | ||
| @@ -136,15 +153,23 @@ func (x *SignalListItemFactory) ConnectSetup(cb func(SignalListItemFactory, uint | |||||
| 136 | // | 153 | // | ||
| 137 | // This signal is the opposite of the [signal@Gtk.SignalListItemFactory::setup] | 154 | // This signal is the opposite of the [signal@Gtk.SignalListItemFactory::setup] | ||
| 138 | // signal and should be used to undo everything done in that signal. | 155 | // signal and should be used to undo everything done in that signal. | ||
| 139 | - | func (x *SignalListItemFactory) ConnectTeardown(cb func(SignalListItemFactory, uintptr)) uint32 { | 156 | + | func (x *SignalListItemFactory) ConnectTeardown(cb *func(SignalListItemFactory, uintptr)) uint32 { |
| 157 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 158 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 159 | + | return gobject.SignalConnect(x.GoPointer(), "teardown", cbRefPtr) | |||
| 160 | + | } | |||
| 161 | + | ||||
| 140 | fcb := func(clsPtr uintptr, ObjectVarp uintptr) { | 162 | fcb := func(clsPtr uintptr, ObjectVarp uintptr) { | ||
| 141 | fa := SignalListItemFactory{} | 163 | fa := SignalListItemFactory{} | ||
| 142 | fa.Ptr = clsPtr | 164 | fa.Ptr = clsPtr | ||
| 165 | + | cbFn := *cb | |||
| 143 | 166 | ||||
| 144 | - | cb(fa, ObjectVarp) | 167 | + | cbFn(fa, ObjectVarp) |
| 145 | 168 | ||||
| 146 | } | 169 | } | ||
| 147 | - | return gobject.SignalConnect(x.GoPointer(), "teardown", purego.NewCallback(fcb)) | 170 | + | cbRefPtr := purego.NewCallback(fcb) |
| 171 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 172 | + | return gobject.SignalConnect(x.GoPointer(), "teardown", cbRefPtr) | |||
| 148 | } | 173 | } | ||
| 149 | 174 | ||||
| 150 | // Emitted when a object has been unbound from its item, for example when | 175 | // Emitted when a object has been unbound from its item, for example when | ||
| @@ -153,15 +178,23 @@ func (x *SignalListItemFactory) ConnectTeardown(cb func(SignalListItemFactory, u | |||||
| 153 | // | 178 | // | ||
| 154 | // This signal is the opposite of the [signal@Gtk.SignalListItemFactory::bind] | 179 | // This signal is the opposite of the [signal@Gtk.SignalListItemFactory::bind] | ||
| 155 | // signal and should be used to undo everything done in that signal. | 180 | // signal and should be used to undo everything done in that signal. | ||
| 156 | - | func (x *SignalListItemFactory) ConnectUnbind(cb func(SignalListItemFactory, uintptr)) uint32 { | 181 | + | func (x *SignalListItemFactory) ConnectUnbind(cb *func(SignalListItemFactory, uintptr)) uint32 { |
| 182 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 183 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 184 | + | return gobject.SignalConnect(x.GoPointer(), "unbind", cbRefPtr) | |||
| 185 | + | } | |||
| 186 | + | ||||
| 157 | fcb := func(clsPtr uintptr, ObjectVarp uintptr) { | 187 | fcb := func(clsPtr uintptr, ObjectVarp uintptr) { | ||
| 158 | fa := SignalListItemFactory{} | 188 | fa := SignalListItemFactory{} | ||
| 159 | fa.Ptr = clsPtr | 189 | fa.Ptr = clsPtr | ||
| 190 | + | cbFn := *cb | |||
| 160 | 191 | ||||
| 161 | - | cb(fa, ObjectVarp) | 192 | + | cbFn(fa, ObjectVarp) |
| 162 | 193 | ||||
| 163 | } | 194 | } | ||
| 164 | - | return gobject.SignalConnect(x.GoPointer(), "unbind", purego.NewCallback(fcb)) | 195 | + | cbRefPtr := purego.NewCallback(fcb) |
| 196 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 197 | + | return gobject.SignalConnect(x.GoPointer(), "unbind", cbRefPtr) | |||
| 165 | } | 198 | } | ||
| 166 | 199 | ||||
| 167 | func init() { | 200 | func init() { | ||
M v4/gtk/gtksorter.go +12 -3
| @@ -6,6 +6,7 @@ import ( | |||||
| 6 | 6 | ||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 9 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 10 | ) | 11 | ) | ||
| 11 | 12 | ||||
| @@ -157,15 +158,23 @@ func (c *Sorter) SetGoPointer(ptr uintptr) { | |||||
| 157 | // Depending on the @change parameter, it may be possible to update | 158 | // Depending on the @change parameter, it may be possible to update | ||
| 158 | // the sort order without a full resorting. Refer to the | 159 | // the sort order without a full resorting. Refer to the | ||
| 159 | // [enum@Gtk.SorterChange] documentation for details. | 160 | // [enum@Gtk.SorterChange] documentation for details. | ||
| 160 | - | func (x *Sorter) ConnectChanged(cb func(Sorter, SorterChange)) uint32 { | 161 | + | func (x *Sorter) ConnectChanged(cb *func(Sorter, SorterChange)) uint32 { |
| 162 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 163 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 164 | + | return gobject.SignalConnect(x.GoPointer(), "changed", cbRefPtr) | |||
| 165 | + | } | |||
| 166 | + | ||||
| 161 | fcb := func(clsPtr uintptr, ChangeVarp SorterChange) { | 167 | fcb := func(clsPtr uintptr, ChangeVarp SorterChange) { | ||
| 162 | fa := Sorter{} | 168 | fa := Sorter{} | ||
| 163 | fa.Ptr = clsPtr | 169 | fa.Ptr = clsPtr | ||
| 170 | + | cbFn := *cb | |||
| 164 | 171 | ||||
| 165 | - | cb(fa, ChangeVarp) | 172 | + | cbFn(fa, ChangeVarp) |
| 166 | 173 | ||||
| 167 | } | 174 | } | ||
| 168 | - | return gobject.SignalConnect(x.GoPointer(), "changed", purego.NewCallback(fcb)) | 175 | + | cbRefPtr := purego.NewCallback(fcb) |
| 176 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 177 | + | return gobject.SignalConnect(x.GoPointer(), "changed", cbRefPtr) | |||
| 169 | } | 178 | } | ||
| 170 | 179 | ||||
| 171 | func init() { | 180 | func init() { | ||
M v4/gtk/gtkspinbutton.go +58 -15
| @@ -2,9 +2,12 @@ | |||||
| 2 | package gtk | 2 | package gtk | ||
| 3 | 3 | ||||
| 4 | import ( | 4 | import ( | ||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 5 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 6 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 7 | "github.com/jwijenbergh/puregotk/v4/gdk" | 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | ||
| 10 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 8 | "github.com/jwijenbergh/puregotk/v4/gobject" | 11 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 9 | ) | 12 | ) | ||
| 10 | 13 | ||||
| @@ -501,15 +504,23 @@ func (c *SpinButton) SetGoPointer(ptr uintptr) { | |||||
| 501 | // programmatically. | 504 | // programmatically. | ||
| 502 | // | 505 | // | ||
| 503 | // The default bindings for this signal are Up/Down and PageUp/PageDown. | 506 | // The default bindings for this signal are Up/Down and PageUp/PageDown. | ||
| 504 | - | func (x *SpinButton) ConnectChangeValue(cb func(SpinButton, ScrollType)) uint32 { | 507 | + | func (x *SpinButton) ConnectChangeValue(cb *func(SpinButton, ScrollType)) uint32 { |
| 508 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 509 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 510 | + | return gobject.SignalConnect(x.GoPointer(), "change-value", cbRefPtr) | |||
| 511 | + | } | |||
| 512 | + | ||||
| 505 | fcb := func(clsPtr uintptr, ScrollVarp ScrollType) { | 513 | fcb := func(clsPtr uintptr, ScrollVarp ScrollType) { | ||
| 506 | fa := SpinButton{} | 514 | fa := SpinButton{} | ||
| 507 | fa.Ptr = clsPtr | 515 | fa.Ptr = clsPtr | ||
| 516 | + | cbFn := *cb | |||
| 508 | 517 | ||||
| 509 | - | cb(fa, ScrollVarp) | 518 | + | cbFn(fa, ScrollVarp) |
| 510 | 519 | ||||
| 511 | } | 520 | } | ||
| 512 | - | return gobject.SignalConnect(x.GoPointer(), "change-value", purego.NewCallback(fcb)) | 521 | + | cbRefPtr := purego.NewCallback(fcb) |
| 522 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 523 | + | return gobject.SignalConnect(x.GoPointer(), "change-value", cbRefPtr) | |||
| 513 | } | 524 | } | ||
| 514 | 525 | ||||
| 515 | // Emitted to convert the users input into a double value. | 526 | // Emitted to convert the users input into a double value. | ||
| @@ -519,15 +530,23 @@ func (x *SpinButton) ConnectChangeValue(cb func(SpinButton, ScrollType)) uint32 | |||||
| 519 | // new value. | 530 | // new value. | ||
| 520 | // | 531 | // | ||
| 521 | // The default conversion uses g_strtod(). | 532 | // The default conversion uses g_strtod(). | ||
| 522 | - | func (x *SpinButton) ConnectInput(cb func(SpinButton, float64) int) uint32 { | 533 | + | func (x *SpinButton) ConnectInput(cb *func(SpinButton, float64) int) uint32 { |
| 534 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 535 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 536 | + | return gobject.SignalConnect(x.GoPointer(), "input", cbRefPtr) | |||
| 537 | + | } | |||
| 538 | + | ||||
| 523 | fcb := func(clsPtr uintptr, NewValueVarp float64) int { | 539 | fcb := func(clsPtr uintptr, NewValueVarp float64) int { | ||
| 524 | fa := SpinButton{} | 540 | fa := SpinButton{} | ||
| 525 | fa.Ptr = clsPtr | 541 | fa.Ptr = clsPtr | ||
| 542 | + | cbFn := *cb | |||
| 526 | 543 | ||||
| 527 | - | return cb(fa, NewValueVarp) | 544 | + | return cbFn(fa, NewValueVarp) |
| 528 | 545 | ||||
| 529 | } | 546 | } | ||
| 530 | - | return gobject.SignalConnect(x.GoPointer(), "input", purego.NewCallback(fcb)) | 547 | + | cbRefPtr := purego.NewCallback(fcb) |
| 548 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 549 | + | return gobject.SignalConnect(x.GoPointer(), "input", cbRefPtr) | |||
| 531 | } | 550 | } | ||
| 532 | 551 | ||||
| 533 | // Emitted to tweak the formatting of the value for display. | 552 | // Emitted to tweak the formatting of the value for display. | ||
| @@ -554,42 +573,66 @@ func (x *SpinButton) ConnectInput(cb func(SpinButton, float64) int) uint32 { | |||||
| 554 | // } | 573 | // } | ||
| 555 | // | 574 | // | ||
| 556 | // ``` | 575 | // ``` | ||
| 557 | - | func (x *SpinButton) ConnectOutput(cb func(SpinButton) bool) uint32 { | 576 | + | func (x *SpinButton) ConnectOutput(cb *func(SpinButton) bool) uint32 { |
| 577 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 578 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 579 | + | return gobject.SignalConnect(x.GoPointer(), "output", cbRefPtr) | |||
| 580 | + | } | |||
| 581 | + | ||||
| 558 | fcb := func(clsPtr uintptr) bool { | 582 | fcb := func(clsPtr uintptr) bool { | ||
| 559 | fa := SpinButton{} | 583 | fa := SpinButton{} | ||
| 560 | fa.Ptr = clsPtr | 584 | fa.Ptr = clsPtr | ||
| 585 | + | cbFn := *cb | |||
| 561 | 586 | ||||
| 562 | - | return cb(fa) | 587 | + | return cbFn(fa) |
| 563 | 588 | ||||
| 564 | } | 589 | } | ||
| 565 | - | return gobject.SignalConnect(x.GoPointer(), "output", purego.NewCallback(fcb)) | 590 | + | cbRefPtr := purego.NewCallback(fcb) |
| 591 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 592 | + | return gobject.SignalConnect(x.GoPointer(), "output", cbRefPtr) | |||
| 566 | } | 593 | } | ||
| 567 | 594 | ||||
| 568 | // Emitted when the value is changed. | 595 | // Emitted when the value is changed. | ||
| 569 | // | 596 | // | ||
| 570 | // Also see the [signal@Gtk.SpinButton::output] signal. | 597 | // Also see the [signal@Gtk.SpinButton::output] signal. | ||
| 571 | - | func (x *SpinButton) ConnectValueChanged(cb func(SpinButton)) uint32 { | 598 | + | func (x *SpinButton) ConnectValueChanged(cb *func(SpinButton)) uint32 { |
| 599 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 600 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 601 | + | return gobject.SignalConnect(x.GoPointer(), "value-changed", cbRefPtr) | |||
| 602 | + | } | |||
| 603 | + | ||||
| 572 | fcb := func(clsPtr uintptr) { | 604 | fcb := func(clsPtr uintptr) { | ||
| 573 | fa := SpinButton{} | 605 | fa := SpinButton{} | ||
| 574 | fa.Ptr = clsPtr | 606 | fa.Ptr = clsPtr | ||
| 607 | + | cbFn := *cb | |||
| 575 | 608 | ||||
| 576 | - | cb(fa) | 609 | + | cbFn(fa) |
| 577 | 610 | ||||
| 578 | } | 611 | } | ||
| 579 | - | return gobject.SignalConnect(x.GoPointer(), "value-changed", purego.NewCallback(fcb)) | 612 | + | cbRefPtr := purego.NewCallback(fcb) |
| 613 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 614 | + | return gobject.SignalConnect(x.GoPointer(), "value-changed", cbRefPtr) | |||
| 580 | } | 615 | } | ||
| 581 | 616 | ||||
| 582 | // Emitted right after the spinbutton wraps from its maximum | 617 | // Emitted right after the spinbutton wraps from its maximum | ||
| 583 | // to its minimum value or vice-versa. | 618 | // to its minimum value or vice-versa. | ||
| 584 | - | func (x *SpinButton) ConnectWrapped(cb func(SpinButton)) uint32 { | 619 | + | func (x *SpinButton) ConnectWrapped(cb *func(SpinButton)) uint32 { |
| 620 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 621 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 622 | + | return gobject.SignalConnect(x.GoPointer(), "wrapped", cbRefPtr) | |||
| 623 | + | } | |||
| 624 | + | ||||
| 585 | fcb := func(clsPtr uintptr) { | 625 | fcb := func(clsPtr uintptr) { | ||
| 586 | fa := SpinButton{} | 626 | fa := SpinButton{} | ||
| 587 | fa.Ptr = clsPtr | 627 | fa.Ptr = clsPtr | ||
| 628 | + | cbFn := *cb | |||
| 588 | 629 | ||||
| 589 | - | cb(fa) | 630 | + | cbFn(fa) |
| 590 | 631 | ||||
| 591 | } | 632 | } | ||
| 592 | - | return gobject.SignalConnect(x.GoPointer(), "wrapped", purego.NewCallback(fcb)) | 633 | + | cbRefPtr := purego.NewCallback(fcb) |
| 634 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 635 | + | return gobject.SignalConnect(x.GoPointer(), "wrapped", cbRefPtr) | |||
| 593 | } | 636 | } | ||
| 594 | 637 | ||||
| 595 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 638 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/gtk/gtkstatusbar.go +25 -6
| @@ -2,8 +2,11 @@ | |||||
| 2 | package gtk | 2 | package gtk | ||
| 3 | 3 | ||||
| 4 | import ( | 4 | import ( | ||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 5 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 6 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 7 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 8 | ) | 11 | ) | ||
| 9 | 12 | ||||
| @@ -134,27 +137,43 @@ func (c *Statusbar) SetGoPointer(ptr uintptr) { | |||||
| 134 | } | 137 | } | ||
| 135 | 138 | ||||
| 136 | // Emitted whenever a new message is popped off a statusbar's stack. | 139 | // Emitted whenever a new message is popped off a statusbar's stack. | ||
| 137 | - | func (x *Statusbar) ConnectTextPopped(cb func(Statusbar, uint, string)) uint32 { | 140 | + | func (x *Statusbar) ConnectTextPopped(cb *func(Statusbar, uint, string)) uint32 { |
| 141 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 142 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 143 | + | return gobject.SignalConnect(x.GoPointer(), "text-popped", cbRefPtr) | |||
| 144 | + | } | |||
| 145 | + | ||||
| 138 | fcb := func(clsPtr uintptr, ContextIdVarp uint, TextVarp string) { | 146 | fcb := func(clsPtr uintptr, ContextIdVarp uint, TextVarp string) { | ||
| 139 | fa := Statusbar{} | 147 | fa := Statusbar{} | ||
| 140 | fa.Ptr = clsPtr | 148 | fa.Ptr = clsPtr | ||
| 149 | + | cbFn := *cb | |||
| 141 | 150 | ||||
| 142 | - | cb(fa, ContextIdVarp, TextVarp) | 151 | + | cbFn(fa, ContextIdVarp, TextVarp) |
| 143 | 152 | ||||
| 144 | } | 153 | } | ||
| 145 | - | return gobject.SignalConnect(x.GoPointer(), "text-popped", purego.NewCallback(fcb)) | 154 | + | cbRefPtr := purego.NewCallback(fcb) |
| 155 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 156 | + | return gobject.SignalConnect(x.GoPointer(), "text-popped", cbRefPtr) | |||
| 146 | } | 157 | } | ||
| 147 | 158 | ||||
| 148 | // Emitted whenever a new message gets pushed onto a statusbar's stack. | 159 | // Emitted whenever a new message gets pushed onto a statusbar's stack. | ||
| 149 | - | func (x *Statusbar) ConnectTextPushed(cb func(Statusbar, uint, string)) uint32 { | 160 | + | func (x *Statusbar) ConnectTextPushed(cb *func(Statusbar, uint, string)) uint32 { |
| 161 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 162 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 163 | + | return gobject.SignalConnect(x.GoPointer(), "text-pushed", cbRefPtr) | |||
| 164 | + | } | |||
| 165 | + | ||||
| 150 | fcb := func(clsPtr uintptr, ContextIdVarp uint, TextVarp string) { | 166 | fcb := func(clsPtr uintptr, ContextIdVarp uint, TextVarp string) { | ||
| 151 | fa := Statusbar{} | 167 | fa := Statusbar{} | ||
| 152 | fa.Ptr = clsPtr | 168 | fa.Ptr = clsPtr | ||
| 169 | + | cbFn := *cb | |||
| 153 | 170 | ||||
| 154 | - | cb(fa, ContextIdVarp, TextVarp) | 171 | + | cbFn(fa, ContextIdVarp, TextVarp) |
| 155 | 172 | ||||
| 156 | } | 173 | } | ||
| 157 | - | return gobject.SignalConnect(x.GoPointer(), "text-pushed", purego.NewCallback(fcb)) | 174 | + | cbRefPtr := purego.NewCallback(fcb) |
| 175 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 176 | + | return gobject.SignalConnect(x.GoPointer(), "text-pushed", cbRefPtr) | |||
| 158 | } | 177 | } | ||
| 159 | 178 | ||||
| 160 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 179 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/gtk/gtkswitch.go +24 -6
| @@ -2,6 +2,8 @@ | |||||
| 2 | package gtk | 2 | package gtk | ||
| 3 | 3 | ||||
| 4 | import ( | 4 | import ( | ||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 5 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 6 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 7 | "github.com/jwijenbergh/puregotk/v4/glib" | 9 | "github.com/jwijenbergh/puregotk/v4/glib" | ||
| @@ -115,15 +117,23 @@ func (c *Switch) SetGoPointer(ptr uintptr) { | |||||
| 115 | // | 117 | // | ||
| 116 | // Applications should never connect to this signal, | 118 | // Applications should never connect to this signal, | ||
| 117 | // but use the [property@Gtk.Switch:active] property. | 119 | // but use the [property@Gtk.Switch:active] property. | ||
| 118 | - | func (x *Switch) ConnectActivate(cb func(Switch)) uint32 { | 120 | + | func (x *Switch) ConnectActivate(cb *func(Switch)) uint32 { |
| 121 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 122 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 123 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 124 | + | } | |||
| 125 | + | ||||
| 119 | fcb := func(clsPtr uintptr) { | 126 | fcb := func(clsPtr uintptr) { | ||
| 120 | fa := Switch{} | 127 | fa := Switch{} | ||
| 121 | fa.Ptr = clsPtr | 128 | fa.Ptr = clsPtr | ||
| 129 | + | cbFn := *cb | |||
| 122 | 130 | ||||
| 123 | - | cb(fa) | 131 | + | cbFn(fa) |
| 124 | 132 | ||||
| 125 | } | 133 | } | ||
| 126 | - | return gobject.SignalConnect(x.GoPointer(), "activate", purego.NewCallback(fcb)) | 134 | + | cbRefPtr := purego.NewCallback(fcb) |
| 135 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 136 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 127 | } | 137 | } | ||
| 128 | 138 | ||||
| 129 | // Emitted to change the underlying state. | 139 | // Emitted to change the underlying state. | ||
| @@ -141,15 +151,23 @@ func (x *Switch) ConnectActivate(cb func(Switch)) uint32 { | |||||
| 141 | // Visually, the underlying state is represented by the trough color of | 151 | // Visually, the underlying state is represented by the trough color of | ||
| 142 | // the switch, while the [property@Gtk.Switch:active] property is | 152 | // the switch, while the [property@Gtk.Switch:active] property is | ||
| 143 | // represented by the position of the switch. | 153 | // represented by the position of the switch. | ||
| 144 | - | func (x *Switch) ConnectStateSet(cb func(Switch, bool) bool) uint32 { | 154 | + | func (x *Switch) ConnectStateSet(cb *func(Switch, bool) bool) uint32 { |
| 155 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 156 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 157 | + | return gobject.SignalConnect(x.GoPointer(), "state-set", cbRefPtr) | |||
| 158 | + | } | |||
| 159 | + | ||||
| 145 | fcb := func(clsPtr uintptr, StateVarp bool) bool { | 160 | fcb := func(clsPtr uintptr, StateVarp bool) bool { | ||
| 146 | fa := Switch{} | 161 | fa := Switch{} | ||
| 147 | fa.Ptr = clsPtr | 162 | fa.Ptr = clsPtr | ||
| 163 | + | cbFn := *cb | |||
| 148 | 164 | ||||
| 149 | - | return cb(fa, StateVarp) | 165 | + | return cbFn(fa, StateVarp) |
| 150 | 166 | ||||
| 151 | } | 167 | } | ||
| 152 | - | return gobject.SignalConnect(x.GoPointer(), "state-set", purego.NewCallback(fcb)) | 168 | + | cbRefPtr := purego.NewCallback(fcb) |
| 169 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 170 | + | return gobject.SignalConnect(x.GoPointer(), "state-set", cbRefPtr) | |||
| 153 | } | 171 | } | ||
| 154 | 172 | ||||
| 155 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 173 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/gtk/gtktext.go +124 -33
| @@ -2,9 +2,12 @@ | |||||
| 2 | package gtk | 2 | package gtk | ||
| 3 | 3 | ||||
| 4 | import ( | 4 | import ( | ||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 5 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 6 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 7 | "github.com/jwijenbergh/puregotk/v4/gio" | 9 | "github.com/jwijenbergh/puregotk/v4/gio" | ||
| 10 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 8 | "github.com/jwijenbergh/puregotk/v4/gobject" | 11 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 9 | "github.com/jwijenbergh/puregotk/v4/graphene" | 12 | "github.com/jwijenbergh/puregotk/v4/graphene" | ||
| 10 | "github.com/jwijenbergh/puregotk/v4/pango" | 13 | "github.com/jwijenbergh/puregotk/v4/pango" | ||
| @@ -542,15 +545,23 @@ func (c *Text) SetGoPointer(ptr uintptr) { | |||||
| 542 | // | 545 | // | ||
| 543 | // The default bindings for this signal are all forms | 546 | // The default bindings for this signal are all forms | ||
| 544 | // of the <kbd>Enter</kbd> key. | 547 | // of the <kbd>Enter</kbd> key. | ||
| 545 | - | func (x *Text) ConnectActivate(cb func(Text)) uint32 { | 548 | + | func (x *Text) ConnectActivate(cb *func(Text)) uint32 { |
| 549 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 550 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 551 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 552 | + | } | |||
| 553 | + | ||||
| 546 | fcb := func(clsPtr uintptr) { | 554 | fcb := func(clsPtr uintptr) { | ||
| 547 | fa := Text{} | 555 | fa := Text{} | ||
| 548 | fa.Ptr = clsPtr | 556 | fa.Ptr = clsPtr | ||
| 557 | + | cbFn := *cb | |||
| 549 | 558 | ||||
| 550 | - | cb(fa) | 559 | + | cbFn(fa) |
| 551 | 560 | ||||
| 552 | } | 561 | } | ||
| 553 | - | return gobject.SignalConnect(x.GoPointer(), "activate", purego.NewCallback(fcb)) | 562 | + | cbRefPtr := purego.NewCallback(fcb) |
| 563 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 564 | + | return gobject.SignalConnect(x.GoPointer(), "activate", cbRefPtr) | |||
| 554 | } | 565 | } | ||
| 555 | 566 | ||||
| 556 | // Emitted when the user asks for it. | 567 | // Emitted when the user asks for it. | ||
| @@ -559,15 +570,23 @@ func (x *Text) ConnectActivate(cb func(Text)) uint32 { | |||||
| 559 | // | 570 | // | ||
| 560 | // The default bindings for this signal are | 571 | // The default bindings for this signal are | ||
| 561 | // <kbd>Backspace</kbd> and <kbd>Shift</kbd>-<kbd>Backspace</kbd>. | 572 | // <kbd>Backspace</kbd> and <kbd>Shift</kbd>-<kbd>Backspace</kbd>. | ||
| 562 | - | func (x *Text) ConnectBackspace(cb func(Text)) uint32 { | 573 | + | func (x *Text) ConnectBackspace(cb *func(Text)) uint32 { |
| 574 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 575 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 576 | + | return gobject.SignalConnect(x.GoPointer(), "backspace", cbRefPtr) | |||
| 577 | + | } | |||
| 578 | + | ||||
| 563 | fcb := func(clsPtr uintptr) { | 579 | fcb := func(clsPtr uintptr) { | ||
| 564 | fa := Text{} | 580 | fa := Text{} | ||
| 565 | fa.Ptr = clsPtr | 581 | fa.Ptr = clsPtr | ||
| 582 | + | cbFn := *cb | |||
| 566 | 583 | ||||
| 567 | - | cb(fa) | 584 | + | cbFn(fa) |
| 568 | 585 | ||||
| 569 | } | 586 | } | ||
| 570 | - | return gobject.SignalConnect(x.GoPointer(), "backspace", purego.NewCallback(fcb)) | 587 | + | cbRefPtr := purego.NewCallback(fcb) |
| 588 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 589 | + | return gobject.SignalConnect(x.GoPointer(), "backspace", cbRefPtr) | |||
| 571 | } | 590 | } | ||
| 572 | 591 | ||||
| 573 | // Emitted to copy the selection to the clipboard. | 592 | // Emitted to copy the selection to the clipboard. | ||
| @@ -577,15 +596,23 @@ func (x *Text) ConnectBackspace(cb func(Text)) uint32 { | |||||
| 577 | // The default bindings for this signal are | 596 | // The default bindings for this signal are | ||
| 578 | // <kbd>Ctrl</kbd>-<kbd>c</kbd> and | 597 | // <kbd>Ctrl</kbd>-<kbd>c</kbd> and | ||
| 579 | // <kbd>Ctrl</kbd>-<kbd>Insert</kbd>. | 598 | // <kbd>Ctrl</kbd>-<kbd>Insert</kbd>. | ||
| 580 | - | func (x *Text) ConnectCopyClipboard(cb func(Text)) uint32 { | 599 | + | func (x *Text) ConnectCopyClipboard(cb *func(Text)) uint32 { |
| 600 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 601 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 602 | + | return gobject.SignalConnect(x.GoPointer(), "copy-clipboard", cbRefPtr) | |||
| 603 | + | } | |||
| 604 | + | ||||
| 581 | fcb := func(clsPtr uintptr) { | 605 | fcb := func(clsPtr uintptr) { | ||
| 582 | fa := Text{} | 606 | fa := Text{} | ||
| 583 | fa.Ptr = clsPtr | 607 | fa.Ptr = clsPtr | ||
| 608 | + | cbFn := *cb | |||
| 584 | 609 | ||||
| 585 | - | cb(fa) | 610 | + | cbFn(fa) |
| 586 | 611 | ||||
| 587 | } | 612 | } | ||
| 588 | - | return gobject.SignalConnect(x.GoPointer(), "copy-clipboard", purego.NewCallback(fcb)) | 613 | + | cbRefPtr := purego.NewCallback(fcb) |
| 614 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 615 | + | return gobject.SignalConnect(x.GoPointer(), "copy-clipboard", cbRefPtr) | |||
| 589 | } | 616 | } | ||
| 590 | 617 | ||||
| 591 | // Emitted to cut the selection to the clipboard. | 618 | // Emitted to cut the selection to the clipboard. | ||
| @@ -595,15 +622,23 @@ func (x *Text) ConnectCopyClipboard(cb func(Text)) uint32 { | |||||
| 595 | // The default bindings for this signal are | 622 | // The default bindings for this signal are | ||
| 596 | // <kbd>Ctrl</kbd>-<kbd>x</kbd> and | 623 | // <kbd>Ctrl</kbd>-<kbd>x</kbd> and | ||
| 597 | // <kbd>Shift</kbd>-<kbd>Delete</kbd>. | 624 | // <kbd>Shift</kbd>-<kbd>Delete</kbd>. | ||
| 598 | - | func (x *Text) ConnectCutClipboard(cb func(Text)) uint32 { | 625 | + | func (x *Text) ConnectCutClipboard(cb *func(Text)) uint32 { |
| 626 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 627 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 628 | + | return gobject.SignalConnect(x.GoPointer(), "cut-clipboard", cbRefPtr) | |||
| 629 | + | } | |||
| 630 | + | ||||
| 599 | fcb := func(clsPtr uintptr) { | 631 | fcb := func(clsPtr uintptr) { | ||
| 600 | fa := Text{} | 632 | fa := Text{} | ||
| 601 | fa.Ptr = clsPtr | 633 | fa.Ptr = clsPtr | ||
| 634 | + | cbFn := *cb | |||
| 602 | 635 | ||||
| 603 | - | cb(fa) | 636 | + | cbFn(fa) |
| 604 | 637 | ||||
| 605 | } | 638 | } | ||
| 606 | - | return gobject.SignalConnect(x.GoPointer(), "cut-clipboard", purego.NewCallback(fcb)) | 639 | + | cbRefPtr := purego.NewCallback(fcb) |
| 640 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 641 | + | return gobject.SignalConnect(x.GoPointer(), "cut-clipboard", cbRefPtr) | |||
| 607 | } | 642 | } | ||
| 608 | 643 | ||||
| 609 | // Emitted when the user initiates a text deletion. | 644 | // Emitted when the user initiates a text deletion. | ||
| @@ -617,15 +652,23 @@ func (x *Text) ConnectCutClipboard(cb func(Text)) uint32 { | |||||
| 617 | // The default bindings for this signal are <kbd>Delete</kbd> | 652 | // The default bindings for this signal are <kbd>Delete</kbd> | ||
| 618 | // for deleting a character and <kbd>Ctrl</kbd>-<kbd>Delete</kbd> | 653 | // for deleting a character and <kbd>Ctrl</kbd>-<kbd>Delete</kbd> | ||
| 619 | // for deleting a word. | 654 | // for deleting a word. | ||
| 620 | - | func (x *Text) ConnectDeleteFromCursor(cb func(Text, DeleteType, int)) uint32 { | 655 | + | func (x *Text) ConnectDeleteFromCursor(cb *func(Text, DeleteType, int)) uint32 { |
| 656 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 657 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 658 | + | return gobject.SignalConnect(x.GoPointer(), "delete-from-cursor", cbRefPtr) | |||
| 659 | + | } | |||
| 660 | + | ||||
| 621 | fcb := func(clsPtr uintptr, TypeVarp DeleteType, CountVarp int) { | 661 | fcb := func(clsPtr uintptr, TypeVarp DeleteType, CountVarp int) { | ||
| 622 | fa := Text{} | 662 | fa := Text{} | ||
| 623 | fa.Ptr = clsPtr | 663 | fa.Ptr = clsPtr | ||
| 664 | + | cbFn := *cb | |||
| 624 | 665 | ||||
| 625 | - | cb(fa, TypeVarp, CountVarp) | 666 | + | cbFn(fa, TypeVarp, CountVarp) |
| 626 | 667 | ||||
| 627 | } | 668 | } | ||
| 628 | - | return gobject.SignalConnect(x.GoPointer(), "delete-from-cursor", purego.NewCallback(fcb)) | 669 | + | cbRefPtr := purego.NewCallback(fcb) |
| 670 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 671 | + | return gobject.SignalConnect(x.GoPointer(), "delete-from-cursor", cbRefPtr) | |||
| 629 | } | 672 | } | ||
| 630 | 673 | ||||
| 631 | // Emitted when the user initiates the insertion of a | 674 | // Emitted when the user initiates the insertion of a | ||
| @@ -634,15 +677,23 @@ func (x *Text) ConnectDeleteFromCursor(cb func(Text, DeleteType, int)) uint32 { | |||||
| 634 | // This is a [keybinding signal](class.SignalAction.html). | 677 | // This is a [keybinding signal](class.SignalAction.html). | ||
| 635 | // | 678 | // | ||
| 636 | // This signal has no default bindings. | 679 | // This signal has no default bindings. | ||
| 637 | - | func (x *Text) ConnectInsertAtCursor(cb func(Text, string)) uint32 { | 680 | + | func (x *Text) ConnectInsertAtCursor(cb *func(Text, string)) uint32 { |
| 681 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 682 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 683 | + | return gobject.SignalConnect(x.GoPointer(), "insert-at-cursor", cbRefPtr) | |||
| 684 | + | } | |||
| 685 | + | ||||
| 638 | fcb := func(clsPtr uintptr, StringVarp string) { | 686 | fcb := func(clsPtr uintptr, StringVarp string) { | ||
| 639 | fa := Text{} | 687 | fa := Text{} | ||
| 640 | fa.Ptr = clsPtr | 688 | fa.Ptr = clsPtr | ||
| 689 | + | cbFn := *cb | |||
| 641 | 690 | ||||
| 642 | - | cb(fa, StringVarp) | 691 | + | cbFn(fa, StringVarp) |
| 643 | 692 | ||||
| 644 | } | 693 | } | ||
| 645 | - | return gobject.SignalConnect(x.GoPointer(), "insert-at-cursor", purego.NewCallback(fcb)) | 694 | + | cbRefPtr := purego.NewCallback(fcb) |
| 695 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 696 | + | return gobject.SignalConnect(x.GoPointer(), "insert-at-cursor", cbRefPtr) | |||
| 646 | } | 697 | } | ||
| 647 | 698 | ||||
| 648 | // Emitted to present the Emoji chooser for the widget. | 699 | // Emitted to present the Emoji chooser for the widget. | ||
| @@ -652,15 +703,23 @@ func (x *Text) ConnectInsertAtCursor(cb func(Text, string)) uint32 { | |||||
| 652 | // The default bindings for this signal are | 703 | // The default bindings for this signal are | ||
| 653 | // <kbd>Ctrl</kbd>-<kbd>.</kbd> and | 704 | // <kbd>Ctrl</kbd>-<kbd>.</kbd> and | ||
| 654 | // <kbd>Ctrl</kbd>-<kbd>;</kbd> | 705 | // <kbd>Ctrl</kbd>-<kbd>;</kbd> | ||
| 655 | - | func (x *Text) ConnectInsertEmoji(cb func(Text)) uint32 { | 706 | + | func (x *Text) ConnectInsertEmoji(cb *func(Text)) uint32 { |
| 707 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 708 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 709 | + | return gobject.SignalConnect(x.GoPointer(), "insert-emoji", cbRefPtr) | |||
| 710 | + | } | |||
| 711 | + | ||||
| 656 | fcb := func(clsPtr uintptr) { | 712 | fcb := func(clsPtr uintptr) { | ||
| 657 | fa := Text{} | 713 | fa := Text{} | ||
| 658 | fa.Ptr = clsPtr | 714 | fa.Ptr = clsPtr | ||
| 715 | + | cbFn := *cb | |||
| 659 | 716 | ||||
| 660 | - | cb(fa) | 717 | + | cbFn(fa) |
| 661 | 718 | ||||
| 662 | } | 719 | } | ||
| 663 | - | return gobject.SignalConnect(x.GoPointer(), "insert-emoji", purego.NewCallback(fcb)) | 720 | + | cbRefPtr := purego.NewCallback(fcb) |
| 721 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 722 | + | return gobject.SignalConnect(x.GoPointer(), "insert-emoji", cbRefPtr) | |||
| 664 | } | 723 | } | ||
| 665 | 724 | ||||
| 666 | // Emitted when the user initiates a cursor movement. | 725 | // Emitted when the user initiates a cursor movement. | ||
| @@ -683,15 +742,23 @@ func (x *Text) ConnectInsertEmoji(cb func(Text)) uint32 { | |||||
| 683 | // move by individual characters/lines | 742 | // move by individual characters/lines | ||
| 684 | // - <kbd>Ctrl</kbd>-<kbd>→</kbd>, etc. move by words/paragraphs | 743 | // - <kbd>Ctrl</kbd>-<kbd>→</kbd>, etc. move by words/paragraphs | ||
| 685 | // - <kbd>Home</kbd>, <kbd>End</kbd> move to the ends of the buffer | 744 | // - <kbd>Home</kbd>, <kbd>End</kbd> move to the ends of the buffer | ||
| 686 | - | func (x *Text) ConnectMoveCursor(cb func(Text, MovementStep, int, bool)) uint32 { | 745 | + | func (x *Text) ConnectMoveCursor(cb *func(Text, MovementStep, int, bool)) uint32 { |
| 746 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 747 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 748 | + | return gobject.SignalConnect(x.GoPointer(), "move-cursor", cbRefPtr) | |||
| 749 | + | } | |||
| 750 | + | ||||
| 687 | fcb := func(clsPtr uintptr, StepVarp MovementStep, CountVarp int, ExtendVarp bool) { | 751 | fcb := func(clsPtr uintptr, StepVarp MovementStep, CountVarp int, ExtendVarp bool) { | ||
| 688 | fa := Text{} | 752 | fa := Text{} | ||
| 689 | fa.Ptr = clsPtr | 753 | fa.Ptr = clsPtr | ||
| 754 | + | cbFn := *cb | |||
| 690 | 755 | ||||
| 691 | - | cb(fa, StepVarp, CountVarp, ExtendVarp) | 756 | + | cbFn(fa, StepVarp, CountVarp, ExtendVarp) |
| 692 | 757 | ||||
| 693 | } | 758 | } | ||
| 694 | - | return gobject.SignalConnect(x.GoPointer(), "move-cursor", purego.NewCallback(fcb)) | 759 | + | cbRefPtr := purego.NewCallback(fcb) |
| 760 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 761 | + | return gobject.SignalConnect(x.GoPointer(), "move-cursor", cbRefPtr) | |||
| 695 | } | 762 | } | ||
| 696 | 763 | ||||
| 697 | // Emitted to paste the contents of the clipboard. | 764 | // Emitted to paste the contents of the clipboard. | ||
| @@ -700,15 +767,23 @@ func (x *Text) ConnectMoveCursor(cb func(Text, MovementStep, int, bool)) uint32 | |||||
| 700 | // | 767 | // | ||
| 701 | // The default bindings for this signal are | 768 | // The default bindings for this signal are | ||
| 702 | // <kbd>Ctrl</kbd>-<kbd>v</kbd> and <kbd>Shift</kbd>-<kbd>Insert</kbd>. | 769 | // <kbd>Ctrl</kbd>-<kbd>v</kbd> and <kbd>Shift</kbd>-<kbd>Insert</kbd>. | ||
| 703 | - | func (x *Text) ConnectPasteClipboard(cb func(Text)) uint32 { | 770 | + | func (x *Text) ConnectPasteClipboard(cb *func(Text)) uint32 { |
| 771 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 772 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 773 | + | return gobject.SignalConnect(x.GoPointer(), "paste-clipboard", cbRefPtr) | |||
| 774 | + | } | |||
| 775 | + | ||||
| 704 | fcb := func(clsPtr uintptr) { | 776 | fcb := func(clsPtr uintptr) { | ||
| 705 | fa := Text{} | 777 | fa := Text{} | ||
| 706 | fa.Ptr = clsPtr | 778 | fa.Ptr = clsPtr | ||
| 779 | + | cbFn := *cb | |||
| 707 | 780 | ||||
| 708 | - | cb(fa) | 781 | + | cbFn(fa) |
| 709 | 782 | ||||
| 710 | } | 783 | } | ||
| 711 | - | return gobject.SignalConnect(x.GoPointer(), "paste-clipboard", purego.NewCallback(fcb)) | 784 | + | cbRefPtr := purego.NewCallback(fcb) |
| 785 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 786 | + | return gobject.SignalConnect(x.GoPointer(), "paste-clipboard", cbRefPtr) | |||
| 712 | } | 787 | } | ||
| 713 | 788 | ||||
| 714 | // Emitted when the preedit text changes. | 789 | // Emitted when the preedit text changes. | ||
| @@ -716,15 +791,23 @@ func (x *Text) ConnectPasteClipboard(cb func(Text)) uint32 { | |||||
| 716 | // If an input method is used, the typed text will not immediately | 791 | // If an input method is used, the typed text will not immediately | ||
| 717 | // be committed to the buffer. So if you are interested in the text, | 792 | // be committed to the buffer. So if you are interested in the text, | ||
| 718 | // connect to this signal. | 793 | // connect to this signal. | ||
| 719 | - | func (x *Text) ConnectPreeditChanged(cb func(Text, string)) uint32 { | 794 | + | func (x *Text) ConnectPreeditChanged(cb *func(Text, string)) uint32 { |
| 795 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 796 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 797 | + | return gobject.SignalConnect(x.GoPointer(), "preedit-changed", cbRefPtr) | |||
| 798 | + | } | |||
| 799 | + | ||||
| 720 | fcb := func(clsPtr uintptr, PreeditVarp string) { | 800 | fcb := func(clsPtr uintptr, PreeditVarp string) { | ||
| 721 | fa := Text{} | 801 | fa := Text{} | ||
| 722 | fa.Ptr = clsPtr | 802 | fa.Ptr = clsPtr | ||
| 803 | + | cbFn := *cb | |||
| 723 | 804 | ||||
| 724 | - | cb(fa, PreeditVarp) | 805 | + | cbFn(fa, PreeditVarp) |
| 725 | 806 | ||||
| 726 | } | 807 | } | ||
| 727 | - | return gobject.SignalConnect(x.GoPointer(), "preedit-changed", purego.NewCallback(fcb)) | 808 | + | cbRefPtr := purego.NewCallback(fcb) |
| 809 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 810 | + | return gobject.SignalConnect(x.GoPointer(), "preedit-changed", cbRefPtr) | |||
| 728 | } | 811 | } | ||
| 729 | 812 | ||||
| 730 | // Emitted to toggle the overwrite mode of the `GtkText`. | 813 | // Emitted to toggle the overwrite mode of the `GtkText`. | ||
| @@ -732,15 +815,23 @@ func (x *Text) ConnectPreeditChanged(cb func(Text, string)) uint32 { | |||||
| 732 | // This is a [keybinding signal](class.SignalAction.html). | 815 | // This is a [keybinding signal](class.SignalAction.html). | ||
| 733 | // | 816 | // | ||
| 734 | // The default bindings for this signal is <kbd>Insert</kbd>. | 817 | // The default bindings for this signal is <kbd>Insert</kbd>. | ||
| 735 | - | func (x *Text) ConnectToggleOverwrite(cb func(Text)) uint32 { | 818 | + | func (x *Text) ConnectToggleOverwrite(cb *func(Text)) uint32 { |
| 819 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 820 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 821 | + | return gobject.SignalConnect(x.GoPointer(), "toggle-overwrite", cbRefPtr) | |||
| 822 | + | } | |||
| 823 | + | ||||
| 736 | fcb := func(clsPtr uintptr) { | 824 | fcb := func(clsPtr uintptr) { | ||
| 737 | fa := Text{} | 825 | fa := Text{} | ||
| 738 | fa.Ptr = clsPtr | 826 | fa.Ptr = clsPtr | ||
| 827 | + | cbFn := *cb | |||
| 739 | 828 | ||||
| 740 | - | cb(fa) | 829 | + | cbFn(fa) |
| 741 | 830 | ||||
| 742 | } | 831 | } | ||
| 743 | - | return gobject.SignalConnect(x.GoPointer(), "toggle-overwrite", purego.NewCallback(fcb)) | 832 | + | cbRefPtr := purego.NewCallback(fcb) |
| 833 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 834 | + | return gobject.SignalConnect(x.GoPointer(), "toggle-overwrite", cbRefPtr) | |||
| 744 | } | 835 | } | ||
| 745 | 836 | ||||
| 746 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 837 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/gtk/gtktextbuffer.go +166 -45
| @@ -7,6 +7,7 @@ import ( | |||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | ||
| 10 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | 11 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 11 | ) | 12 | ) | ||
| 12 | 13 | ||||
| @@ -1157,15 +1158,23 @@ func (c *TextBuffer) SetGoPointer(ptr uintptr) { | |||||
| 1157 | // [method@Gtk.TextBuffer.apply_tag], | 1158 | // [method@Gtk.TextBuffer.apply_tag], | ||
| 1158 | // [method@Gtk.TextBuffer.insert_with_tags], | 1159 | // [method@Gtk.TextBuffer.insert_with_tags], | ||
| 1159 | // [method@Gtk.TextBuffer.insert_range]. | 1160 | // [method@Gtk.TextBuffer.insert_range]. | ||
| 1160 | - | func (x *TextBuffer) ConnectApplyTag(cb func(TextBuffer, uintptr, uintptr, uintptr)) uint32 { | 1161 | + | func (x *TextBuffer) ConnectApplyTag(cb *func(TextBuffer, uintptr, uintptr, uintptr)) uint32 { |
| 1162 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1163 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1164 | + | return gobject.SignalConnect(x.GoPointer(), "apply-tag", cbRefPtr) | |||
| 1165 | + | } | |||
| 1166 | + | ||||
| 1161 | fcb := func(clsPtr uintptr, TagVarp uintptr, StartVarp uintptr, EndVarp uintptr) { | 1167 | fcb := func(clsPtr uintptr, TagVarp uintptr, StartVarp uintptr, EndVarp uintptr) { | ||
| 1162 | fa := TextBuffer{} | 1168 | fa := TextBuffer{} | ||
| 1163 | fa.Ptr = clsPtr | 1169 | fa.Ptr = clsPtr | ||
| 1170 | + | cbFn := *cb | |||
| 1164 | 1171 | ||||
| 1165 | - | cb(fa, TagVarp, StartVarp, EndVarp) | 1172 | + | cbFn(fa, TagVarp, StartVarp, EndVarp) |
| 1166 | 1173 | ||||
| 1167 | } | 1174 | } | ||
| 1168 | - | return gobject.SignalConnect(x.GoPointer(), "apply-tag", purego.NewCallback(fcb)) | 1175 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1176 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1177 | + | return gobject.SignalConnect(x.GoPointer(), "apply-tag", cbRefPtr) | |||
| 1169 | } | 1178 | } | ||
| 1170 | 1179 | ||||
| 1171 | // Emitted at the beginning of a single user-visible | 1180 | // Emitted at the beginning of a single user-visible | ||
| @@ -1178,27 +1187,43 @@ func (x *TextBuffer) ConnectApplyTag(cb func(TextBuffer, uintptr, uintptr, uintp | |||||
| 1178 | // [method@Gtk.TextBuffer.delete_interactive], | 1187 | // [method@Gtk.TextBuffer.delete_interactive], | ||
| 1179 | // [method@Gtk.TextBuffer.backspace], | 1188 | // [method@Gtk.TextBuffer.backspace], | ||
| 1180 | // [method@Gtk.TextBuffer.delete_selection]. | 1189 | // [method@Gtk.TextBuffer.delete_selection]. | ||
| 1181 | - | func (x *TextBuffer) ConnectBeginUserAction(cb func(TextBuffer)) uint32 { | 1190 | + | func (x *TextBuffer) ConnectBeginUserAction(cb *func(TextBuffer)) uint32 { |
| 1191 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1192 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1193 | + | return gobject.SignalConnect(x.GoPointer(), "begin-user-action", cbRefPtr) | |||
| 1194 | + | } | |||
| 1195 | + | ||||
| 1182 | fcb := func(clsPtr uintptr) { | 1196 | fcb := func(clsPtr uintptr) { | ||
| 1183 | fa := TextBuffer{} | 1197 | fa := TextBuffer{} | ||
| 1184 | fa.Ptr = clsPtr | 1198 | fa.Ptr = clsPtr | ||
| 1199 | + | cbFn := *cb | |||
| 1185 | 1200 | ||||
| 1186 | - | cb(fa) | 1201 | + | cbFn(fa) |
| 1187 | 1202 | ||||
| 1188 | } | 1203 | } | ||
| 1189 | - | return gobject.SignalConnect(x.GoPointer(), "begin-user-action", purego.NewCallback(fcb)) | 1204 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1205 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1206 | + | return gobject.SignalConnect(x.GoPointer(), "begin-user-action", cbRefPtr) | |||
| 1190 | } | 1207 | } | ||
| 1191 | 1208 | ||||
| 1192 | // Emitted when the content of a `GtkTextBuffer` has changed. | 1209 | // Emitted when the content of a `GtkTextBuffer` has changed. | ||
| 1193 | - | func (x *TextBuffer) ConnectChanged(cb func(TextBuffer)) uint32 { | 1210 | + | func (x *TextBuffer) ConnectChanged(cb *func(TextBuffer)) uint32 { |
| 1211 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1212 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1213 | + | return gobject.SignalConnect(x.GoPointer(), "changed", cbRefPtr) | |||
| 1214 | + | } | |||
| 1215 | + | ||||
| 1194 | fcb := func(clsPtr uintptr) { | 1216 | fcb := func(clsPtr uintptr) { | ||
| 1195 | fa := TextBuffer{} | 1217 | fa := TextBuffer{} | ||
| 1196 | fa.Ptr = clsPtr | 1218 | fa.Ptr = clsPtr | ||
| 1219 | + | cbFn := *cb | |||
| 1197 | 1220 | ||||
| 1198 | - | cb(fa) | 1221 | + | cbFn(fa) |
| 1199 | 1222 | ||||
| 1200 | } | 1223 | } | ||
| 1201 | - | return gobject.SignalConnect(x.GoPointer(), "changed", purego.NewCallback(fcb)) | 1224 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1225 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1226 | + | return gobject.SignalConnect(x.GoPointer(), "changed", cbRefPtr) | |||
| 1202 | } | 1227 | } | ||
| 1203 | 1228 | ||||
| 1204 | // Emitted to delete a range from a `GtkTextBuffer`. | 1229 | // Emitted to delete a range from a `GtkTextBuffer`. | ||
| @@ -1212,15 +1237,23 @@ func (x *TextBuffer) ConnectChanged(cb func(TextBuffer)) uint32 { | |||||
| 1212 | // the deleted text. | 1237 | // the deleted text. | ||
| 1213 | // | 1238 | // | ||
| 1214 | // See also: [method@Gtk.TextBuffer.delete]. | 1239 | // See also: [method@Gtk.TextBuffer.delete]. | ||
| 1215 | - | func (x *TextBuffer) ConnectDeleteRange(cb func(TextBuffer, uintptr, uintptr)) uint32 { | 1240 | + | func (x *TextBuffer) ConnectDeleteRange(cb *func(TextBuffer, uintptr, uintptr)) uint32 { |
| 1241 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1242 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1243 | + | return gobject.SignalConnect(x.GoPointer(), "delete-range", cbRefPtr) | |||
| 1244 | + | } | |||
| 1245 | + | ||||
| 1216 | fcb := func(clsPtr uintptr, StartVarp uintptr, EndVarp uintptr) { | 1246 | fcb := func(clsPtr uintptr, StartVarp uintptr, EndVarp uintptr) { | ||
| 1217 | fa := TextBuffer{} | 1247 | fa := TextBuffer{} | ||
| 1218 | fa.Ptr = clsPtr | 1248 | fa.Ptr = clsPtr | ||
| 1249 | + | cbFn := *cb | |||
| 1219 | 1250 | ||||
| 1220 | - | cb(fa, StartVarp, EndVarp) | 1251 | + | cbFn(fa, StartVarp, EndVarp) |
| 1221 | 1252 | ||||
| 1222 | } | 1253 | } | ||
| 1223 | - | return gobject.SignalConnect(x.GoPointer(), "delete-range", purego.NewCallback(fcb)) | 1254 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1255 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1256 | + | return gobject.SignalConnect(x.GoPointer(), "delete-range", cbRefPtr) | |||
| 1224 | } | 1257 | } | ||
| 1225 | 1258 | ||||
| 1226 | // Emitted at the end of a single user-visible | 1259 | // Emitted at the end of a single user-visible | ||
| @@ -1234,15 +1267,23 @@ func (x *TextBuffer) ConnectDeleteRange(cb func(TextBuffer, uintptr, uintptr)) u | |||||
| 1234 | // [method@Gtk.TextBuffer.backspace], | 1267 | // [method@Gtk.TextBuffer.backspace], | ||
| 1235 | // [method@Gtk.TextBuffer.delete_selection], | 1268 | // [method@Gtk.TextBuffer.delete_selection], | ||
| 1236 | // [method@Gtk.TextBuffer.backspace]. | 1269 | // [method@Gtk.TextBuffer.backspace]. | ||
| 1237 | - | func (x *TextBuffer) ConnectEndUserAction(cb func(TextBuffer)) uint32 { | 1270 | + | func (x *TextBuffer) ConnectEndUserAction(cb *func(TextBuffer)) uint32 { |
| 1271 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1272 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1273 | + | return gobject.SignalConnect(x.GoPointer(), "end-user-action", cbRefPtr) | |||
| 1274 | + | } | |||
| 1275 | + | ||||
| 1238 | fcb := func(clsPtr uintptr) { | 1276 | fcb := func(clsPtr uintptr) { | ||
| 1239 | fa := TextBuffer{} | 1277 | fa := TextBuffer{} | ||
| 1240 | fa.Ptr = clsPtr | 1278 | fa.Ptr = clsPtr | ||
| 1279 | + | cbFn := *cb | |||
| 1241 | 1280 | ||||
| 1242 | - | cb(fa) | 1281 | + | cbFn(fa) |
| 1243 | 1282 | ||||
| 1244 | } | 1283 | } | ||
| 1245 | - | return gobject.SignalConnect(x.GoPointer(), "end-user-action", purego.NewCallback(fcb)) | 1284 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1285 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1286 | + | return gobject.SignalConnect(x.GoPointer(), "end-user-action", cbRefPtr) | |||
| 1246 | } | 1287 | } | ||
| 1247 | 1288 | ||||
| 1248 | // Emitted to insert a `GtkTextChildAnchor` in a `GtkTextBuffer`. | 1289 | // Emitted to insert a `GtkTextChildAnchor` in a `GtkTextBuffer`. | ||
| @@ -1255,15 +1296,23 @@ func (x *TextBuffer) ConnectEndUserAction(cb func(TextBuffer)) uint32 { | |||||
| 1255 | // it to be placed after the inserted @anchor. | 1296 | // it to be placed after the inserted @anchor. | ||
| 1256 | // | 1297 | // | ||
| 1257 | // See also: [method@Gtk.TextBuffer.insert_child_anchor]. | 1298 | // See also: [method@Gtk.TextBuffer.insert_child_anchor]. | ||
| 1258 | - | func (x *TextBuffer) ConnectInsertChildAnchor(cb func(TextBuffer, uintptr, uintptr)) uint32 { | 1299 | + | func (x *TextBuffer) ConnectInsertChildAnchor(cb *func(TextBuffer, uintptr, uintptr)) uint32 { |
| 1300 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1301 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1302 | + | return gobject.SignalConnect(x.GoPointer(), "insert-child-anchor", cbRefPtr) | |||
| 1303 | + | } | |||
| 1304 | + | ||||
| 1259 | fcb := func(clsPtr uintptr, LocationVarp uintptr, AnchorVarp uintptr) { | 1305 | fcb := func(clsPtr uintptr, LocationVarp uintptr, AnchorVarp uintptr) { | ||
| 1260 | fa := TextBuffer{} | 1306 | fa := TextBuffer{} | ||
| 1261 | fa.Ptr = clsPtr | 1307 | fa.Ptr = clsPtr | ||
| 1308 | + | cbFn := *cb | |||
| 1262 | 1309 | ||||
| 1263 | - | cb(fa, LocationVarp, AnchorVarp) | 1310 | + | cbFn(fa, LocationVarp, AnchorVarp) |
| 1264 | 1311 | ||||
| 1265 | } | 1312 | } | ||
| 1266 | - | return gobject.SignalConnect(x.GoPointer(), "insert-child-anchor", purego.NewCallback(fcb)) | 1313 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1314 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1315 | + | return gobject.SignalConnect(x.GoPointer(), "insert-child-anchor", cbRefPtr) | |||
| 1267 | } | 1316 | } | ||
| 1268 | 1317 | ||||
| 1269 | // Emitted to insert a `GdkPaintable` in a `GtkTextBuffer`. | 1318 | // Emitted to insert a `GdkPaintable` in a `GtkTextBuffer`. | ||
| @@ -1276,15 +1325,23 @@ func (x *TextBuffer) ConnectInsertChildAnchor(cb func(TextBuffer, uintptr, uintp | |||||
| 1276 | // it to be placed after the inserted @paintable. | 1325 | // it to be placed after the inserted @paintable. | ||
| 1277 | // | 1326 | // | ||
| 1278 | // See also: [method@Gtk.TextBuffer.insert_paintable]. | 1327 | // See also: [method@Gtk.TextBuffer.insert_paintable]. | ||
| 1279 | - | func (x *TextBuffer) ConnectInsertPaintable(cb func(TextBuffer, uintptr, uintptr)) uint32 { | 1328 | + | func (x *TextBuffer) ConnectInsertPaintable(cb *func(TextBuffer, uintptr, uintptr)) uint32 { |
| 1329 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1330 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1331 | + | return gobject.SignalConnect(x.GoPointer(), "insert-paintable", cbRefPtr) | |||
| 1332 | + | } | |||
| 1333 | + | ||||
| 1280 | fcb := func(clsPtr uintptr, LocationVarp uintptr, PaintableVarp uintptr) { | 1334 | fcb := func(clsPtr uintptr, LocationVarp uintptr, PaintableVarp uintptr) { | ||
| 1281 | fa := TextBuffer{} | 1335 | fa := TextBuffer{} | ||
| 1282 | fa.Ptr = clsPtr | 1336 | fa.Ptr = clsPtr | ||
| 1337 | + | cbFn := *cb | |||
| 1283 | 1338 | ||||
| 1284 | - | cb(fa, LocationVarp, PaintableVarp) | 1339 | + | cbFn(fa, LocationVarp, PaintableVarp) |
| 1285 | 1340 | ||||
| 1286 | } | 1341 | } | ||
| 1287 | - | return gobject.SignalConnect(x.GoPointer(), "insert-paintable", purego.NewCallback(fcb)) | 1342 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1343 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1344 | + | return gobject.SignalConnect(x.GoPointer(), "insert-paintable", cbRefPtr) | |||
| 1288 | } | 1345 | } | ||
| 1289 | 1346 | ||||
| 1290 | // Emitted to insert text in a `GtkTextBuffer`. | 1347 | // Emitted to insert text in a `GtkTextBuffer`. | ||
| @@ -1298,29 +1355,45 @@ func (x *TextBuffer) ConnectInsertPaintable(cb func(TextBuffer, uintptr, uintptr | |||||
| 1298 | // | 1355 | // | ||
| 1299 | // See also: [method@Gtk.TextBuffer.insert], | 1356 | // See also: [method@Gtk.TextBuffer.insert], | ||
| 1300 | // [method@Gtk.TextBuffer.insert_range]. | 1357 | // [method@Gtk.TextBuffer.insert_range]. | ||
| 1301 | - | func (x *TextBuffer) ConnectInsertText(cb func(TextBuffer, uintptr, string, int)) uint32 { | 1358 | + | func (x *TextBuffer) ConnectInsertText(cb *func(TextBuffer, uintptr, string, int)) uint32 { |
| 1359 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1360 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1361 | + | return gobject.SignalConnect(x.GoPointer(), "insert-text", cbRefPtr) | |||
| 1362 | + | } | |||
| 1363 | + | ||||
| 1302 | fcb := func(clsPtr uintptr, LocationVarp uintptr, TextVarp string, LenVarp int) { | 1364 | fcb := func(clsPtr uintptr, LocationVarp uintptr, TextVarp string, LenVarp int) { | ||
| 1303 | fa := TextBuffer{} | 1365 | fa := TextBuffer{} | ||
| 1304 | fa.Ptr = clsPtr | 1366 | fa.Ptr = clsPtr | ||
| 1367 | + | cbFn := *cb | |||
| 1305 | 1368 | ||||
| 1306 | - | cb(fa, LocationVarp, TextVarp, LenVarp) | 1369 | + | cbFn(fa, LocationVarp, TextVarp, LenVarp) |
| 1307 | 1370 | ||||
| 1308 | } | 1371 | } | ||
| 1309 | - | return gobject.SignalConnect(x.GoPointer(), "insert-text", purego.NewCallback(fcb)) | 1372 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1373 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1374 | + | return gobject.SignalConnect(x.GoPointer(), "insert-text", cbRefPtr) | |||
| 1310 | } | 1375 | } | ||
| 1311 | 1376 | ||||
| 1312 | // Emitted as notification after a `GtkTextMark` is deleted. | 1377 | // Emitted as notification after a `GtkTextMark` is deleted. | ||
| 1313 | // | 1378 | // | ||
| 1314 | // See also: [method@Gtk.TextBuffer.delete_mark]. | 1379 | // See also: [method@Gtk.TextBuffer.delete_mark]. | ||
| 1315 | - | func (x *TextBuffer) ConnectMarkDeleted(cb func(TextBuffer, uintptr)) uint32 { | 1380 | + | func (x *TextBuffer) ConnectMarkDeleted(cb *func(TextBuffer, uintptr)) uint32 { |
| 1381 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1382 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1383 | + | return gobject.SignalConnect(x.GoPointer(), "mark-deleted", cbRefPtr) | |||
| 1384 | + | } | |||
| 1385 | + | ||||
| 1316 | fcb := func(clsPtr uintptr, MarkVarp uintptr) { | 1386 | fcb := func(clsPtr uintptr, MarkVarp uintptr) { | ||
| 1317 | fa := TextBuffer{} | 1387 | fa := TextBuffer{} | ||
| 1318 | fa.Ptr = clsPtr | 1388 | fa.Ptr = clsPtr | ||
| 1389 | + | cbFn := *cb | |||
| 1319 | 1390 | ||||
| 1320 | - | cb(fa, MarkVarp) | 1391 | + | cbFn(fa, MarkVarp) |
| 1321 | 1392 | ||||
| 1322 | } | 1393 | } | ||
| 1323 | - | return gobject.SignalConnect(x.GoPointer(), "mark-deleted", purego.NewCallback(fcb)) | 1394 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1395 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1396 | + | return gobject.SignalConnect(x.GoPointer(), "mark-deleted", cbRefPtr) | |||
| 1324 | } | 1397 | } | ||
| 1325 | 1398 | ||||
| 1326 | // Emitted as notification after a `GtkTextMark` is set. | 1399 | // Emitted as notification after a `GtkTextMark` is set. | ||
| @@ -1328,29 +1401,45 @@ func (x *TextBuffer) ConnectMarkDeleted(cb func(TextBuffer, uintptr)) uint32 { | |||||
| 1328 | // See also: | 1401 | // See also: | ||
| 1329 | // [method@Gtk.TextBuffer.create_mark], | 1402 | // [method@Gtk.TextBuffer.create_mark], | ||
| 1330 | // [method@Gtk.TextBuffer.move_mark]. | 1403 | // [method@Gtk.TextBuffer.move_mark]. | ||
| 1331 | - | func (x *TextBuffer) ConnectMarkSet(cb func(TextBuffer, uintptr, uintptr)) uint32 { | 1404 | + | func (x *TextBuffer) ConnectMarkSet(cb *func(TextBuffer, uintptr, uintptr)) uint32 { |
| 1405 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1406 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1407 | + | return gobject.SignalConnect(x.GoPointer(), "mark-set", cbRefPtr) | |||
| 1408 | + | } | |||
| 1409 | + | ||||
| 1332 | fcb := func(clsPtr uintptr, LocationVarp uintptr, MarkVarp uintptr) { | 1410 | fcb := func(clsPtr uintptr, LocationVarp uintptr, MarkVarp uintptr) { | ||
| 1333 | fa := TextBuffer{} | 1411 | fa := TextBuffer{} | ||
| 1334 | fa.Ptr = clsPtr | 1412 | fa.Ptr = clsPtr | ||
| 1413 | + | cbFn := *cb | |||
| 1335 | 1414 | ||||
| 1336 | - | cb(fa, LocationVarp, MarkVarp) | 1415 | + | cbFn(fa, LocationVarp, MarkVarp) |
| 1337 | 1416 | ||||
| 1338 | } | 1417 | } | ||
| 1339 | - | return gobject.SignalConnect(x.GoPointer(), "mark-set", purego.NewCallback(fcb)) | 1418 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1419 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1420 | + | return gobject.SignalConnect(x.GoPointer(), "mark-set", cbRefPtr) | |||
| 1340 | } | 1421 | } | ||
| 1341 | 1422 | ||||
| 1342 | // Emitted when the modified bit of a `GtkTextBuffer` flips. | 1423 | // Emitted when the modified bit of a `GtkTextBuffer` flips. | ||
| 1343 | // | 1424 | // | ||
| 1344 | // See also: [method@Gtk.TextBuffer.set_modified]. | 1425 | // See also: [method@Gtk.TextBuffer.set_modified]. | ||
| 1345 | - | func (x *TextBuffer) ConnectModifiedChanged(cb func(TextBuffer)) uint32 { | 1426 | + | func (x *TextBuffer) ConnectModifiedChanged(cb *func(TextBuffer)) uint32 { |
| 1427 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1428 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1429 | + | return gobject.SignalConnect(x.GoPointer(), "modified-changed", cbRefPtr) | |||
| 1430 | + | } | |||
| 1431 | + | ||||
| 1346 | fcb := func(clsPtr uintptr) { | 1432 | fcb := func(clsPtr uintptr) { | ||
| 1347 | fa := TextBuffer{} | 1433 | fa := TextBuffer{} | ||
| 1348 | fa.Ptr = clsPtr | 1434 | fa.Ptr = clsPtr | ||
| 1435 | + | cbFn := *cb | |||
| 1349 | 1436 | ||||
| 1350 | - | cb(fa) | 1437 | + | cbFn(fa) |
| 1351 | 1438 | ||||
| 1352 | } | 1439 | } | ||
| 1353 | - | return gobject.SignalConnect(x.GoPointer(), "modified-changed", purego.NewCallback(fcb)) | 1440 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1441 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1442 | + | return gobject.SignalConnect(x.GoPointer(), "modified-changed", cbRefPtr) | |||
| 1354 | } | 1443 | } | ||
| 1355 | 1444 | ||||
| 1356 | // Emitted after paste operation has been completed. | 1445 | // Emitted after paste operation has been completed. | ||
| @@ -1358,28 +1447,44 @@ func (x *TextBuffer) ConnectModifiedChanged(cb func(TextBuffer)) uint32 { | |||||
| 1358 | // This is useful to properly scroll the view to the end | 1447 | // This is useful to properly scroll the view to the end | ||
| 1359 | // of the pasted text. See [method@Gtk.TextBuffer.paste_clipboard] | 1448 | // of the pasted text. See [method@Gtk.TextBuffer.paste_clipboard] | ||
| 1360 | // for more details. | 1449 | // for more details. | ||
| 1361 | - | func (x *TextBuffer) ConnectPasteDone(cb func(TextBuffer, uintptr)) uint32 { | 1450 | + | func (x *TextBuffer) ConnectPasteDone(cb *func(TextBuffer, uintptr)) uint32 { |
| 1451 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1452 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1453 | + | return gobject.SignalConnect(x.GoPointer(), "paste-done", cbRefPtr) | |||
| 1454 | + | } | |||
| 1455 | + | ||||
| 1362 | fcb := func(clsPtr uintptr, ClipboardVarp uintptr) { | 1456 | fcb := func(clsPtr uintptr, ClipboardVarp uintptr) { | ||
| 1363 | fa := TextBuffer{} | 1457 | fa := TextBuffer{} | ||
| 1364 | fa.Ptr = clsPtr | 1458 | fa.Ptr = clsPtr | ||
| 1459 | + | cbFn := *cb | |||
| 1365 | 1460 | ||||
| 1366 | - | cb(fa, ClipboardVarp) | 1461 | + | cbFn(fa, ClipboardVarp) |
| 1367 | 1462 | ||||
| 1368 | } | 1463 | } | ||
| 1369 | - | return gobject.SignalConnect(x.GoPointer(), "paste-done", purego.NewCallback(fcb)) | 1464 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1465 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1466 | + | return gobject.SignalConnect(x.GoPointer(), "paste-done", cbRefPtr) | |||
| 1370 | } | 1467 | } | ||
| 1371 | 1468 | ||||
| 1372 | // Emitted when a request has been made to redo the | 1469 | // Emitted when a request has been made to redo the | ||
| 1373 | // previously undone operation. | 1470 | // previously undone operation. | ||
| 1374 | - | func (x *TextBuffer) ConnectRedo(cb func(TextBuffer)) uint32 { | 1471 | + | func (x *TextBuffer) ConnectRedo(cb *func(TextBuffer)) uint32 { |
| 1472 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1473 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1474 | + | return gobject.SignalConnect(x.GoPointer(), "redo", cbRefPtr) | |||
| 1475 | + | } | |||
| 1476 | + | ||||
| 1375 | fcb := func(clsPtr uintptr) { | 1477 | fcb := func(clsPtr uintptr) { | ||
| 1376 | fa := TextBuffer{} | 1478 | fa := TextBuffer{} | ||
| 1377 | fa.Ptr = clsPtr | 1479 | fa.Ptr = clsPtr | ||
| 1480 | + | cbFn := *cb | |||
| 1378 | 1481 | ||||
| 1379 | - | cb(fa) | 1482 | + | cbFn(fa) |
| 1380 | 1483 | ||||
| 1381 | } | 1484 | } | ||
| 1382 | - | return gobject.SignalConnect(x.GoPointer(), "redo", purego.NewCallback(fcb)) | 1485 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1486 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1487 | + | return gobject.SignalConnect(x.GoPointer(), "redo", cbRefPtr) | |||
| 1383 | } | 1488 | } | ||
| 1384 | 1489 | ||||
| 1385 | // Emitted to remove all occurrences of @tag from a range | 1490 | // Emitted to remove all occurrences of @tag from a range | ||
| @@ -1392,29 +1497,45 @@ func (x *TextBuffer) ConnectRedo(cb func(TextBuffer)) uint32 { | |||||
| 1392 | // to revalidate them). | 1497 | // to revalidate them). | ||
| 1393 | // | 1498 | // | ||
| 1394 | // See also: [method@Gtk.TextBuffer.remove_tag]. | 1499 | // See also: [method@Gtk.TextBuffer.remove_tag]. | ||
| 1395 | - | func (x *TextBuffer) ConnectRemoveTag(cb func(TextBuffer, uintptr, uintptr, uintptr)) uint32 { | 1500 | + | func (x *TextBuffer) ConnectRemoveTag(cb *func(TextBuffer, uintptr, uintptr, uintptr)) uint32 { |
| 1501 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1502 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1503 | + | return gobject.SignalConnect(x.GoPointer(), "remove-tag", cbRefPtr) | |||
| 1504 | + | } | |||
| 1505 | + | ||||
| 1396 | fcb := func(clsPtr uintptr, TagVarp uintptr, StartVarp uintptr, EndVarp uintptr) { | 1506 | fcb := func(clsPtr uintptr, TagVarp uintptr, StartVarp uintptr, EndVarp uintptr) { | ||
| 1397 | fa := TextBuffer{} | 1507 | fa := TextBuffer{} | ||
| 1398 | fa.Ptr = clsPtr | 1508 | fa.Ptr = clsPtr | ||
| 1509 | + | cbFn := *cb | |||
| 1399 | 1510 | ||||
| 1400 | - | cb(fa, TagVarp, StartVarp, EndVarp) | 1511 | + | cbFn(fa, TagVarp, StartVarp, EndVarp) |
| 1401 | 1512 | ||||
| 1402 | } | 1513 | } | ||
| 1403 | - | return gobject.SignalConnect(x.GoPointer(), "remove-tag", purego.NewCallback(fcb)) | 1514 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1515 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1516 | + | return gobject.SignalConnect(x.GoPointer(), "remove-tag", cbRefPtr) | |||
| 1404 | } | 1517 | } | ||
| 1405 | 1518 | ||||
| 1406 | // Emitted when a request has been made to undo the | 1519 | // Emitted when a request has been made to undo the | ||
| 1407 | // previous operation or set of operations that have | 1520 | // previous operation or set of operations that have | ||
| 1408 | // been grouped together. | 1521 | // been grouped together. | ||
| 1409 | - | func (x *TextBuffer) ConnectUndo(cb func(TextBuffer)) uint32 { | 1522 | + | func (x *TextBuffer) ConnectUndo(cb *func(TextBuffer)) uint32 { |
| 1523 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1524 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1525 | + | return gobject.SignalConnect(x.GoPointer(), "undo", cbRefPtr) | |||
| 1526 | + | } | |||
| 1527 | + | ||||
| 1410 | fcb := func(clsPtr uintptr) { | 1528 | fcb := func(clsPtr uintptr) { | ||
| 1411 | fa := TextBuffer{} | 1529 | fa := TextBuffer{} | ||
| 1412 | fa.Ptr = clsPtr | 1530 | fa.Ptr = clsPtr | ||
| 1531 | + | cbFn := *cb | |||
| 1413 | 1532 | ||||
| 1414 | - | cb(fa) | 1533 | + | cbFn(fa) |
| 1415 | 1534 | ||||
| 1416 | } | 1535 | } | ||
| 1417 | - | return gobject.SignalConnect(x.GoPointer(), "undo", purego.NewCallback(fcb)) | 1536 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1537 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1538 | + | return gobject.SignalConnect(x.GoPointer(), "undo", cbRefPtr) | |||
| 1418 | } | 1539 | } | ||
| 1419 | 1540 | ||||
| 1420 | func init() { | 1541 | func init() { | ||
M v4/gtk/gtktextiter.go +4 -4
| @@ -124,9 +124,9 @@ var xTextIterBackwardFindChar func(uintptr, uintptr, uintptr, *TextIter) bool | |||||
| 124 | 124 | ||||
| 125 | // Same as gtk_text_iter_forward_find_char(), | 125 | // Same as gtk_text_iter_forward_find_char(), | ||
| 126 | // but goes backward from @iter. | 126 | // but goes backward from @iter. | ||
| 127 | - | func (x *TextIter) BackwardFindChar(PredVar TextCharPredicate, UserDataVar uintptr, LimitVar *TextIter) bool { | 127 | + | func (x *TextIter) BackwardFindChar(PredVar *TextCharPredicate, UserDataVar uintptr, LimitVar *TextIter) bool { |
| 128 | 128 | ||||
| 129 | - | cret := xTextIterBackwardFindChar(x.GoPointer(), purego.NewCallback(PredVar), UserDataVar, LimitVar) | 129 | + | cret := xTextIterBackwardFindChar(x.GoPointer(), glib.NewCallback(PredVar), UserDataVar, LimitVar) |
| 130 | return cret | 130 | return cret | ||
| 131 | } | 131 | } | ||
| 132 | 132 | ||||
| @@ -539,9 +539,9 @@ var xTextIterForwardFindChar func(uintptr, uintptr, uintptr, *TextIter) bool | |||||
| 539 | // If @pred returns %TRUE, returns %TRUE and stops scanning. | 539 | // If @pred returns %TRUE, returns %TRUE and stops scanning. | ||
| 540 | // If @pred never returns %TRUE, @iter is set to @limit if | 540 | // If @pred never returns %TRUE, @iter is set to @limit if | ||
| 541 | // @limit is non-%NULL, otherwise to the end iterator. | 541 | // @limit is non-%NULL, otherwise to the end iterator. | ||
| 542 | - | func (x *TextIter) ForwardFindChar(PredVar TextCharPredicate, UserDataVar uintptr, LimitVar *TextIter) bool { | 542 | + | func (x *TextIter) ForwardFindChar(PredVar *TextCharPredicate, UserDataVar uintptr, LimitVar *TextIter) bool { |
| 543 | 543 | ||||
| 544 | - | cret := xTextIterForwardFindChar(x.GoPointer(), purego.NewCallback(PredVar), UserDataVar, LimitVar) | 544 | + | cret := xTextIterForwardFindChar(x.GoPointer(), glib.NewCallback(PredVar), UserDataVar, LimitVar) |
| 545 | return cret | 545 | return cret | ||
| 546 | } | 546 | } | ||
| 547 | 547 | ||||
M v4/gtk/gtktexttagtable.go +38 -11
| @@ -2,8 +2,11 @@ | |||||
| 2 | package gtk | 2 | package gtk | ||
| 3 | 3 | ||||
| 4 | import ( | 4 | import ( | ||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 5 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 6 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 7 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 8 | ) | 11 | ) | ||
| 9 | 12 | ||||
| @@ -82,9 +85,9 @@ var xTextTagTableForeach func(uintptr, uintptr, uintptr) | |||||
| 82 | // | 85 | // | ||
| 83 | // Note that the table may not be modified while iterating | 86 | // Note that the table may not be modified while iterating | ||
| 84 | // over it (you can’t add/remove tags). | 87 | // over it (you can’t add/remove tags). | ||
| 85 | - | func (x *TextTagTable) Foreach(FuncVar TextTagTableForeach, DataVar uintptr) { | 88 | + | func (x *TextTagTable) Foreach(FuncVar *TextTagTableForeach, DataVar uintptr) { |
| 86 | 89 | ||||
| 87 | - | xTextTagTableForeach(x.GoPointer(), purego.NewCallback(FuncVar), DataVar) | 90 | + | xTextTagTableForeach(x.GoPointer(), glib.NewCallback(FuncVar), DataVar) |
| 88 | 91 | ||||
| 89 | } | 92 | } | ||
| 90 | 93 | ||||
| @@ -137,42 +140,66 @@ func (c *TextTagTable) SetGoPointer(ptr uintptr) { | |||||
| 137 | } | 140 | } | ||
| 138 | 141 | ||||
| 139 | // Emitted every time a new tag is added in the `GtkTextTagTable`. | 142 | // Emitted every time a new tag is added in the `GtkTextTagTable`. | ||
| 140 | - | func (x *TextTagTable) ConnectTagAdded(cb func(TextTagTable, uintptr)) uint32 { | 143 | + | func (x *TextTagTable) ConnectTagAdded(cb *func(TextTagTable, uintptr)) uint32 { |
| 144 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 145 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 146 | + | return gobject.SignalConnect(x.GoPointer(), "tag-added", cbRefPtr) | |||
| 147 | + | } | |||
| 148 | + | ||||
| 141 | fcb := func(clsPtr uintptr, TagVarp uintptr) { | 149 | fcb := func(clsPtr uintptr, TagVarp uintptr) { | ||
| 142 | fa := TextTagTable{} | 150 | fa := TextTagTable{} | ||
| 143 | fa.Ptr = clsPtr | 151 | fa.Ptr = clsPtr | ||
| 152 | + | cbFn := *cb | |||
| 144 | 153 | ||||
| 145 | - | cb(fa, TagVarp) | 154 | + | cbFn(fa, TagVarp) |
| 146 | 155 | ||||
| 147 | } | 156 | } | ||
| 148 | - | return gobject.SignalConnect(x.GoPointer(), "tag-added", purego.NewCallback(fcb)) | 157 | + | cbRefPtr := purego.NewCallback(fcb) |
| 158 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 159 | + | return gobject.SignalConnect(x.GoPointer(), "tag-added", cbRefPtr) | |||
| 149 | } | 160 | } | ||
| 150 | 161 | ||||
| 151 | // Emitted every time a tag in the `GtkTextTagTable` changes. | 162 | // Emitted every time a tag in the `GtkTextTagTable` changes. | ||
| 152 | - | func (x *TextTagTable) ConnectTagChanged(cb func(TextTagTable, uintptr, bool)) uint32 { | 163 | + | func (x *TextTagTable) ConnectTagChanged(cb *func(TextTagTable, uintptr, bool)) uint32 { |
| 164 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 165 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 166 | + | return gobject.SignalConnect(x.GoPointer(), "tag-changed", cbRefPtr) | |||
| 167 | + | } | |||
| 168 | + | ||||
| 153 | fcb := func(clsPtr uintptr, TagVarp uintptr, SizeChangedVarp bool) { | 169 | fcb := func(clsPtr uintptr, TagVarp uintptr, SizeChangedVarp bool) { | ||
| 154 | fa := TextTagTable{} | 170 | fa := TextTagTable{} | ||
| 155 | fa.Ptr = clsPtr | 171 | fa.Ptr = clsPtr | ||
| 172 | + | cbFn := *cb | |||
| 156 | 173 | ||||
| 157 | - | cb(fa, TagVarp, SizeChangedVarp) | 174 | + | cbFn(fa, TagVarp, SizeChangedVarp) |
| 158 | 175 | ||||
| 159 | } | 176 | } | ||
| 160 | - | return gobject.SignalConnect(x.GoPointer(), "tag-changed", purego.NewCallback(fcb)) | 177 | + | cbRefPtr := purego.NewCallback(fcb) |
| 178 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 179 | + | return gobject.SignalConnect(x.GoPointer(), "tag-changed", cbRefPtr) | |||
| 161 | } | 180 | } | ||
| 162 | 181 | ||||
| 163 | // Emitted every time a tag is removed from the `GtkTextTagTable`. | 182 | // Emitted every time a tag is removed from the `GtkTextTagTable`. | ||
| 164 | // | 183 | // | ||
| 165 | // The @tag is still valid by the time the signal is emitted, but | 184 | // The @tag is still valid by the time the signal is emitted, but | ||
| 166 | // it is not associated with a tag table any more. | 185 | // it is not associated with a tag table any more. | ||
| 167 | - | func (x *TextTagTable) ConnectTagRemoved(cb func(TextTagTable, uintptr)) uint32 { | 186 | + | func (x *TextTagTable) ConnectTagRemoved(cb *func(TextTagTable, uintptr)) uint32 { |
| 187 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 188 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 189 | + | return gobject.SignalConnect(x.GoPointer(), "tag-removed", cbRefPtr) | |||
| 190 | + | } | |||
| 191 | + | ||||
| 168 | fcb := func(clsPtr uintptr, TagVarp uintptr) { | 192 | fcb := func(clsPtr uintptr, TagVarp uintptr) { | ||
| 169 | fa := TextTagTable{} | 193 | fa := TextTagTable{} | ||
| 170 | fa.Ptr = clsPtr | 194 | fa.Ptr = clsPtr | ||
| 195 | + | cbFn := *cb | |||
| 171 | 196 | ||||
| 172 | - | cb(fa, TagVarp) | 197 | + | cbFn(fa, TagVarp) |
| 173 | 198 | ||||
| 174 | } | 199 | } | ||
| 175 | - | return gobject.SignalConnect(x.GoPointer(), "tag-removed", purego.NewCallback(fcb)) | 200 | + | cbRefPtr := purego.NewCallback(fcb) |
| 201 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 202 | + | return gobject.SignalConnect(x.GoPointer(), "tag-removed", cbRefPtr) | |||
| 176 | } | 203 | } | ||
| 177 | 204 | ||||
| 178 | // Gets the ID of the @buildable object. | 205 | // Gets the ID of the @buildable object. | ||
M v4/gtk/gtktextview.go +166 -45
| @@ -8,6 +8,7 @@ import ( | |||||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | 9 | "github.com/jwijenbergh/puregotk/v4/gdk" | ||
| 10 | "github.com/jwijenbergh/puregotk/v4/gio" | 10 | "github.com/jwijenbergh/puregotk/v4/gio" | ||
| 11 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 11 | "github.com/jwijenbergh/puregotk/v4/gobject" | 12 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 12 | "github.com/jwijenbergh/puregotk/v4/pango" | 13 | "github.com/jwijenbergh/puregotk/v4/pango" | ||
| 13 | ) | 14 | ) | ||
| @@ -1137,15 +1138,23 @@ func (c *TextView) SetGoPointer(ptr uintptr) { | |||||
| 1137 | // | 1138 | // | ||
| 1138 | // The default bindings for this signal are | 1139 | // The default bindings for this signal are | ||
| 1139 | // <kbd>Backspace</kbd> and <kbd>Shift</kbd>-<kbd>Backspace</kbd>. | 1140 | // <kbd>Backspace</kbd> and <kbd>Shift</kbd>-<kbd>Backspace</kbd>. | ||
| 1140 | - | func (x *TextView) ConnectBackspace(cb func(TextView)) uint32 { | 1141 | + | func (x *TextView) ConnectBackspace(cb *func(TextView)) uint32 { |
| 1142 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1143 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1144 | + | return gobject.SignalConnect(x.GoPointer(), "backspace", cbRefPtr) | |||
| 1145 | + | } | |||
| 1146 | + | ||||
| 1141 | fcb := func(clsPtr uintptr) { | 1147 | fcb := func(clsPtr uintptr) { | ||
| 1142 | fa := TextView{} | 1148 | fa := TextView{} | ||
| 1143 | fa.Ptr = clsPtr | 1149 | fa.Ptr = clsPtr | ||
| 1150 | + | cbFn := *cb | |||
| 1144 | 1151 | ||||
| 1145 | - | cb(fa) | 1152 | + | cbFn(fa) |
| 1146 | 1153 | ||||
| 1147 | } | 1154 | } | ||
| 1148 | - | return gobject.SignalConnect(x.GoPointer(), "backspace", purego.NewCallback(fcb)) | 1155 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1156 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1157 | + | return gobject.SignalConnect(x.GoPointer(), "backspace", cbRefPtr) | |||
| 1149 | } | 1158 | } | ||
| 1150 | 1159 | ||||
| 1151 | // Gets emitted to copy the selection to the clipboard. | 1160 | // Gets emitted to copy the selection to the clipboard. | ||
| @@ -1155,15 +1164,23 @@ func (x *TextView) ConnectBackspace(cb func(TextView)) uint32 { | |||||
| 1155 | // The default bindings for this signal are | 1164 | // The default bindings for this signal are | ||
| 1156 | // <kbd>Ctrl</kbd>-<kbd>c</kbd> and | 1165 | // <kbd>Ctrl</kbd>-<kbd>c</kbd> and | ||
| 1157 | // <kbd>Ctrl</kbd>-<kbd>Insert</kbd>. | 1166 | // <kbd>Ctrl</kbd>-<kbd>Insert</kbd>. | ||
| 1158 | - | func (x *TextView) ConnectCopyClipboard(cb func(TextView)) uint32 { | 1167 | + | func (x *TextView) ConnectCopyClipboard(cb *func(TextView)) uint32 { |
| 1168 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1169 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1170 | + | return gobject.SignalConnect(x.GoPointer(), "copy-clipboard", cbRefPtr) | |||
| 1171 | + | } | |||
| 1172 | + | ||||
| 1159 | fcb := func(clsPtr uintptr) { | 1173 | fcb := func(clsPtr uintptr) { | ||
| 1160 | fa := TextView{} | 1174 | fa := TextView{} | ||
| 1161 | fa.Ptr = clsPtr | 1175 | fa.Ptr = clsPtr | ||
| 1176 | + | cbFn := *cb | |||
| 1162 | 1177 | ||||
| 1163 | - | cb(fa) | 1178 | + | cbFn(fa) |
| 1164 | 1179 | ||||
| 1165 | } | 1180 | } | ||
| 1166 | - | return gobject.SignalConnect(x.GoPointer(), "copy-clipboard", purego.NewCallback(fcb)) | 1181 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1182 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1183 | + | return gobject.SignalConnect(x.GoPointer(), "copy-clipboard", cbRefPtr) | |||
| 1167 | } | 1184 | } | ||
| 1168 | 1185 | ||||
| 1169 | // Gets emitted to cut the selection to the clipboard. | 1186 | // Gets emitted to cut the selection to the clipboard. | ||
| @@ -1173,15 +1190,23 @@ func (x *TextView) ConnectCopyClipboard(cb func(TextView)) uint32 { | |||||
| 1173 | // The default bindings for this signal are | 1190 | // The default bindings for this signal are | ||
| 1174 | // <kbd>Ctrl</kbd>-<kbd>x</kbd> and | 1191 | // <kbd>Ctrl</kbd>-<kbd>x</kbd> and | ||
| 1175 | // <kbd>Shift</kbd>-<kbd>Delete</kbd>. | 1192 | // <kbd>Shift</kbd>-<kbd>Delete</kbd>. | ||
| 1176 | - | func (x *TextView) ConnectCutClipboard(cb func(TextView)) uint32 { | 1193 | + | func (x *TextView) ConnectCutClipboard(cb *func(TextView)) uint32 { |
| 1194 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1195 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1196 | + | return gobject.SignalConnect(x.GoPointer(), "cut-clipboard", cbRefPtr) | |||
| 1197 | + | } | |||
| 1198 | + | ||||
| 1177 | fcb := func(clsPtr uintptr) { | 1199 | fcb := func(clsPtr uintptr) { | ||
| 1178 | fa := TextView{} | 1200 | fa := TextView{} | ||
| 1179 | fa.Ptr = clsPtr | 1201 | fa.Ptr = clsPtr | ||
| 1202 | + | cbFn := *cb | |||
| 1180 | 1203 | ||||
| 1181 | - | cb(fa) | 1204 | + | cbFn(fa) |
| 1182 | 1205 | ||||
| 1183 | } | 1206 | } | ||
| 1184 | - | return gobject.SignalConnect(x.GoPointer(), "cut-clipboard", purego.NewCallback(fcb)) | 1207 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1208 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1209 | + | return gobject.SignalConnect(x.GoPointer(), "cut-clipboard", cbRefPtr) | |||
| 1185 | } | 1210 | } | ||
| 1186 | 1211 | ||||
| 1187 | // Gets emitted when the user initiates a text deletion. | 1212 | // Gets emitted when the user initiates a text deletion. | ||
| @@ -1196,27 +1221,43 @@ func (x *TextView) ConnectCutClipboard(cb func(TextView)) uint32 { | |||||
| 1196 | // deleting a character, <kbd>Ctrl</kbd>-<kbd>Delete</kbd> for | 1221 | // deleting a character, <kbd>Ctrl</kbd>-<kbd>Delete</kbd> for | ||
| 1197 | // deleting a word and <kbd>Ctrl</kbd>-<kbd>Backspace</kbd> for | 1222 | // deleting a word and <kbd>Ctrl</kbd>-<kbd>Backspace</kbd> for | ||
| 1198 | // deleting a word backwards. | 1223 | // deleting a word backwards. | ||
| 1199 | - | func (x *TextView) ConnectDeleteFromCursor(cb func(TextView, DeleteType, int)) uint32 { | 1224 | + | func (x *TextView) ConnectDeleteFromCursor(cb *func(TextView, DeleteType, int)) uint32 { |
| 1225 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1226 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1227 | + | return gobject.SignalConnect(x.GoPointer(), "delete-from-cursor", cbRefPtr) | |||
| 1228 | + | } | |||
| 1229 | + | ||||
| 1200 | fcb := func(clsPtr uintptr, TypeVarp DeleteType, CountVarp int) { | 1230 | fcb := func(clsPtr uintptr, TypeVarp DeleteType, CountVarp int) { | ||
| 1201 | fa := TextView{} | 1231 | fa := TextView{} | ||
| 1202 | fa.Ptr = clsPtr | 1232 | fa.Ptr = clsPtr | ||
| 1233 | + | cbFn := *cb | |||
| 1203 | 1234 | ||||
| 1204 | - | cb(fa, TypeVarp, CountVarp) | 1235 | + | cbFn(fa, TypeVarp, CountVarp) |
| 1205 | 1236 | ||||
| 1206 | } | 1237 | } | ||
| 1207 | - | return gobject.SignalConnect(x.GoPointer(), "delete-from-cursor", purego.NewCallback(fcb)) | 1238 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1239 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1240 | + | return gobject.SignalConnect(x.GoPointer(), "delete-from-cursor", cbRefPtr) | |||
| 1208 | } | 1241 | } | ||
| 1209 | 1242 | ||||
| 1210 | // Emitted when the selection needs to be extended at @location. | 1243 | // Emitted when the selection needs to be extended at @location. | ||
| 1211 | - | func (x *TextView) ConnectExtendSelection(cb func(TextView, TextExtendSelection, uintptr, uintptr, uintptr) bool) uint32 { | 1244 | + | func (x *TextView) ConnectExtendSelection(cb *func(TextView, TextExtendSelection, uintptr, uintptr, uintptr) bool) uint32 { |
| 1245 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1246 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1247 | + | return gobject.SignalConnect(x.GoPointer(), "extend-selection", cbRefPtr) | |||
| 1248 | + | } | |||
| 1249 | + | ||||
| 1212 | fcb := func(clsPtr uintptr, GranularityVarp TextExtendSelection, LocationVarp uintptr, StartVarp uintptr, EndVarp uintptr) bool { | 1250 | fcb := func(clsPtr uintptr, GranularityVarp TextExtendSelection, LocationVarp uintptr, StartVarp uintptr, EndVarp uintptr) bool { | ||
| 1213 | fa := TextView{} | 1251 | fa := TextView{} | ||
| 1214 | fa.Ptr = clsPtr | 1252 | fa.Ptr = clsPtr | ||
| 1253 | + | cbFn := *cb | |||
| 1215 | 1254 | ||||
| 1216 | - | return cb(fa, GranularityVarp, LocationVarp, StartVarp, EndVarp) | 1255 | + | return cbFn(fa, GranularityVarp, LocationVarp, StartVarp, EndVarp) |
| 1217 | 1256 | ||||
| 1218 | } | 1257 | } | ||
| 1219 | - | return gobject.SignalConnect(x.GoPointer(), "extend-selection", purego.NewCallback(fcb)) | 1258 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1259 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1260 | + | return gobject.SignalConnect(x.GoPointer(), "extend-selection", cbRefPtr) | |||
| 1220 | } | 1261 | } | ||
| 1221 | 1262 | ||||
| 1222 | // Gets emitted when the user initiates the insertion of a | 1263 | // Gets emitted when the user initiates the insertion of a | ||
| @@ -1225,15 +1266,23 @@ func (x *TextView) ConnectExtendSelection(cb func(TextView, TextExtendSelection, | |||||
| 1225 | // The ::insert-at-cursor signal is a [keybinding signal](class.SignalAction.html). | 1266 | // The ::insert-at-cursor signal is a [keybinding signal](class.SignalAction.html). | ||
| 1226 | // | 1267 | // | ||
| 1227 | // This signal has no default bindings. | 1268 | // This signal has no default bindings. | ||
| 1228 | - | func (x *TextView) ConnectInsertAtCursor(cb func(TextView, string)) uint32 { | 1269 | + | func (x *TextView) ConnectInsertAtCursor(cb *func(TextView, string)) uint32 { |
| 1270 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1271 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1272 | + | return gobject.SignalConnect(x.GoPointer(), "insert-at-cursor", cbRefPtr) | |||
| 1273 | + | } | |||
| 1274 | + | ||||
| 1229 | fcb := func(clsPtr uintptr, StringVarp string) { | 1275 | fcb := func(clsPtr uintptr, StringVarp string) { | ||
| 1230 | fa := TextView{} | 1276 | fa := TextView{} | ||
| 1231 | fa.Ptr = clsPtr | 1277 | fa.Ptr = clsPtr | ||
| 1278 | + | cbFn := *cb | |||
| 1232 | 1279 | ||||
| 1233 | - | cb(fa, StringVarp) | 1280 | + | cbFn(fa, StringVarp) |
| 1234 | 1281 | ||||
| 1235 | } | 1282 | } | ||
| 1236 | - | return gobject.SignalConnect(x.GoPointer(), "insert-at-cursor", purego.NewCallback(fcb)) | 1283 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1284 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1285 | + | return gobject.SignalConnect(x.GoPointer(), "insert-at-cursor", cbRefPtr) | |||
| 1237 | } | 1286 | } | ||
| 1238 | 1287 | ||||
| 1239 | // Gets emitted to present the Emoji chooser for the @text_view. | 1288 | // Gets emitted to present the Emoji chooser for the @text_view. | ||
| @@ -1243,15 +1292,23 @@ func (x *TextView) ConnectInsertAtCursor(cb func(TextView, string)) uint32 { | |||||
| 1243 | // The default bindings for this signal are | 1292 | // The default bindings for this signal are | ||
| 1244 | // <kbd>Ctrl</kbd>-<kbd>.</kbd> and | 1293 | // <kbd>Ctrl</kbd>-<kbd>.</kbd> and | ||
| 1245 | // <kbd>Ctrl</kbd>-<kbd>;</kbd> | 1294 | // <kbd>Ctrl</kbd>-<kbd>;</kbd> | ||
| 1246 | - | func (x *TextView) ConnectInsertEmoji(cb func(TextView)) uint32 { | 1295 | + | func (x *TextView) ConnectInsertEmoji(cb *func(TextView)) uint32 { |
| 1296 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1297 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1298 | + | return gobject.SignalConnect(x.GoPointer(), "insert-emoji", cbRefPtr) | |||
| 1299 | + | } | |||
| 1300 | + | ||||
| 1247 | fcb := func(clsPtr uintptr) { | 1301 | fcb := func(clsPtr uintptr) { | ||
| 1248 | fa := TextView{} | 1302 | fa := TextView{} | ||
| 1249 | fa.Ptr = clsPtr | 1303 | fa.Ptr = clsPtr | ||
| 1304 | + | cbFn := *cb | |||
| 1250 | 1305 | ||||
| 1251 | - | cb(fa) | 1306 | + | cbFn(fa) |
| 1252 | 1307 | ||||
| 1253 | } | 1308 | } | ||
| 1254 | - | return gobject.SignalConnect(x.GoPointer(), "insert-emoji", purego.NewCallback(fcb)) | 1309 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1310 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1311 | + | return gobject.SignalConnect(x.GoPointer(), "insert-emoji", cbRefPtr) | |||
| 1255 | } | 1312 | } | ||
| 1256 | 1313 | ||||
| 1257 | // Gets emitted when the user initiates a cursor movement. | 1314 | // Gets emitted when the user initiates a cursor movement. | ||
| @@ -1276,15 +1333,23 @@ func (x *TextView) ConnectInsertEmoji(cb func(TextView)) uint32 { | |||||
| 1276 | // - <kbd>PgUp</kbd>, <kbd>PgDn</kbd> move vertically by pages | 1333 | // - <kbd>PgUp</kbd>, <kbd>PgDn</kbd> move vertically by pages | ||
| 1277 | // - <kbd>Ctrl</kbd>-<kbd>PgUp</kbd>, <kbd>Ctrl</kbd>-<kbd>PgDn</kbd> | 1334 | // - <kbd>Ctrl</kbd>-<kbd>PgUp</kbd>, <kbd>Ctrl</kbd>-<kbd>PgDn</kbd> | ||
| 1278 | // move horizontally by pages | 1335 | // move horizontally by pages | ||
| 1279 | - | func (x *TextView) ConnectMoveCursor(cb func(TextView, MovementStep, int, bool)) uint32 { | 1336 | + | func (x *TextView) ConnectMoveCursor(cb *func(TextView, MovementStep, int, bool)) uint32 { |
| 1337 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1338 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1339 | + | return gobject.SignalConnect(x.GoPointer(), "move-cursor", cbRefPtr) | |||
| 1340 | + | } | |||
| 1341 | + | ||||
| 1280 | fcb := func(clsPtr uintptr, StepVarp MovementStep, CountVarp int, ExtendSelectionVarp bool) { | 1342 | fcb := func(clsPtr uintptr, StepVarp MovementStep, CountVarp int, ExtendSelectionVarp bool) { | ||
| 1281 | fa := TextView{} | 1343 | fa := TextView{} | ||
| 1282 | fa.Ptr = clsPtr | 1344 | fa.Ptr = clsPtr | ||
| 1345 | + | cbFn := *cb | |||
| 1283 | 1346 | ||||
| 1284 | - | cb(fa, StepVarp, CountVarp, ExtendSelectionVarp) | 1347 | + | cbFn(fa, StepVarp, CountVarp, ExtendSelectionVarp) |
| 1285 | 1348 | ||||
| 1286 | } | 1349 | } | ||
| 1287 | - | return gobject.SignalConnect(x.GoPointer(), "move-cursor", purego.NewCallback(fcb)) | 1350 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1351 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1352 | + | return gobject.SignalConnect(x.GoPointer(), "move-cursor", cbRefPtr) | |||
| 1288 | } | 1353 | } | ||
| 1289 | 1354 | ||||
| 1290 | // Gets emitted to move the viewport. | 1355 | // Gets emitted to move the viewport. | ||
| @@ -1295,15 +1360,23 @@ func (x *TextView) ConnectMoveCursor(cb func(TextView, MovementStep, int, bool)) | |||||
| 1295 | // window. | 1360 | // window. | ||
| 1296 | // | 1361 | // | ||
| 1297 | // There are no default bindings for this signal. | 1362 | // There are no default bindings for this signal. | ||
| 1298 | - | func (x *TextView) ConnectMoveViewport(cb func(TextView, ScrollStep, int)) uint32 { | 1363 | + | func (x *TextView) ConnectMoveViewport(cb *func(TextView, ScrollStep, int)) uint32 { |
| 1364 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1365 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1366 | + | return gobject.SignalConnect(x.GoPointer(), "move-viewport", cbRefPtr) | |||
| 1367 | + | } | |||
| 1368 | + | ||||
| 1299 | fcb := func(clsPtr uintptr, StepVarp ScrollStep, CountVarp int) { | 1369 | fcb := func(clsPtr uintptr, StepVarp ScrollStep, CountVarp int) { | ||
| 1300 | fa := TextView{} | 1370 | fa := TextView{} | ||
| 1301 | fa.Ptr = clsPtr | 1371 | fa.Ptr = clsPtr | ||
| 1372 | + | cbFn := *cb | |||
| 1302 | 1373 | ||||
| 1303 | - | cb(fa, StepVarp, CountVarp) | 1374 | + | cbFn(fa, StepVarp, CountVarp) |
| 1304 | 1375 | ||||
| 1305 | } | 1376 | } | ||
| 1306 | - | return gobject.SignalConnect(x.GoPointer(), "move-viewport", purego.NewCallback(fcb)) | 1377 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1378 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1379 | + | return gobject.SignalConnect(x.GoPointer(), "move-viewport", cbRefPtr) | |||
| 1307 | } | 1380 | } | ||
| 1308 | 1381 | ||||
| 1309 | // Gets emitted to paste the contents of the clipboard | 1382 | // Gets emitted to paste the contents of the clipboard | ||
| @@ -1314,15 +1387,23 @@ func (x *TextView) ConnectMoveViewport(cb func(TextView, ScrollStep, int)) uint3 | |||||
| 1314 | // The default bindings for this signal are | 1387 | // The default bindings for this signal are | ||
| 1315 | // <kbd>Ctrl</kbd>-<kbd>v</kbd> and | 1388 | // <kbd>Ctrl</kbd>-<kbd>v</kbd> and | ||
| 1316 | // <kbd>Shift</kbd>-<kbd>Insert</kbd>. | 1389 | // <kbd>Shift</kbd>-<kbd>Insert</kbd>. | ||
| 1317 | - | func (x *TextView) ConnectPasteClipboard(cb func(TextView)) uint32 { | 1390 | + | func (x *TextView) ConnectPasteClipboard(cb *func(TextView)) uint32 { |
| 1391 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1392 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1393 | + | return gobject.SignalConnect(x.GoPointer(), "paste-clipboard", cbRefPtr) | |||
| 1394 | + | } | |||
| 1395 | + | ||||
| 1318 | fcb := func(clsPtr uintptr) { | 1396 | fcb := func(clsPtr uintptr) { | ||
| 1319 | fa := TextView{} | 1397 | fa := TextView{} | ||
| 1320 | fa.Ptr = clsPtr | 1398 | fa.Ptr = clsPtr | ||
| 1399 | + | cbFn := *cb | |||
| 1321 | 1400 | ||||
| 1322 | - | cb(fa) | 1401 | + | cbFn(fa) |
| 1323 | 1402 | ||||
| 1324 | } | 1403 | } | ||
| 1325 | - | return gobject.SignalConnect(x.GoPointer(), "paste-clipboard", purego.NewCallback(fcb)) | 1404 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1405 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1406 | + | return gobject.SignalConnect(x.GoPointer(), "paste-clipboard", cbRefPtr) | |||
| 1326 | } | 1407 | } | ||
| 1327 | 1408 | ||||
| 1328 | // Emitted when preedit text of the active IM changes. | 1409 | // Emitted when preedit text of the active IM changes. | ||
| @@ -1333,15 +1414,23 @@ func (x *TextView) ConnectPasteClipboard(cb func(TextView)) uint32 { | |||||
| 1333 | // | 1414 | // | ||
| 1334 | // This signal is only emitted if the text at the given position | 1415 | // This signal is only emitted if the text at the given position | ||
| 1335 | // is actually editable. | 1416 | // is actually editable. | ||
| 1336 | - | func (x *TextView) ConnectPreeditChanged(cb func(TextView, string)) uint32 { | 1417 | + | func (x *TextView) ConnectPreeditChanged(cb *func(TextView, string)) uint32 { |
| 1418 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1419 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1420 | + | return gobject.SignalConnect(x.GoPointer(), "preedit-changed", cbRefPtr) | |||
| 1421 | + | } | |||
| 1422 | + | ||||
| 1337 | fcb := func(clsPtr uintptr, PreeditVarp string) { | 1423 | fcb := func(clsPtr uintptr, PreeditVarp string) { | ||
| 1338 | fa := TextView{} | 1424 | fa := TextView{} | ||
| 1339 | fa.Ptr = clsPtr | 1425 | fa.Ptr = clsPtr | ||
| 1426 | + | cbFn := *cb | |||
| 1340 | 1427 | ||||
| 1341 | - | cb(fa, PreeditVarp) | 1428 | + | cbFn(fa, PreeditVarp) |
| 1342 | 1429 | ||||
| 1343 | } | 1430 | } | ||
| 1344 | - | return gobject.SignalConnect(x.GoPointer(), "preedit-changed", purego.NewCallback(fcb)) | 1431 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1432 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1433 | + | return gobject.SignalConnect(x.GoPointer(), "preedit-changed", cbRefPtr) | |||
| 1345 | } | 1434 | } | ||
| 1346 | 1435 | ||||
| 1347 | // Gets emitted to select or unselect the complete contents of the text view. | 1436 | // Gets emitted to select or unselect the complete contents of the text view. | ||
| @@ -1353,15 +1442,23 @@ func (x *TextView) ConnectPreeditChanged(cb func(TextView, string)) uint32 { | |||||
| 1353 | // <kbd>Ctrl</kbd>-<kbd>/</kbd> for selecting and | 1442 | // <kbd>Ctrl</kbd>-<kbd>/</kbd> for selecting and | ||
| 1354 | // <kbd>Shift</kbd>-<kbd>Ctrl</kbd>-<kbd>a</kbd> and | 1443 | // <kbd>Shift</kbd>-<kbd>Ctrl</kbd>-<kbd>a</kbd> and | ||
| 1355 | // <kbd>Ctrl</kbd>-<kbd>\</kbd> for unselecting. | 1444 | // <kbd>Ctrl</kbd>-<kbd>\</kbd> for unselecting. | ||
| 1356 | - | func (x *TextView) ConnectSelectAll(cb func(TextView, bool)) uint32 { | 1445 | + | func (x *TextView) ConnectSelectAll(cb *func(TextView, bool)) uint32 { |
| 1446 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1447 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1448 | + | return gobject.SignalConnect(x.GoPointer(), "select-all", cbRefPtr) | |||
| 1449 | + | } | |||
| 1450 | + | ||||
| 1357 | fcb := func(clsPtr uintptr, SelectVarp bool) { | 1451 | fcb := func(clsPtr uintptr, SelectVarp bool) { | ||
| 1358 | fa := TextView{} | 1452 | fa := TextView{} | ||
| 1359 | fa.Ptr = clsPtr | 1453 | fa.Ptr = clsPtr | ||
| 1454 | + | cbFn := *cb | |||
| 1360 | 1455 | ||||
| 1361 | - | cb(fa, SelectVarp) | 1456 | + | cbFn(fa, SelectVarp) |
| 1362 | 1457 | ||||
| 1363 | } | 1458 | } | ||
| 1364 | - | return gobject.SignalConnect(x.GoPointer(), "select-all", purego.NewCallback(fcb)) | 1459 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1460 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1461 | + | return gobject.SignalConnect(x.GoPointer(), "select-all", cbRefPtr) | |||
| 1365 | } | 1462 | } | ||
| 1366 | 1463 | ||||
| 1367 | // Gets emitted when the user initiates settings the "anchor" mark. | 1464 | // Gets emitted when the user initiates settings the "anchor" mark. | ||
| @@ -1372,15 +1469,23 @@ func (x *TextView) ConnectSelectAll(cb func(TextView, bool)) uint32 { | |||||
| 1372 | // "insert" mark. | 1469 | // "insert" mark. | ||
| 1373 | // | 1470 | // | ||
| 1374 | // This signal has no default bindings. | 1471 | // This signal has no default bindings. | ||
| 1375 | - | func (x *TextView) ConnectSetAnchor(cb func(TextView)) uint32 { | 1472 | + | func (x *TextView) ConnectSetAnchor(cb *func(TextView)) uint32 { |
| 1473 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1474 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1475 | + | return gobject.SignalConnect(x.GoPointer(), "set-anchor", cbRefPtr) | |||
| 1476 | + | } | |||
| 1477 | + | ||||
| 1376 | fcb := func(clsPtr uintptr) { | 1478 | fcb := func(clsPtr uintptr) { | ||
| 1377 | fa := TextView{} | 1479 | fa := TextView{} | ||
| 1378 | fa.Ptr = clsPtr | 1480 | fa.Ptr = clsPtr | ||
| 1481 | + | cbFn := *cb | |||
| 1379 | 1482 | ||||
| 1380 | - | cb(fa) | 1483 | + | cbFn(fa) |
| 1381 | 1484 | ||||
| 1382 | } | 1485 | } | ||
| 1383 | - | return gobject.SignalConnect(x.GoPointer(), "set-anchor", purego.NewCallback(fcb)) | 1486 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1487 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1488 | + | return gobject.SignalConnect(x.GoPointer(), "set-anchor", cbRefPtr) | |||
| 1384 | } | 1489 | } | ||
| 1385 | 1490 | ||||
| 1386 | // Gets emitted to toggle the `cursor-visible` property. | 1491 | // Gets emitted to toggle the `cursor-visible` property. | ||
| @@ -1389,15 +1494,23 @@ func (x *TextView) ConnectSetAnchor(cb func(TextView)) uint32 { | |||||
| 1389 | // [keybinding signal](class.SignalAction.html). | 1494 | // [keybinding signal](class.SignalAction.html). | ||
| 1390 | // | 1495 | // | ||
| 1391 | // The default binding for this signal is <kbd>F7</kbd>. | 1496 | // The default binding for this signal is <kbd>F7</kbd>. | ||
| 1392 | - | func (x *TextView) ConnectToggleCursorVisible(cb func(TextView)) uint32 { | 1497 | + | func (x *TextView) ConnectToggleCursorVisible(cb *func(TextView)) uint32 { |
| 1498 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1499 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1500 | + | return gobject.SignalConnect(x.GoPointer(), "toggle-cursor-visible", cbRefPtr) | |||
| 1501 | + | } | |||
| 1502 | + | ||||
| 1393 | fcb := func(clsPtr uintptr) { | 1503 | fcb := func(clsPtr uintptr) { | ||
| 1394 | fa := TextView{} | 1504 | fa := TextView{} | ||
| 1395 | fa.Ptr = clsPtr | 1505 | fa.Ptr = clsPtr | ||
| 1506 | + | cbFn := *cb | |||
| 1396 | 1507 | ||||
| 1397 | - | cb(fa) | 1508 | + | cbFn(fa) |
| 1398 | 1509 | ||||
| 1399 | } | 1510 | } | ||
| 1400 | - | return gobject.SignalConnect(x.GoPointer(), "toggle-cursor-visible", purego.NewCallback(fcb)) | 1511 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1512 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1513 | + | return gobject.SignalConnect(x.GoPointer(), "toggle-cursor-visible", cbRefPtr) | |||
| 1401 | } | 1514 | } | ||
| 1402 | 1515 | ||||
| 1403 | // Gets emitted to toggle the overwrite mode of the text view. | 1516 | // Gets emitted to toggle the overwrite mode of the text view. | ||
| @@ -1405,15 +1518,23 @@ func (x *TextView) ConnectToggleCursorVisible(cb func(TextView)) uint32 { | |||||
| 1405 | // The ::toggle-overwrite signal is a [keybinding signal](class.SignalAction.html). | 1518 | // The ::toggle-overwrite signal is a [keybinding signal](class.SignalAction.html). | ||
| 1406 | // | 1519 | // | ||
| 1407 | // The default binding for this signal is <kbd>Insert</kbd>. | 1520 | // The default binding for this signal is <kbd>Insert</kbd>. | ||
| 1408 | - | func (x *TextView) ConnectToggleOverwrite(cb func(TextView)) uint32 { | 1521 | + | func (x *TextView) ConnectToggleOverwrite(cb *func(TextView)) uint32 { |
| 1522 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1523 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1524 | + | return gobject.SignalConnect(x.GoPointer(), "toggle-overwrite", cbRefPtr) | |||
| 1525 | + | } | |||
| 1526 | + | ||||
| 1409 | fcb := func(clsPtr uintptr) { | 1527 | fcb := func(clsPtr uintptr) { | ||
| 1410 | fa := TextView{} | 1528 | fa := TextView{} | ||
| 1411 | fa.Ptr = clsPtr | 1529 | fa.Ptr = clsPtr | ||
| 1530 | + | cbFn := *cb | |||
| 1412 | 1531 | ||||
| 1413 | - | cb(fa) | 1532 | + | cbFn(fa) |
| 1414 | 1533 | ||||
| 1415 | } | 1534 | } | ||
| 1416 | - | return gobject.SignalConnect(x.GoPointer(), "toggle-overwrite", purego.NewCallback(fcb)) | 1535 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1536 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1537 | + | return gobject.SignalConnect(x.GoPointer(), "toggle-overwrite", cbRefPtr) | |||
| 1417 | } | 1538 | } | ||
| 1418 | 1539 | ||||
| 1419 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 1540 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/gtk/gtktogglebutton.go +11 -3
| @@ -227,15 +227,23 @@ func (c *ToggleButton) SetGoPointer(ptr uintptr) { | |||||
| 227 | } | 227 | } | ||
| 228 | 228 | ||||
| 229 | // Emitted whenever the `GtkToggleButton`'s state is changed. | 229 | // Emitted whenever the `GtkToggleButton`'s state is changed. | ||
| 230 | - | func (x *ToggleButton) ConnectToggled(cb func(ToggleButton)) uint32 { | 230 | + | func (x *ToggleButton) ConnectToggled(cb *func(ToggleButton)) uint32 { |
| 231 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 232 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 233 | + | return gobject.SignalConnect(x.GoPointer(), "toggled", cbRefPtr) | |||
| 234 | + | } | |||
| 235 | + | ||||
| 231 | fcb := func(clsPtr uintptr) { | 236 | fcb := func(clsPtr uintptr) { | ||
| 232 | fa := ToggleButton{} | 237 | fa := ToggleButton{} | ||
| 233 | fa.Ptr = clsPtr | 238 | fa.Ptr = clsPtr | ||
| 239 | + | cbFn := *cb | |||
| 234 | 240 | ||||
| 235 | - | cb(fa) | 241 | + | cbFn(fa) |
| 236 | 242 | ||||
| 237 | } | 243 | } | ||
| 238 | - | return gobject.SignalConnect(x.GoPointer(), "toggled", purego.NewCallback(fcb)) | 244 | + | cbRefPtr := purego.NewCallback(fcb) |
| 245 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 246 | + | return gobject.SignalConnect(x.GoPointer(), "toggled", cbRefPtr) | |||
| 239 | } | 247 | } | ||
| 240 | 248 | ||||
| 241 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 249 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/gtk/gtktreelistmodel.go +2 -2
| @@ -51,10 +51,10 @@ var xNewTreeListModel func(uintptr, bool, bool, uintptr, uintptr, uintptr) uintp | |||||
| 51 | 51 | ||||
| 52 | // Creates a new empty `GtkTreeListModel` displaying @root | 52 | // Creates a new empty `GtkTreeListModel` displaying @root | ||
| 53 | // with all rows collapsed. | 53 | // with all rows collapsed. | ||
| 54 | - | func NewTreeListModel(RootVar gio.ListModel, PassthroughVar bool, AutoexpandVar bool, CreateFuncVar TreeListModelCreateModelFunc, UserDataVar uintptr, UserDestroyVar glib.DestroyNotify) *TreeListModel { | 54 | + | func NewTreeListModel(RootVar gio.ListModel, PassthroughVar bool, AutoexpandVar bool, CreateFuncVar *TreeListModelCreateModelFunc, UserDataVar uintptr, UserDestroyVar *glib.DestroyNotify) *TreeListModel { |
| 55 | var cls *TreeListModel | 55 | var cls *TreeListModel | ||
| 56 | 56 | ||||
| 57 | - | cret := xNewTreeListModel(RootVar.GoPointer(), PassthroughVar, AutoexpandVar, purego.NewCallback(CreateFuncVar), UserDataVar, purego.NewCallback(UserDestroyVar)) | 57 | + | cret := xNewTreeListModel(RootVar.GoPointer(), PassthroughVar, AutoexpandVar, glib.NewCallback(CreateFuncVar), UserDataVar, glib.NewCallback(UserDestroyVar)) |
| 58 | 58 | ||||
| 59 | if cret == 0 { | 59 | if cret == 0 { | ||
| 60 | return nil | 60 | return nil | ||
M v4/gtk/gtktreemodel.go +4 -3
| @@ -6,6 +6,7 @@ import ( | |||||
| 6 | 6 | ||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 9 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 10 | ) | 11 | ) | ||
| 11 | 12 | ||||
| @@ -609,7 +610,7 @@ type TreeModel interface { | |||||
| 609 | GoPointer() uintptr | 610 | GoPointer() uintptr | ||
| 610 | SetGoPointer(uintptr) | 611 | SetGoPointer(uintptr) | ||
| 611 | FilterNew(RootVar *TreePath) *TreeModelBase | 612 | FilterNew(RootVar *TreePath) *TreeModelBase | ||
| 612 | - | Foreach(FuncVar TreeModelForeachFunc, UserDataVar uintptr) | 613 | + | Foreach(FuncVar *TreeModelForeachFunc, UserDataVar uintptr) |
| 613 | Get(IterVar *TreeIter, varArgs ...interface{}) | 614 | Get(IterVar *TreeIter, varArgs ...interface{}) | ||
| 614 | GetColumnType(IndexVar int) []interface{} | 615 | GetColumnType(IndexVar int) []interface{} | ||
| 615 | GetFlags() TreeModelFlags | 616 | GetFlags() TreeModelFlags | ||
| @@ -668,9 +669,9 @@ func (x *TreeModelBase) FilterNew(RootVar *TreePath) *TreeModelBase { | |||||
| 668 | // | 669 | // | ||
| 669 | // If @func returns %TRUE, then the tree ceases to be walked, | 670 | // If @func returns %TRUE, then the tree ceases to be walked, | ||
| 670 | // and gtk_tree_model_foreach() returns. | 671 | // and gtk_tree_model_foreach() returns. | ||
| 671 | - | func (x *TreeModelBase) Foreach(FuncVar TreeModelForeachFunc, UserDataVar uintptr) { | 672 | + | func (x *TreeModelBase) Foreach(FuncVar *TreeModelForeachFunc, UserDataVar uintptr) { |
| 672 | 673 | ||||
| 673 | - | XGtkTreeModelForeach(x.GoPointer(), purego.NewCallback(FuncVar), UserDataVar) | 674 | + | XGtkTreeModelForeach(x.GoPointer(), glib.NewCallback(FuncVar), UserDataVar) |
| 674 | 675 | ||||
| 675 | } | 676 | } | ||
| 676 | 677 | ||||
M v4/gtk/gtktreemodelfilter.go +6 -6
| @@ -214,9 +214,9 @@ var xTreeModelFilterSetModifyFunc func(uintptr, int, uintptr, uintptr, uintptr, | |||||
| 214 | // | 214 | // | ||
| 215 | // Note that gtk_tree_model_filter_set_modify_func() | 215 | // Note that gtk_tree_model_filter_set_modify_func() | ||
| 216 | // can only be called once for a given filter model. | 216 | // can only be called once for a given filter model. | ||
| 217 | - | func (x *TreeModelFilter) SetModifyFunc(NColumnsVar int, TypesVar uintptr, FuncVar TreeModelFilterModifyFunc, DataVar uintptr, DestroyVar glib.DestroyNotify) { | 217 | + | func (x *TreeModelFilter) SetModifyFunc(NColumnsVar int, TypesVar uintptr, FuncVar *TreeModelFilterModifyFunc, DataVar uintptr, DestroyVar *glib.DestroyNotify) { |
| 218 | 218 | ||||
| 219 | - | xTreeModelFilterSetModifyFunc(x.GoPointer(), NColumnsVar, TypesVar, purego.NewCallback(FuncVar), DataVar, purego.NewCallback(DestroyVar)) | 219 | + | xTreeModelFilterSetModifyFunc(x.GoPointer(), NColumnsVar, TypesVar, glib.NewCallback(FuncVar), DataVar, glib.NewCallback(DestroyVar)) |
| 220 | 220 | ||||
| 221 | } | 221 | } | ||
| 222 | 222 | ||||
| @@ -276,9 +276,9 @@ var xTreeModelFilterSetVisibleFunc func(uintptr, uintptr, uintptr, uintptr) | |||||
| 276 | // Note that gtk_tree_model_filter_set_visible_func() or | 276 | // Note that gtk_tree_model_filter_set_visible_func() or | ||
| 277 | // gtk_tree_model_filter_set_visible_column() can only be called | 277 | // gtk_tree_model_filter_set_visible_column() can only be called | ||
| 278 | // once for a given filter model. | 278 | // once for a given filter model. | ||
| 279 | - | func (x *TreeModelFilter) SetVisibleFunc(FuncVar TreeModelFilterVisibleFunc, DataVar uintptr, DestroyVar glib.DestroyNotify) { | 279 | + | func (x *TreeModelFilter) SetVisibleFunc(FuncVar *TreeModelFilterVisibleFunc, DataVar uintptr, DestroyVar *glib.DestroyNotify) { |
| 280 | 280 | ||||
| 281 | - | xTreeModelFilterSetVisibleFunc(x.GoPointer(), purego.NewCallback(FuncVar), DataVar, purego.NewCallback(DestroyVar)) | 281 | + | xTreeModelFilterSetVisibleFunc(x.GoPointer(), glib.NewCallback(FuncVar), DataVar, glib.NewCallback(DestroyVar)) |
| 282 | 282 | ||||
| 283 | } | 283 | } | ||
| 284 | 284 | ||||
| @@ -345,9 +345,9 @@ func (x *TreeModelFilter) FilterNew(RootVar *TreePath) *TreeModelBase { | |||||
| 345 | // | 345 | // | ||
| 346 | // If @func returns %TRUE, then the tree ceases to be walked, | 346 | // If @func returns %TRUE, then the tree ceases to be walked, | ||
| 347 | // and gtk_tree_model_foreach() returns. | 347 | // and gtk_tree_model_foreach() returns. | ||
| 348 | - | func (x *TreeModelFilter) Foreach(FuncVar TreeModelForeachFunc, UserDataVar uintptr) { | 348 | + | func (x *TreeModelFilter) Foreach(FuncVar *TreeModelForeachFunc, UserDataVar uintptr) { |
| 349 | 349 | ||||
| 350 | - | XGtkTreeModelForeach(x.GoPointer(), purego.NewCallback(FuncVar), UserDataVar) | 350 | + | XGtkTreeModelForeach(x.GoPointer(), glib.NewCallback(FuncVar), UserDataVar) |
| 351 | 351 | ||||
| 352 | } | 352 | } | ||
| 353 | 353 | ||||
M v4/gtk/gtktreemodelsort.go +6 -6
| @@ -317,9 +317,9 @@ func (x *TreeModelSort) FilterNew(RootVar *TreePath) *TreeModelBase { | |||||
| 317 | // | 317 | // | ||
| 318 | // If @func returns %TRUE, then the tree ceases to be walked, | 318 | // If @func returns %TRUE, then the tree ceases to be walked, | ||
| 319 | // and gtk_tree_model_foreach() returns. | 319 | // and gtk_tree_model_foreach() returns. | ||
| 320 | - | func (x *TreeModelSort) Foreach(FuncVar TreeModelForeachFunc, UserDataVar uintptr) { | 320 | + | func (x *TreeModelSort) Foreach(FuncVar *TreeModelForeachFunc, UserDataVar uintptr) { |
| 321 | 321 | ||||
| 322 | - | XGtkTreeModelForeach(x.GoPointer(), purego.NewCallback(FuncVar), UserDataVar) | 322 | + | XGtkTreeModelForeach(x.GoPointer(), glib.NewCallback(FuncVar), UserDataVar) |
| 323 | 323 | ||||
| 324 | } | 324 | } | ||
| 325 | 325 | ||||
| @@ -651,9 +651,9 @@ func (x *TreeModelSort) HasDefaultSortFunc() bool { | |||||
| 651 | // This means that once the model has been sorted, it can’t go back to the | 651 | // This means that once the model has been sorted, it can’t go back to the | ||
| 652 | // default state. In this case, when the current sort column id of @sortable | 652 | // default state. In this case, when the current sort column id of @sortable | ||
| 653 | // is %GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, the model will be unsorted. | 653 | // is %GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, the model will be unsorted. | ||
| 654 | - | func (x *TreeModelSort) SetDefaultSortFunc(SortFuncVar TreeIterCompareFunc, UserDataVar uintptr, DestroyVar glib.DestroyNotify) { | 654 | + | func (x *TreeModelSort) SetDefaultSortFunc(SortFuncVar *TreeIterCompareFunc, UserDataVar uintptr, DestroyVar *glib.DestroyNotify) { |
| 655 | 655 | ||||
| 656 | - | XGtkTreeSortableSetDefaultSortFunc(x.GoPointer(), purego.NewCallback(SortFuncVar), UserDataVar, purego.NewCallback(DestroyVar)) | 656 | + | XGtkTreeSortableSetDefaultSortFunc(x.GoPointer(), glib.NewCallback(SortFuncVar), UserDataVar, glib.NewCallback(DestroyVar)) |
| 657 | 657 | ||||
| 658 | } | 658 | } | ||
| 659 | 659 | ||||
| @@ -675,9 +675,9 @@ func (x *TreeModelSort) SetSortColumnId(SortColumnIdVar int, OrderVar SortType) | |||||
| 675 | // Sets the comparison function used when sorting to be @sort_func. If the | 675 | // Sets the comparison function used when sorting to be @sort_func. If the | ||
| 676 | // current sort column id of @sortable is the same as @sort_column_id, then | 676 | // current sort column id of @sortable is the same as @sort_column_id, then | ||
| 677 | // the model will sort using this function. | 677 | // the model will sort using this function. | ||
| 678 | - | func (x *TreeModelSort) SetSortFunc(SortColumnIdVar int, SortFuncVar TreeIterCompareFunc, UserDataVar uintptr, DestroyVar glib.DestroyNotify) { | 678 | + | func (x *TreeModelSort) SetSortFunc(SortColumnIdVar int, SortFuncVar *TreeIterCompareFunc, UserDataVar uintptr, DestroyVar *glib.DestroyNotify) { |
| 679 | 679 | ||||
| 680 | - | XGtkTreeSortableSetSortFunc(x.GoPointer(), SortColumnIdVar, purego.NewCallback(SortFuncVar), UserDataVar, purego.NewCallback(DestroyVar)) | 680 | + | XGtkTreeSortableSetSortFunc(x.GoPointer(), SortColumnIdVar, glib.NewCallback(SortFuncVar), UserDataVar, glib.NewCallback(DestroyVar)) |
| 681 | 681 | ||||
| 682 | } | 682 | } | ||
| 683 | 683 | ||||
M v4/gtk/gtktreeselection.go +17 -7
| @@ -2,6 +2,8 @@ | |||||
| 2 | package gtk | 2 | package gtk | ||
| 3 | 3 | ||||
| 4 | import ( | 4 | import ( | ||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 5 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 6 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 7 | "github.com/jwijenbergh/puregotk/v4/glib" | 9 | "github.com/jwijenbergh/puregotk/v4/glib" | ||
| @@ -201,9 +203,9 @@ var xTreeSelectionSelectedForeach func(uintptr, uintptr, uintptr) | |||||
| 201 | // Calls a function for each selected node. Note that you cannot modify | 203 | // Calls a function for each selected node. Note that you cannot modify | ||
| 202 | // the tree or selection from within this function. As a result, | 204 | // the tree or selection from within this function. As a result, | ||
| 203 | // gtk_tree_selection_get_selected_rows() might be more useful. | 205 | // gtk_tree_selection_get_selected_rows() might be more useful. | ||
| 204 | - | func (x *TreeSelection) SelectedForeach(FuncVar TreeSelectionForeachFunc, DataVar uintptr) { | 206 | + | func (x *TreeSelection) SelectedForeach(FuncVar *TreeSelectionForeachFunc, DataVar uintptr) { |
| 205 | 207 | ||||
| 206 | - | xTreeSelectionSelectedForeach(x.GoPointer(), purego.NewCallback(FuncVar), DataVar) | 208 | + | xTreeSelectionSelectedForeach(x.GoPointer(), glib.NewCallback(FuncVar), DataVar) |
| 207 | 209 | ||||
| 208 | } | 210 | } | ||
| 209 | 211 | ||||
| @@ -226,9 +228,9 @@ var xTreeSelectionSetSelectFunction func(uintptr, uintptr, uintptr, uintptr) | |||||
| 226 | // giving some control over which nodes are selected. The select function | 228 | // giving some control over which nodes are selected. The select function | ||
| 227 | // should return %TRUE if the state of the node may be toggled, and %FALSE | 229 | // should return %TRUE if the state of the node may be toggled, and %FALSE | ||
| 228 | // if the state of the node should be left unchanged. | 230 | // if the state of the node should be left unchanged. | ||
| 229 | - | func (x *TreeSelection) SetSelectFunction(FuncVar TreeSelectionFunc, DataVar uintptr, DestroyVar glib.DestroyNotify) { | 231 | + | func (x *TreeSelection) SetSelectFunction(FuncVar *TreeSelectionFunc, DataVar uintptr, DestroyVar *glib.DestroyNotify) { |
| 230 | 232 | ||||
| 231 | - | xTreeSelectionSetSelectFunction(x.GoPointer(), purego.NewCallback(FuncVar), DataVar, purego.NewCallback(DestroyVar)) | 233 | + | xTreeSelectionSetSelectFunction(x.GoPointer(), glib.NewCallback(FuncVar), DataVar, glib.NewCallback(DestroyVar)) |
| 232 | 234 | ||||
| 233 | } | 235 | } | ||
| 234 | 236 | ||||
| @@ -281,15 +283,23 @@ func (c *TreeSelection) SetGoPointer(ptr uintptr) { | |||||
| 281 | // this signal is mostly a hint. It may only be emitted once when a range | 283 | // this signal is mostly a hint. It may only be emitted once when a range | ||
| 282 | // of rows are selected, and it may occasionally be emitted when nothing | 284 | // of rows are selected, and it may occasionally be emitted when nothing | ||
| 283 | // has happened. | 285 | // has happened. | ||
| 284 | - | func (x *TreeSelection) ConnectChanged(cb func(TreeSelection)) uint32 { | 286 | + | func (x *TreeSelection) ConnectChanged(cb *func(TreeSelection)) uint32 { |
| 287 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 288 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 289 | + | return gobject.SignalConnect(x.GoPointer(), "changed", cbRefPtr) | |||
| 290 | + | } | |||
| 291 | + | ||||
| 285 | fcb := func(clsPtr uintptr) { | 292 | fcb := func(clsPtr uintptr) { | ||
| 286 | fa := TreeSelection{} | 293 | fa := TreeSelection{} | ||
| 287 | fa.Ptr = clsPtr | 294 | fa.Ptr = clsPtr | ||
| 295 | + | cbFn := *cb | |||
| 288 | 296 | ||||
| 289 | - | cb(fa) | 297 | + | cbFn(fa) |
| 290 | 298 | ||||
| 291 | } | 299 | } | ||
| 292 | - | return gobject.SignalConnect(x.GoPointer(), "changed", purego.NewCallback(fcb)) | 300 | + | cbRefPtr := purego.NewCallback(fcb) |
| 301 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 302 | + | return gobject.SignalConnect(x.GoPointer(), "changed", cbRefPtr) | |||
| 293 | } | 303 | } | ||
| 294 | 304 | ||||
| 295 | func init() { | 305 | func init() { | ||
M v4/gtk/gtktreesortable.go +6 -6
| @@ -41,9 +41,9 @@ type TreeSortable interface { | |||||
| 41 | SetGoPointer(uintptr) | 41 | SetGoPointer(uintptr) | ||
| 42 | GetSortColumnId(SortColumnIdVar int, OrderVar *SortType) bool | 42 | GetSortColumnId(SortColumnIdVar int, OrderVar *SortType) bool | ||
| 43 | HasDefaultSortFunc() bool | 43 | HasDefaultSortFunc() bool | ||
| 44 | - | SetDefaultSortFunc(SortFuncVar TreeIterCompareFunc, UserDataVar uintptr, DestroyVar glib.DestroyNotify) | 44 | + | SetDefaultSortFunc(SortFuncVar *TreeIterCompareFunc, UserDataVar uintptr, DestroyVar *glib.DestroyNotify) |
| 45 | SetSortColumnId(SortColumnIdVar int, OrderVar SortType) | 45 | SetSortColumnId(SortColumnIdVar int, OrderVar SortType) | ||
| 46 | - | SetSortFunc(SortColumnIdVar int, SortFuncVar TreeIterCompareFunc, UserDataVar uintptr, DestroyVar glib.DestroyNotify) | 46 | + | SetSortFunc(SortColumnIdVar int, SortFuncVar *TreeIterCompareFunc, UserDataVar uintptr, DestroyVar *glib.DestroyNotify) |
| 47 | SortColumnChanged() | 47 | SortColumnChanged() | ||
| 48 | } | 48 | } | ||
| 49 | type TreeSortableBase struct { | 49 | type TreeSortableBase struct { | ||
| @@ -86,9 +86,9 @@ func (x *TreeSortableBase) HasDefaultSortFunc() bool { | |||||
| 86 | // This means that once the model has been sorted, it can’t go back to the | 86 | // This means that once the model has been sorted, it can’t go back to the | ||
| 87 | // default state. In this case, when the current sort column id of @sortable | 87 | // default state. In this case, when the current sort column id of @sortable | ||
| 88 | // is %GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, the model will be unsorted. | 88 | // is %GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, the model will be unsorted. | ||
| 89 | - | func (x *TreeSortableBase) SetDefaultSortFunc(SortFuncVar TreeIterCompareFunc, UserDataVar uintptr, DestroyVar glib.DestroyNotify) { | 89 | + | func (x *TreeSortableBase) SetDefaultSortFunc(SortFuncVar *TreeIterCompareFunc, UserDataVar uintptr, DestroyVar *glib.DestroyNotify) { |
| 90 | 90 | ||||
| 91 | - | XGtkTreeSortableSetDefaultSortFunc(x.GoPointer(), purego.NewCallback(SortFuncVar), UserDataVar, purego.NewCallback(DestroyVar)) | 91 | + | XGtkTreeSortableSetDefaultSortFunc(x.GoPointer(), glib.NewCallback(SortFuncVar), UserDataVar, glib.NewCallback(DestroyVar)) |
| 92 | 92 | ||||
| 93 | } | 93 | } | ||
| 94 | 94 | ||||
| @@ -110,9 +110,9 @@ func (x *TreeSortableBase) SetSortColumnId(SortColumnIdVar int, OrderVar SortTyp | |||||
| 110 | // Sets the comparison function used when sorting to be @sort_func. If the | 110 | // Sets the comparison function used when sorting to be @sort_func. If the | ||
| 111 | // current sort column id of @sortable is the same as @sort_column_id, then | 111 | // current sort column id of @sortable is the same as @sort_column_id, then | ||
| 112 | // the model will sort using this function. | 112 | // the model will sort using this function. | ||
| 113 | - | func (x *TreeSortableBase) SetSortFunc(SortColumnIdVar int, SortFuncVar TreeIterCompareFunc, UserDataVar uintptr, DestroyVar glib.DestroyNotify) { | 113 | + | func (x *TreeSortableBase) SetSortFunc(SortColumnIdVar int, SortFuncVar *TreeIterCompareFunc, UserDataVar uintptr, DestroyVar *glib.DestroyNotify) { |
| 114 | 114 | ||||
| 115 | - | XGtkTreeSortableSetSortFunc(x.GoPointer(), SortColumnIdVar, purego.NewCallback(SortFuncVar), UserDataVar, purego.NewCallback(DestroyVar)) | 115 | + | XGtkTreeSortableSetSortFunc(x.GoPointer(), SortColumnIdVar, glib.NewCallback(SortFuncVar), UserDataVar, glib.NewCallback(DestroyVar)) |
| 116 | 116 | ||||
| 117 | } | 117 | } | ||
| 118 | 118 | ||||
M v4/gtk/gtktreestore.go +6 -6
| @@ -477,9 +477,9 @@ func (x *TreeStore) FilterNew(RootVar *TreePath) *TreeModelBase { | |||||
| 477 | // | 477 | // | ||
| 478 | // If @func returns %TRUE, then the tree ceases to be walked, | 478 | // If @func returns %TRUE, then the tree ceases to be walked, | ||
| 479 | // and gtk_tree_model_foreach() returns. | 479 | // and gtk_tree_model_foreach() returns. | ||
| 480 | - | func (x *TreeStore) Foreach(FuncVar TreeModelForeachFunc, UserDataVar uintptr) { | 480 | + | func (x *TreeStore) Foreach(FuncVar *TreeModelForeachFunc, UserDataVar uintptr) { |
| 481 | 481 | ||||
| 482 | - | XGtkTreeModelForeach(x.GoPointer(), purego.NewCallback(FuncVar), UserDataVar) | 482 | + | XGtkTreeModelForeach(x.GoPointer(), glib.NewCallback(FuncVar), UserDataVar) |
| 483 | 483 | ||||
| 484 | } | 484 | } | ||
| 485 | 485 | ||||
| @@ -811,9 +811,9 @@ func (x *TreeStore) HasDefaultSortFunc() bool { | |||||
| 811 | // This means that once the model has been sorted, it can’t go back to the | 811 | // This means that once the model has been sorted, it can’t go back to the | ||
| 812 | // default state. In this case, when the current sort column id of @sortable | 812 | // default state. In this case, when the current sort column id of @sortable | ||
| 813 | // is %GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, the model will be unsorted. | 813 | // is %GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, the model will be unsorted. | ||
| 814 | - | func (x *TreeStore) SetDefaultSortFunc(SortFuncVar TreeIterCompareFunc, UserDataVar uintptr, DestroyVar glib.DestroyNotify) { | 814 | + | func (x *TreeStore) SetDefaultSortFunc(SortFuncVar *TreeIterCompareFunc, UserDataVar uintptr, DestroyVar *glib.DestroyNotify) { |
| 815 | 815 | ||||
| 816 | - | XGtkTreeSortableSetDefaultSortFunc(x.GoPointer(), purego.NewCallback(SortFuncVar), UserDataVar, purego.NewCallback(DestroyVar)) | 816 | + | XGtkTreeSortableSetDefaultSortFunc(x.GoPointer(), glib.NewCallback(SortFuncVar), UserDataVar, glib.NewCallback(DestroyVar)) |
| 817 | 817 | ||||
| 818 | } | 818 | } | ||
| 819 | 819 | ||||
| @@ -835,9 +835,9 @@ func (x *TreeStore) SetSortColumnId(SortColumnIdVar int, OrderVar SortType) { | |||||
| 835 | // Sets the comparison function used when sorting to be @sort_func. If the | 835 | // Sets the comparison function used when sorting to be @sort_func. If the | ||
| 836 | // current sort column id of @sortable is the same as @sort_column_id, then | 836 | // current sort column id of @sortable is the same as @sort_column_id, then | ||
| 837 | // the model will sort using this function. | 837 | // the model will sort using this function. | ||
| 838 | - | func (x *TreeStore) SetSortFunc(SortColumnIdVar int, SortFuncVar TreeIterCompareFunc, UserDataVar uintptr, DestroyVar glib.DestroyNotify) { | 838 | + | func (x *TreeStore) SetSortFunc(SortColumnIdVar int, SortFuncVar *TreeIterCompareFunc, UserDataVar uintptr, DestroyVar *glib.DestroyNotify) { |
| 839 | 839 | ||||
| 840 | - | XGtkTreeSortableSetSortFunc(x.GoPointer(), SortColumnIdVar, purego.NewCallback(SortFuncVar), UserDataVar, purego.NewCallback(DestroyVar)) | 840 | + | XGtkTreeSortableSetSortFunc(x.GoPointer(), SortColumnIdVar, glib.NewCallback(SortFuncVar), UserDataVar, glib.NewCallback(DestroyVar)) |
| 841 | 841 | ||||
| 842 | } | 842 | } | ||
| 843 | 843 | ||||
M v4/gtk/gtktreeview.go +175 -55
| @@ -793,9 +793,9 @@ var xTreeViewInsertColumnWithDataFunc func(uintptr, int, string, uintptr, uintpt | |||||
| 793 | // gtk_tree_view_column_set_cell_data_func(), gtk_tree_view_column_pack_start(). | 793 | // gtk_tree_view_column_set_cell_data_func(), gtk_tree_view_column_pack_start(). | ||
| 794 | // If @tree_view has “fixed_height” mode enabled, then the new column will have its | 794 | // If @tree_view has “fixed_height” mode enabled, then the new column will have its | ||
| 795 | // “sizing” property set to be GTK_TREE_VIEW_COLUMN_FIXED. | 795 | // “sizing” property set to be GTK_TREE_VIEW_COLUMN_FIXED. | ||
| 796 | - | func (x *TreeView) InsertColumnWithDataFunc(PositionVar int, TitleVar string, CellVar *CellRenderer, FuncVar TreeCellDataFunc, DataVar uintptr, DnotifyVar glib.DestroyNotify) int { | 796 | + | func (x *TreeView) InsertColumnWithDataFunc(PositionVar int, TitleVar string, CellVar *CellRenderer, FuncVar *TreeCellDataFunc, DataVar uintptr, DnotifyVar *glib.DestroyNotify) int { |
| 797 | 797 | ||||
| 798 | - | cret := xTreeViewInsertColumnWithDataFunc(x.GoPointer(), PositionVar, TitleVar, CellVar.GoPointer(), purego.NewCallback(FuncVar), DataVar, purego.NewCallback(DnotifyVar)) | 798 | + | cret := xTreeViewInsertColumnWithDataFunc(x.GoPointer(), PositionVar, TitleVar, CellVar.GoPointer(), glib.NewCallback(FuncVar), DataVar, glib.NewCallback(DnotifyVar)) |
| 799 | return cret | 799 | return cret | ||
| 800 | } | 800 | } | ||
| 801 | 801 | ||||
| @@ -837,9 +837,9 @@ func (x *TreeView) IsRubberBandingActive() bool { | |||||
| 837 | var xTreeViewMapExpandedRows func(uintptr, uintptr, uintptr) | 837 | var xTreeViewMapExpandedRows func(uintptr, uintptr, uintptr) | ||
| 838 | 838 | ||||
| 839 | // Calls @func on all expanded rows. | 839 | // Calls @func on all expanded rows. | ||
| 840 | - | func (x *TreeView) MapExpandedRows(FuncVar TreeViewMappingFunc, DataVar uintptr) { | 840 | + | func (x *TreeView) MapExpandedRows(FuncVar *TreeViewMappingFunc, DataVar uintptr) { |
| 841 | 841 | ||||
| 842 | - | xTreeViewMapExpandedRows(x.GoPointer(), purego.NewCallback(FuncVar), DataVar) | 842 | + | xTreeViewMapExpandedRows(x.GoPointer(), glib.NewCallback(FuncVar), DataVar) |
| 843 | 843 | ||||
| 844 | } | 844 | } | ||
| 845 | 845 | ||||
| @@ -940,9 +940,9 @@ var xTreeViewSetColumnDragFunction func(uintptr, uintptr, uintptr, uintptr) | |||||
| 940 | // are %NULL, then they indicate an edge. If @func is set to be %NULL, then | 940 | // are %NULL, then they indicate an edge. If @func is set to be %NULL, then | ||
| 941 | // @tree_view reverts to the default behavior of allowing all columns to be | 941 | // @tree_view reverts to the default behavior of allowing all columns to be | ||
| 942 | // dropped everywhere. | 942 | // dropped everywhere. | ||
| 943 | - | func (x *TreeView) SetColumnDragFunction(FuncVar TreeViewColumnDropFunc, UserDataVar uintptr, DestroyVar glib.DestroyNotify) { | 943 | + | func (x *TreeView) SetColumnDragFunction(FuncVar *TreeViewColumnDropFunc, UserDataVar uintptr, DestroyVar *glib.DestroyNotify) { |
| 944 | 944 | ||||
| 945 | - | xTreeViewSetColumnDragFunction(x.GoPointer(), purego.NewCallback(FuncVar), UserDataVar, purego.NewCallback(DestroyVar)) | 945 | + | xTreeViewSetColumnDragFunction(x.GoPointer(), glib.NewCallback(FuncVar), UserDataVar, glib.NewCallback(DestroyVar)) |
| 946 | 946 | ||||
| 947 | } | 947 | } | ||
| 948 | 948 | ||||
| @@ -1148,9 +1148,9 @@ var xTreeViewSetRowSeparatorFunc func(uintptr, uintptr, uintptr, uintptr) | |||||
| 1148 | // Sets the row separator function, which is used to determine | 1148 | // Sets the row separator function, which is used to determine | ||
| 1149 | // whether a row should be drawn as a separator. If the row separator | 1149 | // whether a row should be drawn as a separator. If the row separator | ||
| 1150 | // function is %NULL, no separators are drawn. This is the default value. | 1150 | // function is %NULL, no separators are drawn. This is the default value. | ||
| 1151 | - | func (x *TreeView) SetRowSeparatorFunc(FuncVar TreeViewRowSeparatorFunc, DataVar uintptr, DestroyVar glib.DestroyNotify) { | 1151 | + | func (x *TreeView) SetRowSeparatorFunc(FuncVar *TreeViewRowSeparatorFunc, DataVar uintptr, DestroyVar *glib.DestroyNotify) { |
| 1152 | 1152 | ||||
| 1153 | - | xTreeViewSetRowSeparatorFunc(x.GoPointer(), purego.NewCallback(FuncVar), DataVar, purego.NewCallback(DestroyVar)) | 1153 | + | xTreeViewSetRowSeparatorFunc(x.GoPointer(), glib.NewCallback(FuncVar), DataVar, glib.NewCallback(DestroyVar)) |
| 1154 | 1154 | ||||
| 1155 | } | 1155 | } | ||
| 1156 | 1156 | ||||
| @@ -1200,9 +1200,9 @@ var xTreeViewSetSearchEqualFunc func(uintptr, uintptr, uintptr, uintptr) | |||||
| 1200 | // Sets the compare function for the interactive search capabilities; note | 1200 | // Sets the compare function for the interactive search capabilities; note | ||
| 1201 | // that somewhat like strcmp() returning 0 for equality | 1201 | // that somewhat like strcmp() returning 0 for equality | ||
| 1202 | // `GtkTreeView`SearchEqualFunc returns %FALSE on matches. | 1202 | // `GtkTreeView`SearchEqualFunc returns %FALSE on matches. | ||
| 1203 | - | func (x *TreeView) SetSearchEqualFunc(SearchEqualFuncVar TreeViewSearchEqualFunc, SearchUserDataVar uintptr, SearchDestroyVar glib.DestroyNotify) { | 1203 | + | func (x *TreeView) SetSearchEqualFunc(SearchEqualFuncVar *TreeViewSearchEqualFunc, SearchUserDataVar uintptr, SearchDestroyVar *glib.DestroyNotify) { |
| 1204 | 1204 | ||||
| 1205 | - | xTreeViewSetSearchEqualFunc(x.GoPointer(), purego.NewCallback(SearchEqualFuncVar), SearchUserDataVar, purego.NewCallback(SearchDestroyVar)) | 1205 | + | xTreeViewSetSearchEqualFunc(x.GoPointer(), glib.NewCallback(SearchEqualFuncVar), SearchUserDataVar, glib.NewCallback(SearchDestroyVar)) |
| 1206 | 1206 | ||||
| 1207 | } | 1207 | } | ||
| 1208 | 1208 | ||||
| @@ -1300,38 +1300,62 @@ func (c *TreeView) SetGoPointer(ptr uintptr) { | |||||
| 1300 | } | 1300 | } | ||
| 1301 | 1301 | ||||
| 1302 | // The number of columns of the treeview has changed. | 1302 | // The number of columns of the treeview has changed. | ||
| 1303 | - | func (x *TreeView) ConnectColumnsChanged(cb func(TreeView)) uint32 { | 1303 | + | func (x *TreeView) ConnectColumnsChanged(cb *func(TreeView)) uint32 { |
| 1304 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1305 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1306 | + | return gobject.SignalConnect(x.GoPointer(), "columns-changed", cbRefPtr) | |||
| 1307 | + | } | |||
| 1308 | + | ||||
| 1304 | fcb := func(clsPtr uintptr) { | 1309 | fcb := func(clsPtr uintptr) { | ||
| 1305 | fa := TreeView{} | 1310 | fa := TreeView{} | ||
| 1306 | fa.Ptr = clsPtr | 1311 | fa.Ptr = clsPtr | ||
| 1312 | + | cbFn := *cb | |||
| 1307 | 1313 | ||||
| 1308 | - | cb(fa) | 1314 | + | cbFn(fa) |
| 1309 | 1315 | ||||
| 1310 | } | 1316 | } | ||
| 1311 | - | return gobject.SignalConnect(x.GoPointer(), "columns-changed", purego.NewCallback(fcb)) | 1317 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1318 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1319 | + | return gobject.SignalConnect(x.GoPointer(), "columns-changed", cbRefPtr) | |||
| 1312 | } | 1320 | } | ||
| 1313 | 1321 | ||||
| 1314 | // The position of the cursor (focused cell) has changed. | 1322 | // The position of the cursor (focused cell) has changed. | ||
| 1315 | - | func (x *TreeView) ConnectCursorChanged(cb func(TreeView)) uint32 { | 1323 | + | func (x *TreeView) ConnectCursorChanged(cb *func(TreeView)) uint32 { |
| 1324 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1325 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1326 | + | return gobject.SignalConnect(x.GoPointer(), "cursor-changed", cbRefPtr) | |||
| 1327 | + | } | |||
| 1328 | + | ||||
| 1316 | fcb := func(clsPtr uintptr) { | 1329 | fcb := func(clsPtr uintptr) { | ||
| 1317 | fa := TreeView{} | 1330 | fa := TreeView{} | ||
| 1318 | fa.Ptr = clsPtr | 1331 | fa.Ptr = clsPtr | ||
| 1332 | + | cbFn := *cb | |||
| 1319 | 1333 | ||||
| 1320 | - | cb(fa) | 1334 | + | cbFn(fa) |
| 1321 | 1335 | ||||
| 1322 | } | 1336 | } | ||
| 1323 | - | return gobject.SignalConnect(x.GoPointer(), "cursor-changed", purego.NewCallback(fcb)) | 1337 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1338 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1339 | + | return gobject.SignalConnect(x.GoPointer(), "cursor-changed", cbRefPtr) | |||
| 1324 | } | 1340 | } | ||
| 1325 | 1341 | ||||
| 1326 | - | func (x *TreeView) ConnectExpandCollapseCursorRow(cb func(TreeView, bool, bool, bool) bool) uint32 { | 1342 | + | func (x *TreeView) ConnectExpandCollapseCursorRow(cb *func(TreeView, bool, bool, bool) bool) uint32 { |
| 1343 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1344 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1345 | + | return gobject.SignalConnect(x.GoPointer(), "expand-collapse-cursor-row", cbRefPtr) | |||
| 1346 | + | } | |||
| 1347 | + | ||||
| 1327 | fcb := func(clsPtr uintptr, ObjectVarp bool, P0Varp bool, P1Varp bool) bool { | 1348 | fcb := func(clsPtr uintptr, ObjectVarp bool, P0Varp bool, P1Varp bool) bool { | ||
| 1328 | fa := TreeView{} | 1349 | fa := TreeView{} | ||
| 1329 | fa.Ptr = clsPtr | 1350 | fa.Ptr = clsPtr | ||
| 1351 | + | cbFn := *cb | |||
| 1330 | 1352 | ||||
| 1331 | - | return cb(fa, ObjectVarp, P0Varp, P1Varp) | 1353 | + | return cbFn(fa, ObjectVarp, P0Varp, P1Varp) |
| 1332 | 1354 | ||||
| 1333 | } | 1355 | } | ||
| 1334 | - | return gobject.SignalConnect(x.GoPointer(), "expand-collapse-cursor-row", purego.NewCallback(fcb)) | 1356 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1357 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1358 | + | return gobject.SignalConnect(x.GoPointer(), "expand-collapse-cursor-row", cbRefPtr) | |||
| 1335 | } | 1359 | } | ||
| 1336 | 1360 | ||||
| 1337 | // The `GtkTreeView`::move-cursor signal is a [keybinding | 1361 | // The `GtkTreeView`::move-cursor signal is a [keybinding | ||
| @@ -1343,15 +1367,23 @@ func (x *TreeView) ConnectExpandCollapseCursorRow(cb func(TreeView, bool, bool, | |||||
| 1343 | // programmatically. In contrast to gtk_tree_view_set_cursor() and | 1367 | // programmatically. In contrast to gtk_tree_view_set_cursor() and | ||
| 1344 | // gtk_tree_view_set_cursor_on_cell() when moving horizontally | 1368 | // gtk_tree_view_set_cursor_on_cell() when moving horizontally | ||
| 1345 | // `GtkTreeView`::move-cursor does not reset the current selection. | 1369 | // `GtkTreeView`::move-cursor does not reset the current selection. | ||
| 1346 | - | func (x *TreeView) ConnectMoveCursor(cb func(TreeView, MovementStep, int, bool, bool) bool) uint32 { | 1370 | + | func (x *TreeView) ConnectMoveCursor(cb *func(TreeView, MovementStep, int, bool, bool) bool) uint32 { |
| 1371 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1372 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1373 | + | return gobject.SignalConnect(x.GoPointer(), "move-cursor", cbRefPtr) | |||
| 1374 | + | } | |||
| 1375 | + | ||||
| 1347 | fcb := func(clsPtr uintptr, StepVarp MovementStep, DirectionVarp int, ExtendVarp bool, ModifyVarp bool) bool { | 1376 | fcb := func(clsPtr uintptr, StepVarp MovementStep, DirectionVarp int, ExtendVarp bool, ModifyVarp bool) bool { | ||
| 1348 | fa := TreeView{} | 1377 | fa := TreeView{} | ||
| 1349 | fa.Ptr = clsPtr | 1378 | fa.Ptr = clsPtr | ||
| 1379 | + | cbFn := *cb | |||
| 1350 | 1380 | ||||
| 1351 | - | return cb(fa, StepVarp, DirectionVarp, ExtendVarp, ModifyVarp) | 1381 | + | return cbFn(fa, StepVarp, DirectionVarp, ExtendVarp, ModifyVarp) |
| 1352 | 1382 | ||||
| 1353 | } | 1383 | } | ||
| 1354 | - | return gobject.SignalConnect(x.GoPointer(), "move-cursor", purego.NewCallback(fcb)) | 1384 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1385 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1386 | + | return gobject.SignalConnect(x.GoPointer(), "move-cursor", cbRefPtr) | |||
| 1355 | } | 1387 | } | ||
| 1356 | 1388 | ||||
| 1357 | // The "row-activated" signal is emitted when the method | 1389 | // The "row-activated" signal is emitted when the method | ||
| @@ -1368,131 +1400,219 @@ func (x *TreeView) ConnectMoveCursor(cb func(TreeView, MovementStep, int, bool, | |||||
| 1368 | // For selection handling refer to the | 1400 | // For selection handling refer to the | ||
| 1369 | // [tree widget conceptual overview](section-tree-widget.html) | 1401 | // [tree widget conceptual overview](section-tree-widget.html) | ||
| 1370 | // as well as `GtkTreeSelection`. | 1402 | // as well as `GtkTreeSelection`. | ||
| 1371 | - | func (x *TreeView) ConnectRowActivated(cb func(TreeView, uintptr, uintptr)) uint32 { | 1403 | + | func (x *TreeView) ConnectRowActivated(cb *func(TreeView, uintptr, uintptr)) uint32 { |
| 1404 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1405 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1406 | + | return gobject.SignalConnect(x.GoPointer(), "row-activated", cbRefPtr) | |||
| 1407 | + | } | |||
| 1408 | + | ||||
| 1372 | fcb := func(clsPtr uintptr, PathVarp uintptr, ColumnVarp uintptr) { | 1409 | fcb := func(clsPtr uintptr, PathVarp uintptr, ColumnVarp uintptr) { | ||
| 1373 | fa := TreeView{} | 1410 | fa := TreeView{} | ||
| 1374 | fa.Ptr = clsPtr | 1411 | fa.Ptr = clsPtr | ||
| 1412 | + | cbFn := *cb | |||
| 1375 | 1413 | ||||
| 1376 | - | cb(fa, PathVarp, ColumnVarp) | 1414 | + | cbFn(fa, PathVarp, ColumnVarp) |
| 1377 | 1415 | ||||
| 1378 | } | 1416 | } | ||
| 1379 | - | return gobject.SignalConnect(x.GoPointer(), "row-activated", purego.NewCallback(fcb)) | 1417 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1418 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1419 | + | return gobject.SignalConnect(x.GoPointer(), "row-activated", cbRefPtr) | |||
| 1380 | } | 1420 | } | ||
| 1381 | 1421 | ||||
| 1382 | // The given row has been collapsed (child nodes are hidden). | 1422 | // The given row has been collapsed (child nodes are hidden). | ||
| 1383 | - | func (x *TreeView) ConnectRowCollapsed(cb func(TreeView, uintptr, uintptr)) uint32 { | 1423 | + | func (x *TreeView) ConnectRowCollapsed(cb *func(TreeView, uintptr, uintptr)) uint32 { |
| 1424 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1425 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1426 | + | return gobject.SignalConnect(x.GoPointer(), "row-collapsed", cbRefPtr) | |||
| 1427 | + | } | |||
| 1428 | + | ||||
| 1384 | fcb := func(clsPtr uintptr, IterVarp uintptr, PathVarp uintptr) { | 1429 | fcb := func(clsPtr uintptr, IterVarp uintptr, PathVarp uintptr) { | ||
| 1385 | fa := TreeView{} | 1430 | fa := TreeView{} | ||
| 1386 | fa.Ptr = clsPtr | 1431 | fa.Ptr = clsPtr | ||
| 1432 | + | cbFn := *cb | |||
| 1387 | 1433 | ||||
| 1388 | - | cb(fa, IterVarp, PathVarp) | 1434 | + | cbFn(fa, IterVarp, PathVarp) |
| 1389 | 1435 | ||||
| 1390 | } | 1436 | } | ||
| 1391 | - | return gobject.SignalConnect(x.GoPointer(), "row-collapsed", purego.NewCallback(fcb)) | 1437 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1438 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1439 | + | return gobject.SignalConnect(x.GoPointer(), "row-collapsed", cbRefPtr) | |||
| 1392 | } | 1440 | } | ||
| 1393 | 1441 | ||||
| 1394 | // The given row has been expanded (child nodes are shown). | 1442 | // The given row has been expanded (child nodes are shown). | ||
| 1395 | - | func (x *TreeView) ConnectRowExpanded(cb func(TreeView, uintptr, uintptr)) uint32 { | 1443 | + | func (x *TreeView) ConnectRowExpanded(cb *func(TreeView, uintptr, uintptr)) uint32 { |
| 1444 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1445 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1446 | + | return gobject.SignalConnect(x.GoPointer(), "row-expanded", cbRefPtr) | |||
| 1447 | + | } | |||
| 1448 | + | ||||
| 1396 | fcb := func(clsPtr uintptr, IterVarp uintptr, PathVarp uintptr) { | 1449 | fcb := func(clsPtr uintptr, IterVarp uintptr, PathVarp uintptr) { | ||
| 1397 | fa := TreeView{} | 1450 | fa := TreeView{} | ||
| 1398 | fa.Ptr = clsPtr | 1451 | fa.Ptr = clsPtr | ||
| 1452 | + | cbFn := *cb | |||
| 1399 | 1453 | ||||
| 1400 | - | cb(fa, IterVarp, PathVarp) | 1454 | + | cbFn(fa, IterVarp, PathVarp) |
| 1401 | 1455 | ||||
| 1402 | } | 1456 | } | ||
| 1403 | - | return gobject.SignalConnect(x.GoPointer(), "row-expanded", purego.NewCallback(fcb)) | 1457 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1458 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1459 | + | return gobject.SignalConnect(x.GoPointer(), "row-expanded", cbRefPtr) | |||
| 1404 | } | 1460 | } | ||
| 1405 | 1461 | ||||
| 1406 | - | func (x *TreeView) ConnectSelectAll(cb func(TreeView) bool) uint32 { | 1462 | + | func (x *TreeView) ConnectSelectAll(cb *func(TreeView) bool) uint32 { |
| 1463 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1464 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1465 | + | return gobject.SignalConnect(x.GoPointer(), "select-all", cbRefPtr) | |||
| 1466 | + | } | |||
| 1467 | + | ||||
| 1407 | fcb := func(clsPtr uintptr) bool { | 1468 | fcb := func(clsPtr uintptr) bool { | ||
| 1408 | fa := TreeView{} | 1469 | fa := TreeView{} | ||
| 1409 | fa.Ptr = clsPtr | 1470 | fa.Ptr = clsPtr | ||
| 1471 | + | cbFn := *cb | |||
| 1410 | 1472 | ||||
| 1411 | - | return cb(fa) | 1473 | + | return cbFn(fa) |
| 1412 | 1474 | ||||
| 1413 | } | 1475 | } | ||
| 1414 | - | return gobject.SignalConnect(x.GoPointer(), "select-all", purego.NewCallback(fcb)) | 1476 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1477 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1478 | + | return gobject.SignalConnect(x.GoPointer(), "select-all", cbRefPtr) | |||
| 1415 | } | 1479 | } | ||
| 1416 | 1480 | ||||
| 1417 | - | func (x *TreeView) ConnectSelectCursorParent(cb func(TreeView) bool) uint32 { | 1481 | + | func (x *TreeView) ConnectSelectCursorParent(cb *func(TreeView) bool) uint32 { |
| 1482 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1483 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1484 | + | return gobject.SignalConnect(x.GoPointer(), "select-cursor-parent", cbRefPtr) | |||
| 1485 | + | } | |||
| 1486 | + | ||||
| 1418 | fcb := func(clsPtr uintptr) bool { | 1487 | fcb := func(clsPtr uintptr) bool { | ||
| 1419 | fa := TreeView{} | 1488 | fa := TreeView{} | ||
| 1420 | fa.Ptr = clsPtr | 1489 | fa.Ptr = clsPtr | ||
| 1490 | + | cbFn := *cb | |||
| 1421 | 1491 | ||||
| 1422 | - | return cb(fa) | 1492 | + | return cbFn(fa) |
| 1423 | 1493 | ||||
| 1424 | } | 1494 | } | ||
| 1425 | - | return gobject.SignalConnect(x.GoPointer(), "select-cursor-parent", purego.NewCallback(fcb)) | 1495 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1496 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1497 | + | return gobject.SignalConnect(x.GoPointer(), "select-cursor-parent", cbRefPtr) | |||
| 1426 | } | 1498 | } | ||
| 1427 | 1499 | ||||
| 1428 | - | func (x *TreeView) ConnectSelectCursorRow(cb func(TreeView, bool) bool) uint32 { | 1500 | + | func (x *TreeView) ConnectSelectCursorRow(cb *func(TreeView, bool) bool) uint32 { |
| 1501 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1502 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1503 | + | return gobject.SignalConnect(x.GoPointer(), "select-cursor-row", cbRefPtr) | |||
| 1504 | + | } | |||
| 1505 | + | ||||
| 1429 | fcb := func(clsPtr uintptr, ObjectVarp bool) bool { | 1506 | fcb := func(clsPtr uintptr, ObjectVarp bool) bool { | ||
| 1430 | fa := TreeView{} | 1507 | fa := TreeView{} | ||
| 1431 | fa.Ptr = clsPtr | 1508 | fa.Ptr = clsPtr | ||
| 1509 | + | cbFn := *cb | |||
| 1432 | 1510 | ||||
| 1433 | - | return cb(fa, ObjectVarp) | 1511 | + | return cbFn(fa, ObjectVarp) |
| 1434 | 1512 | ||||
| 1435 | } | 1513 | } | ||
| 1436 | - | return gobject.SignalConnect(x.GoPointer(), "select-cursor-row", purego.NewCallback(fcb)) | 1514 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1515 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1516 | + | return gobject.SignalConnect(x.GoPointer(), "select-cursor-row", cbRefPtr) | |||
| 1437 | } | 1517 | } | ||
| 1438 | 1518 | ||||
| 1439 | - | func (x *TreeView) ConnectStartInteractiveSearch(cb func(TreeView) bool) uint32 { | 1519 | + | func (x *TreeView) ConnectStartInteractiveSearch(cb *func(TreeView) bool) uint32 { |
| 1520 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1521 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1522 | + | return gobject.SignalConnect(x.GoPointer(), "start-interactive-search", cbRefPtr) | |||
| 1523 | + | } | |||
| 1524 | + | ||||
| 1440 | fcb := func(clsPtr uintptr) bool { | 1525 | fcb := func(clsPtr uintptr) bool { | ||
| 1441 | fa := TreeView{} | 1526 | fa := TreeView{} | ||
| 1442 | fa.Ptr = clsPtr | 1527 | fa.Ptr = clsPtr | ||
| 1528 | + | cbFn := *cb | |||
| 1443 | 1529 | ||||
| 1444 | - | return cb(fa) | 1530 | + | return cbFn(fa) |
| 1445 | 1531 | ||||
| 1446 | } | 1532 | } | ||
| 1447 | - | return gobject.SignalConnect(x.GoPointer(), "start-interactive-search", purego.NewCallback(fcb)) | 1533 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1534 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1535 | + | return gobject.SignalConnect(x.GoPointer(), "start-interactive-search", cbRefPtr) | |||
| 1448 | } | 1536 | } | ||
| 1449 | 1537 | ||||
| 1450 | // The given row is about to be collapsed (hide its children nodes). Use this | 1538 | // The given row is about to be collapsed (hide its children nodes). Use this | ||
| 1451 | // signal if you need to control the collapsibility of individual rows. | 1539 | // signal if you need to control the collapsibility of individual rows. | ||
| 1452 | - | func (x *TreeView) ConnectTestCollapseRow(cb func(TreeView, uintptr, uintptr) bool) uint32 { | 1540 | + | func (x *TreeView) ConnectTestCollapseRow(cb *func(TreeView, uintptr, uintptr) bool) uint32 { |
| 1541 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1542 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1543 | + | return gobject.SignalConnect(x.GoPointer(), "test-collapse-row", cbRefPtr) | |||
| 1544 | + | } | |||
| 1545 | + | ||||
| 1453 | fcb := func(clsPtr uintptr, IterVarp uintptr, PathVarp uintptr) bool { | 1546 | fcb := func(clsPtr uintptr, IterVarp uintptr, PathVarp uintptr) bool { | ||
| 1454 | fa := TreeView{} | 1547 | fa := TreeView{} | ||
| 1455 | fa.Ptr = clsPtr | 1548 | fa.Ptr = clsPtr | ||
| 1549 | + | cbFn := *cb | |||
| 1456 | 1550 | ||||
| 1457 | - | return cb(fa, IterVarp, PathVarp) | 1551 | + | return cbFn(fa, IterVarp, PathVarp) |
| 1458 | 1552 | ||||
| 1459 | } | 1553 | } | ||
| 1460 | - | return gobject.SignalConnect(x.GoPointer(), "test-collapse-row", purego.NewCallback(fcb)) | 1554 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1555 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1556 | + | return gobject.SignalConnect(x.GoPointer(), "test-collapse-row", cbRefPtr) | |||
| 1461 | } | 1557 | } | ||
| 1462 | 1558 | ||||
| 1463 | // The given row is about to be expanded (show its children nodes). Use this | 1559 | // The given row is about to be expanded (show its children nodes). Use this | ||
| 1464 | // signal if you need to control the expandability of individual rows. | 1560 | // signal if you need to control the expandability of individual rows. | ||
| 1465 | - | func (x *TreeView) ConnectTestExpandRow(cb func(TreeView, uintptr, uintptr) bool) uint32 { | 1561 | + | func (x *TreeView) ConnectTestExpandRow(cb *func(TreeView, uintptr, uintptr) bool) uint32 { |
| 1562 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1563 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1564 | + | return gobject.SignalConnect(x.GoPointer(), "test-expand-row", cbRefPtr) | |||
| 1565 | + | } | |||
| 1566 | + | ||||
| 1466 | fcb := func(clsPtr uintptr, IterVarp uintptr, PathVarp uintptr) bool { | 1567 | fcb := func(clsPtr uintptr, IterVarp uintptr, PathVarp uintptr) bool { | ||
| 1467 | fa := TreeView{} | 1568 | fa := TreeView{} | ||
| 1468 | fa.Ptr = clsPtr | 1569 | fa.Ptr = clsPtr | ||
| 1570 | + | cbFn := *cb | |||
| 1469 | 1571 | ||||
| 1470 | - | return cb(fa, IterVarp, PathVarp) | 1572 | + | return cbFn(fa, IterVarp, PathVarp) |
| 1471 | 1573 | ||||
| 1472 | } | 1574 | } | ||
| 1473 | - | return gobject.SignalConnect(x.GoPointer(), "test-expand-row", purego.NewCallback(fcb)) | 1575 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1576 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1577 | + | return gobject.SignalConnect(x.GoPointer(), "test-expand-row", cbRefPtr) | |||
| 1474 | } | 1578 | } | ||
| 1475 | 1579 | ||||
| 1476 | - | func (x *TreeView) ConnectToggleCursorRow(cb func(TreeView) bool) uint32 { | 1580 | + | func (x *TreeView) ConnectToggleCursorRow(cb *func(TreeView) bool) uint32 { |
| 1581 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1582 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1583 | + | return gobject.SignalConnect(x.GoPointer(), "toggle-cursor-row", cbRefPtr) | |||
| 1584 | + | } | |||
| 1585 | + | ||||
| 1477 | fcb := func(clsPtr uintptr) bool { | 1586 | fcb := func(clsPtr uintptr) bool { | ||
| 1478 | fa := TreeView{} | 1587 | fa := TreeView{} | ||
| 1479 | fa.Ptr = clsPtr | 1588 | fa.Ptr = clsPtr | ||
| 1589 | + | cbFn := *cb | |||
| 1480 | 1590 | ||||
| 1481 | - | return cb(fa) | 1591 | + | return cbFn(fa) |
| 1482 | 1592 | ||||
| 1483 | } | 1593 | } | ||
| 1484 | - | return gobject.SignalConnect(x.GoPointer(), "toggle-cursor-row", purego.NewCallback(fcb)) | 1594 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1595 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1596 | + | return gobject.SignalConnect(x.GoPointer(), "toggle-cursor-row", cbRefPtr) | |||
| 1485 | } | 1597 | } | ||
| 1486 | 1598 | ||||
| 1487 | - | func (x *TreeView) ConnectUnselectAll(cb func(TreeView) bool) uint32 { | 1599 | + | func (x *TreeView) ConnectUnselectAll(cb *func(TreeView) bool) uint32 { |
| 1600 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1601 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1602 | + | return gobject.SignalConnect(x.GoPointer(), "unselect-all", cbRefPtr) | |||
| 1603 | + | } | |||
| 1604 | + | ||||
| 1488 | fcb := func(clsPtr uintptr) bool { | 1605 | fcb := func(clsPtr uintptr) bool { | ||
| 1489 | fa := TreeView{} | 1606 | fa := TreeView{} | ||
| 1490 | fa.Ptr = clsPtr | 1607 | fa.Ptr = clsPtr | ||
| 1608 | + | cbFn := *cb | |||
| 1491 | 1609 | ||||
| 1492 | - | return cb(fa) | 1610 | + | return cbFn(fa) |
| 1493 | 1611 | ||||
| 1494 | } | 1612 | } | ||
| 1495 | - | return gobject.SignalConnect(x.GoPointer(), "unselect-all", purego.NewCallback(fcb)) | 1613 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1614 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1615 | + | return gobject.SignalConnect(x.GoPointer(), "unselect-all", cbRefPtr) | |||
| 1496 | } | 1616 | } | ||
| 1497 | 1617 | ||||
| 1498 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 1618 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/gtk/gtktreeviewcolumn.go +15 -5
| @@ -2,6 +2,8 @@ | |||||
| 2 | package gtk | 2 | package gtk | ||
| 3 | 3 | ||||
| 4 | import ( | 4 | import ( | ||
| 5 | + | "unsafe" | |||
| 6 | + | ||||
| 5 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 6 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 7 | "github.com/jwijenbergh/puregotk/v4/glib" | 9 | "github.com/jwijenbergh/puregotk/v4/glib" | ||
| @@ -505,9 +507,9 @@ var xTreeViewColumnSetCellDataFunc func(uintptr, uintptr, uintptr, uintptr, uint | |||||
| 505 | // setting the column value, and should set the value of @tree_column's | 507 | // setting the column value, and should set the value of @tree_column's | ||
| 506 | // cell renderer as appropriate. @func may be %NULL to remove an | 508 | // cell renderer as appropriate. @func may be %NULL to remove an | ||
| 507 | // older one. | 509 | // older one. | ||
| 508 | - | func (x *TreeViewColumn) SetCellDataFunc(CellRendererVar *CellRenderer, FuncVar TreeCellDataFunc, FuncDataVar uintptr, DestroyVar glib.DestroyNotify) { | 510 | + | func (x *TreeViewColumn) SetCellDataFunc(CellRendererVar *CellRenderer, FuncVar *TreeCellDataFunc, FuncDataVar uintptr, DestroyVar *glib.DestroyNotify) { |
| 509 | 511 | ||||
| 510 | - | xTreeViewColumnSetCellDataFunc(x.GoPointer(), CellRendererVar.GoPointer(), purego.NewCallback(FuncVar), FuncDataVar, purego.NewCallback(DestroyVar)) | 512 | + | xTreeViewColumnSetCellDataFunc(x.GoPointer(), CellRendererVar.GoPointer(), glib.NewCallback(FuncVar), FuncDataVar, glib.NewCallback(DestroyVar)) |
| 511 | 513 | ||||
| 512 | } | 514 | } | ||
| 513 | 515 | ||||
| @@ -699,15 +701,23 @@ func (c *TreeViewColumn) SetGoPointer(ptr uintptr) { | |||||
| 699 | } | 701 | } | ||
| 700 | 702 | ||||
| 701 | // Emitted when the column's header has been clicked. | 703 | // Emitted when the column's header has been clicked. | ||
| 702 | - | func (x *TreeViewColumn) ConnectClicked(cb func(TreeViewColumn)) uint32 { | 704 | + | func (x *TreeViewColumn) ConnectClicked(cb *func(TreeViewColumn)) uint32 { |
| 705 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 706 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 707 | + | return gobject.SignalConnect(x.GoPointer(), "clicked", cbRefPtr) | |||
| 708 | + | } | |||
| 709 | + | ||||
| 703 | fcb := func(clsPtr uintptr) { | 710 | fcb := func(clsPtr uintptr) { | ||
| 704 | fa := TreeViewColumn{} | 711 | fa := TreeViewColumn{} | ||
| 705 | fa.Ptr = clsPtr | 712 | fa.Ptr = clsPtr | ||
| 713 | + | cbFn := *cb | |||
| 706 | 714 | ||||
| 707 | - | cb(fa) | 715 | + | cbFn(fa) |
| 708 | 716 | ||||
| 709 | } | 717 | } | ||
| 710 | - | return gobject.SignalConnect(x.GoPointer(), "clicked", purego.NewCallback(fcb)) | 718 | + | cbRefPtr := purego.NewCallback(fcb) |
| 719 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 720 | + | return gobject.SignalConnect(x.GoPointer(), "clicked", cbRefPtr) | |||
| 711 | } | 721 | } | ||
| 712 | 722 | ||||
| 713 | // Gets the ID of the @buildable object. | 723 | // Gets the ID of the @buildable object. | ||
M v4/gtk/gtkwidget.go +151 -47
| @@ -92,9 +92,9 @@ var xWidgetClassAddBinding func(uintptr, uint, gdk.ModifierType, uintptr, string | |||||
| 92 | // initialization. It does not provide for user_data, if you need that, | 92 | // initialization. It does not provide for user_data, if you need that, | ||
| 93 | // you will have to use [method@GtkWidgetClass.add_shortcut] with a custom | 93 | // you will have to use [method@GtkWidgetClass.add_shortcut] with a custom | ||
| 94 | // shortcut. | 94 | // shortcut. | ||
| 95 | - | func (x *WidgetClass) AddBinding(KeyvalVar uint, ModsVar gdk.ModifierType, CallbackVar ShortcutFunc, FormatStringVar string, varArgs ...interface{}) { | 95 | + | func (x *WidgetClass) AddBinding(KeyvalVar uint, ModsVar gdk.ModifierType, CallbackVar *ShortcutFunc, FormatStringVar string, varArgs ...interface{}) { |
| 96 | 96 | ||||
| 97 | - | xWidgetClassAddBinding(x.GoPointer(), KeyvalVar, ModsVar, purego.NewCallback(CallbackVar), FormatStringVar, varArgs...) | 97 | + | xWidgetClassAddBinding(x.GoPointer(), KeyvalVar, ModsVar, glib.NewCallback(CallbackVar), FormatStringVar, varArgs...) |
| 98 | 98 | ||||
| 99 | } | 99 | } | ||
| 100 | 100 | ||||
| @@ -160,9 +160,9 @@ var xWidgetClassBindTemplateCallbackFull func(uintptr, string, uintptr) | |||||
| 160 | // | 160 | // | ||
| 161 | // Note that this must be called from a composite widget classes | 161 | // Note that this must be called from a composite widget classes | ||
| 162 | // class initializer after calling [method@Gtk.WidgetClass.set_template]. | 162 | // class initializer after calling [method@Gtk.WidgetClass.set_template]. | ||
| 163 | - | func (x *WidgetClass) BindTemplateCallbackFull(CallbackNameVar string, CallbackSymbolVar gobject.Callback) { | 163 | + | func (x *WidgetClass) BindTemplateCallbackFull(CallbackNameVar string, CallbackSymbolVar *gobject.Callback) { |
| 164 | 164 | ||||
| 165 | - | xWidgetClassBindTemplateCallbackFull(x.GoPointer(), CallbackNameVar, purego.NewCallback(CallbackSymbolVar)) | 165 | + | xWidgetClassBindTemplateCallbackFull(x.GoPointer(), CallbackNameVar, glib.NewCallback(CallbackSymbolVar)) |
| 166 | 166 | ||||
| 167 | } | 167 | } | ||
| 168 | 168 | ||||
| @@ -258,9 +258,9 @@ var xWidgetClassInstallAction func(uintptr, string, string, uintptr) | |||||
| 258 | // | 258 | // | ||
| 259 | // Actions installed by this function are stateless. The only state | 259 | // Actions installed by this function are stateless. The only state | ||
| 260 | // they have is whether they are enabled or not. | 260 | // they have is whether they are enabled or not. | ||
| 261 | - | func (x *WidgetClass) InstallAction(ActionNameVar string, ParameterTypeVar string, ActivateVar WidgetActionActivateFunc) { | 261 | + | func (x *WidgetClass) InstallAction(ActionNameVar string, ParameterTypeVar string, ActivateVar *WidgetActionActivateFunc) { |
| 262 | 262 | ||||
| 263 | - | xWidgetClassInstallAction(x.GoPointer(), ActionNameVar, ParameterTypeVar, purego.NewCallback(ActivateVar)) | 263 | + | xWidgetClassInstallAction(x.GoPointer(), ActionNameVar, ParameterTypeVar, glib.NewCallback(ActivateVar)) |
| 264 | 264 | ||||
| 265 | } | 265 | } | ||
| 266 | 266 | ||||
| @@ -995,9 +995,9 @@ var xWidgetAddTickCallback func(uintptr, uintptr, uintptr, uintptr) uint | |||||
| 995 | // This is a more convenient alternative to connecting directly to the | 995 | // This is a more convenient alternative to connecting directly to the | ||
| 996 | // [signal@Gdk.FrameClock::update] signal of `GdkFrameClock`, since you | 996 | // [signal@Gdk.FrameClock::update] signal of `GdkFrameClock`, since you | ||
| 997 | // don't have to worry about when a `GdkFrameClock` is assigned to a widget. | 997 | // don't have to worry about when a `GdkFrameClock` is assigned to a widget. | ||
| 998 | - | func (x *Widget) AddTickCallback(CallbackVar TickCallback, UserDataVar uintptr, NotifyVar glib.DestroyNotify) uint { | 998 | + | func (x *Widget) AddTickCallback(CallbackVar *TickCallback, UserDataVar uintptr, NotifyVar *glib.DestroyNotify) uint { |
| 999 | 999 | ||||
| 1000 | - | cret := xWidgetAddTickCallback(x.GoPointer(), purego.NewCallback(CallbackVar), UserDataVar, purego.NewCallback(NotifyVar)) | 1000 | + | cret := xWidgetAddTickCallback(x.GoPointer(), glib.NewCallback(CallbackVar), UserDataVar, glib.NewCallback(NotifyVar)) |
| 1001 | return cret | 1001 | return cret | ||
| 1002 | } | 1002 | } | ||
| 1003 | 1003 | ||||
| @@ -3461,53 +3461,85 @@ func (c *Widget) SetGoPointer(ptr uintptr) { | |||||
| 3461 | // May result in finalization of the widget if all references are released. | 3461 | // May result in finalization of the widget if all references are released. | ||
| 3462 | // | 3462 | // | ||
| 3463 | // This signal is not suitable for saving widget state. | 3463 | // This signal is not suitable for saving widget state. | ||
| 3464 | - | func (x *Widget) ConnectDestroy(cb func(Widget)) uint32 { | 3464 | + | func (x *Widget) ConnectDestroy(cb *func(Widget)) uint32 { |
| 3465 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 3466 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 3467 | + | return gobject.SignalConnect(x.GoPointer(), "destroy", cbRefPtr) | |||
| 3468 | + | } | |||
| 3469 | + | ||||
| 3465 | fcb := func(clsPtr uintptr) { | 3470 | fcb := func(clsPtr uintptr) { | ||
| 3466 | fa := Widget{} | 3471 | fa := Widget{} | ||
| 3467 | fa.Ptr = clsPtr | 3472 | fa.Ptr = clsPtr | ||
| 3473 | + | cbFn := *cb | |||
| 3468 | 3474 | ||||
| 3469 | - | cb(fa) | 3475 | + | cbFn(fa) |
| 3470 | 3476 | ||||
| 3471 | } | 3477 | } | ||
| 3472 | - | return gobject.SignalConnect(x.GoPointer(), "destroy", purego.NewCallback(fcb)) | 3478 | + | cbRefPtr := purego.NewCallback(fcb) |
| 3479 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 3480 | + | return gobject.SignalConnect(x.GoPointer(), "destroy", cbRefPtr) | |||
| 3473 | } | 3481 | } | ||
| 3474 | 3482 | ||||
| 3475 | // Emitted when the text direction of a widget changes. | 3483 | // Emitted when the text direction of a widget changes. | ||
| 3476 | - | func (x *Widget) ConnectDirectionChanged(cb func(Widget, TextDirection)) uint32 { | 3484 | + | func (x *Widget) ConnectDirectionChanged(cb *func(Widget, TextDirection)) uint32 { |
| 3485 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 3486 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 3487 | + | return gobject.SignalConnect(x.GoPointer(), "direction-changed", cbRefPtr) | |||
| 3488 | + | } | |||
| 3489 | + | ||||
| 3477 | fcb := func(clsPtr uintptr, PreviousDirectionVarp TextDirection) { | 3490 | fcb := func(clsPtr uintptr, PreviousDirectionVarp TextDirection) { | ||
| 3478 | fa := Widget{} | 3491 | fa := Widget{} | ||
| 3479 | fa.Ptr = clsPtr | 3492 | fa.Ptr = clsPtr | ||
| 3493 | + | cbFn := *cb | |||
| 3480 | 3494 | ||||
| 3481 | - | cb(fa, PreviousDirectionVarp) | 3495 | + | cbFn(fa, PreviousDirectionVarp) |
| 3482 | 3496 | ||||
| 3483 | } | 3497 | } | ||
| 3484 | - | return gobject.SignalConnect(x.GoPointer(), "direction-changed", purego.NewCallback(fcb)) | 3498 | + | cbRefPtr := purego.NewCallback(fcb) |
| 3499 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 3500 | + | return gobject.SignalConnect(x.GoPointer(), "direction-changed", cbRefPtr) | |||
| 3485 | } | 3501 | } | ||
| 3486 | 3502 | ||||
| 3487 | // Emitted when @widget is hidden. | 3503 | // Emitted when @widget is hidden. | ||
| 3488 | - | func (x *Widget) ConnectHide(cb func(Widget)) uint32 { | 3504 | + | func (x *Widget) ConnectHide(cb *func(Widget)) uint32 { |
| 3505 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 3506 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 3507 | + | return gobject.SignalConnect(x.GoPointer(), "hide", cbRefPtr) | |||
| 3508 | + | } | |||
| 3509 | + | ||||
| 3489 | fcb := func(clsPtr uintptr) { | 3510 | fcb := func(clsPtr uintptr) { | ||
| 3490 | fa := Widget{} | 3511 | fa := Widget{} | ||
| 3491 | fa.Ptr = clsPtr | 3512 | fa.Ptr = clsPtr | ||
| 3513 | + | cbFn := *cb | |||
| 3492 | 3514 | ||||
| 3493 | - | cb(fa) | 3515 | + | cbFn(fa) |
| 3494 | 3516 | ||||
| 3495 | } | 3517 | } | ||
| 3496 | - | return gobject.SignalConnect(x.GoPointer(), "hide", purego.NewCallback(fcb)) | 3518 | + | cbRefPtr := purego.NewCallback(fcb) |
| 3519 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 3520 | + | return gobject.SignalConnect(x.GoPointer(), "hide", cbRefPtr) | |||
| 3497 | } | 3521 | } | ||
| 3498 | 3522 | ||||
| 3499 | // Emitted if keyboard navigation fails. | 3523 | // Emitted if keyboard navigation fails. | ||
| 3500 | // | 3524 | // | ||
| 3501 | // See [method@Gtk.Widget.keynav_failed] for details. | 3525 | // See [method@Gtk.Widget.keynav_failed] for details. | ||
| 3502 | - | func (x *Widget) ConnectKeynavFailed(cb func(Widget, DirectionType) bool) uint32 { | 3526 | + | func (x *Widget) ConnectKeynavFailed(cb *func(Widget, DirectionType) bool) uint32 { |
| 3527 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 3528 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 3529 | + | return gobject.SignalConnect(x.GoPointer(), "keynav-failed", cbRefPtr) | |||
| 3530 | + | } | |||
| 3531 | + | ||||
| 3503 | fcb := func(clsPtr uintptr, DirectionVarp DirectionType) bool { | 3532 | fcb := func(clsPtr uintptr, DirectionVarp DirectionType) bool { | ||
| 3504 | fa := Widget{} | 3533 | fa := Widget{} | ||
| 3505 | fa.Ptr = clsPtr | 3534 | fa.Ptr = clsPtr | ||
| 3535 | + | cbFn := *cb | |||
| 3506 | 3536 | ||||
| 3507 | - | return cb(fa, DirectionVarp) | 3537 | + | return cbFn(fa, DirectionVarp) |
| 3508 | 3538 | ||||
| 3509 | } | 3539 | } | ||
| 3510 | - | return gobject.SignalConnect(x.GoPointer(), "keynav-failed", purego.NewCallback(fcb)) | 3540 | + | cbRefPtr := purego.NewCallback(fcb) |
| 3541 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 3542 | + | return gobject.SignalConnect(x.GoPointer(), "keynav-failed", cbRefPtr) | |||
| 3511 | } | 3543 | } | ||
| 3512 | 3544 | ||||
| 3513 | // Emitted when @widget is going to be mapped. | 3545 | // Emitted when @widget is going to be mapped. | ||
| @@ -3519,42 +3551,66 @@ func (x *Widget) ConnectKeynavFailed(cb func(Widget, DirectionType) bool) uint32 | |||||
| 3519 | // The ::map signal can be used to determine whether a widget will be drawn, | 3551 | // The ::map signal can be used to determine whether a widget will be drawn, | ||
| 3520 | // for instance it can resume an animation that was stopped during the | 3552 | // for instance it can resume an animation that was stopped during the | ||
| 3521 | // emission of [signal@Gtk.Widget::unmap]. | 3553 | // emission of [signal@Gtk.Widget::unmap]. | ||
| 3522 | - | func (x *Widget) ConnectMap(cb func(Widget)) uint32 { | 3554 | + | func (x *Widget) ConnectMap(cb *func(Widget)) uint32 { |
| 3555 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 3556 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 3557 | + | return gobject.SignalConnect(x.GoPointer(), "map", cbRefPtr) | |||
| 3558 | + | } | |||
| 3559 | + | ||||
| 3523 | fcb := func(clsPtr uintptr) { | 3560 | fcb := func(clsPtr uintptr) { | ||
| 3524 | fa := Widget{} | 3561 | fa := Widget{} | ||
| 3525 | fa.Ptr = clsPtr | 3562 | fa.Ptr = clsPtr | ||
| 3563 | + | cbFn := *cb | |||
| 3526 | 3564 | ||||
| 3527 | - | cb(fa) | 3565 | + | cbFn(fa) |
| 3528 | 3566 | ||||
| 3529 | } | 3567 | } | ||
| 3530 | - | return gobject.SignalConnect(x.GoPointer(), "map", purego.NewCallback(fcb)) | 3568 | + | cbRefPtr := purego.NewCallback(fcb) |
| 3569 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 3570 | + | return gobject.SignalConnect(x.GoPointer(), "map", cbRefPtr) | |||
| 3531 | } | 3571 | } | ||
| 3532 | 3572 | ||||
| 3533 | // Emitted when a widget is activated via a mnemonic. | 3573 | // Emitted when a widget is activated via a mnemonic. | ||
| 3534 | // | 3574 | // | ||
| 3535 | // The default handler for this signal activates @widget if @group_cycling | 3575 | // The default handler for this signal activates @widget if @group_cycling | ||
| 3536 | // is %FALSE, or just makes @widget grab focus if @group_cycling is %TRUE. | 3576 | // is %FALSE, or just makes @widget grab focus if @group_cycling is %TRUE. | ||
| 3537 | - | func (x *Widget) ConnectMnemonicActivate(cb func(Widget, bool) bool) uint32 { | 3577 | + | func (x *Widget) ConnectMnemonicActivate(cb *func(Widget, bool) bool) uint32 { |
| 3578 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 3579 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 3580 | + | return gobject.SignalConnect(x.GoPointer(), "mnemonic-activate", cbRefPtr) | |||
| 3581 | + | } | |||
| 3582 | + | ||||
| 3538 | fcb := func(clsPtr uintptr, GroupCyclingVarp bool) bool { | 3583 | fcb := func(clsPtr uintptr, GroupCyclingVarp bool) bool { | ||
| 3539 | fa := Widget{} | 3584 | fa := Widget{} | ||
| 3540 | fa.Ptr = clsPtr | 3585 | fa.Ptr = clsPtr | ||
| 3586 | + | cbFn := *cb | |||
| 3541 | 3587 | ||||
| 3542 | - | return cb(fa, GroupCyclingVarp) | 3588 | + | return cbFn(fa, GroupCyclingVarp) |
| 3543 | 3589 | ||||
| 3544 | } | 3590 | } | ||
| 3545 | - | return gobject.SignalConnect(x.GoPointer(), "mnemonic-activate", purego.NewCallback(fcb)) | 3591 | + | cbRefPtr := purego.NewCallback(fcb) |
| 3592 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 3593 | + | return gobject.SignalConnect(x.GoPointer(), "mnemonic-activate", cbRefPtr) | |||
| 3546 | } | 3594 | } | ||
| 3547 | 3595 | ||||
| 3548 | // Emitted when the focus is moved. | 3596 | // Emitted when the focus is moved. | ||
| 3549 | - | func (x *Widget) ConnectMoveFocus(cb func(Widget, DirectionType)) uint32 { | 3597 | + | func (x *Widget) ConnectMoveFocus(cb *func(Widget, DirectionType)) uint32 { |
| 3598 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 3599 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 3600 | + | return gobject.SignalConnect(x.GoPointer(), "move-focus", cbRefPtr) | |||
| 3601 | + | } | |||
| 3602 | + | ||||
| 3550 | fcb := func(clsPtr uintptr, DirectionVarp DirectionType) { | 3603 | fcb := func(clsPtr uintptr, DirectionVarp DirectionType) { | ||
| 3551 | fa := Widget{} | 3604 | fa := Widget{} | ||
| 3552 | fa.Ptr = clsPtr | 3605 | fa.Ptr = clsPtr | ||
| 3606 | + | cbFn := *cb | |||
| 3553 | 3607 | ||||
| 3554 | - | cb(fa, DirectionVarp) | 3608 | + | cbFn(fa, DirectionVarp) |
| 3555 | 3609 | ||||
| 3556 | } | 3610 | } | ||
| 3557 | - | return gobject.SignalConnect(x.GoPointer(), "move-focus", purego.NewCallback(fcb)) | 3611 | + | cbRefPtr := purego.NewCallback(fcb) |
| 3612 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 3613 | + | return gobject.SignalConnect(x.GoPointer(), "move-focus", cbRefPtr) | |||
| 3558 | } | 3614 | } | ||
| 3559 | 3615 | ||||
| 3560 | // Emitted when the widgets tooltip is about to be shown. | 3616 | // Emitted when the widgets tooltip is about to be shown. | ||
| @@ -3571,56 +3627,88 @@ func (x *Widget) ConnectMoveFocus(cb func(Widget, DirectionType)) uint32 { | |||||
| 3571 | // | 3627 | // | ||
| 3572 | // The signal handler is free to manipulate @tooltip with the therefore | 3628 | // The signal handler is free to manipulate @tooltip with the therefore | ||
| 3573 | // destined function calls. | 3629 | // destined function calls. | ||
| 3574 | - | func (x *Widget) ConnectQueryTooltip(cb func(Widget, int, int, bool, uintptr) bool) uint32 { | 3630 | + | func (x *Widget) ConnectQueryTooltip(cb *func(Widget, int, int, bool, uintptr) bool) uint32 { |
| 3631 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 3632 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 3633 | + | return gobject.SignalConnect(x.GoPointer(), "query-tooltip", cbRefPtr) | |||
| 3634 | + | } | |||
| 3635 | + | ||||
| 3575 | fcb := func(clsPtr uintptr, XVarp int, YVarp int, KeyboardModeVarp bool, TooltipVarp uintptr) bool { | 3636 | fcb := func(clsPtr uintptr, XVarp int, YVarp int, KeyboardModeVarp bool, TooltipVarp uintptr) bool { | ||
| 3576 | fa := Widget{} | 3637 | fa := Widget{} | ||
| 3577 | fa.Ptr = clsPtr | 3638 | fa.Ptr = clsPtr | ||
| 3639 | + | cbFn := *cb | |||
| 3578 | 3640 | ||||
| 3579 | - | return cb(fa, XVarp, YVarp, KeyboardModeVarp, TooltipVarp) | 3641 | + | return cbFn(fa, XVarp, YVarp, KeyboardModeVarp, TooltipVarp) |
| 3580 | 3642 | ||||
| 3581 | } | 3643 | } | ||
| 3582 | - | return gobject.SignalConnect(x.GoPointer(), "query-tooltip", purego.NewCallback(fcb)) | 3644 | + | cbRefPtr := purego.NewCallback(fcb) |
| 3645 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 3646 | + | return gobject.SignalConnect(x.GoPointer(), "query-tooltip", cbRefPtr) | |||
| 3583 | } | 3647 | } | ||
| 3584 | 3648 | ||||
| 3585 | // Emitted when @widget is associated with a `GdkSurface`. | 3649 | // Emitted when @widget is associated with a `GdkSurface`. | ||
| 3586 | // | 3650 | // | ||
| 3587 | // This means that [method@Gtk.Widget.realize] has been called | 3651 | // This means that [method@Gtk.Widget.realize] has been called | ||
| 3588 | // or the widget has been mapped (that is, it is going to be drawn). | 3652 | // or the widget has been mapped (that is, it is going to be drawn). | ||
| 3589 | - | func (x *Widget) ConnectRealize(cb func(Widget)) uint32 { | 3653 | + | func (x *Widget) ConnectRealize(cb *func(Widget)) uint32 { |
| 3654 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 3655 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 3656 | + | return gobject.SignalConnect(x.GoPointer(), "realize", cbRefPtr) | |||
| 3657 | + | } | |||
| 3658 | + | ||||
| 3590 | fcb := func(clsPtr uintptr) { | 3659 | fcb := func(clsPtr uintptr) { | ||
| 3591 | fa := Widget{} | 3660 | fa := Widget{} | ||
| 3592 | fa.Ptr = clsPtr | 3661 | fa.Ptr = clsPtr | ||
| 3662 | + | cbFn := *cb | |||
| 3593 | 3663 | ||||
| 3594 | - | cb(fa) | 3664 | + | cbFn(fa) |
| 3595 | 3665 | ||||
| 3596 | } | 3666 | } | ||
| 3597 | - | return gobject.SignalConnect(x.GoPointer(), "realize", purego.NewCallback(fcb)) | 3667 | + | cbRefPtr := purego.NewCallback(fcb) |
| 3668 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 3669 | + | return gobject.SignalConnect(x.GoPointer(), "realize", cbRefPtr) | |||
| 3598 | } | 3670 | } | ||
| 3599 | 3671 | ||||
| 3600 | // Emitted when @widget is shown. | 3672 | // Emitted when @widget is shown. | ||
| 3601 | - | func (x *Widget) ConnectShow(cb func(Widget)) uint32 { | 3673 | + | func (x *Widget) ConnectShow(cb *func(Widget)) uint32 { |
| 3674 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 3675 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 3676 | + | return gobject.SignalConnect(x.GoPointer(), "show", cbRefPtr) | |||
| 3677 | + | } | |||
| 3678 | + | ||||
| 3602 | fcb := func(clsPtr uintptr) { | 3679 | fcb := func(clsPtr uintptr) { | ||
| 3603 | fa := Widget{} | 3680 | fa := Widget{} | ||
| 3604 | fa.Ptr = clsPtr | 3681 | fa.Ptr = clsPtr | ||
| 3682 | + | cbFn := *cb | |||
| 3605 | 3683 | ||||
| 3606 | - | cb(fa) | 3684 | + | cbFn(fa) |
| 3607 | 3685 | ||||
| 3608 | } | 3686 | } | ||
| 3609 | - | return gobject.SignalConnect(x.GoPointer(), "show", purego.NewCallback(fcb)) | 3687 | + | cbRefPtr := purego.NewCallback(fcb) |
| 3688 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 3689 | + | return gobject.SignalConnect(x.GoPointer(), "show", cbRefPtr) | |||
| 3610 | } | 3690 | } | ||
| 3611 | 3691 | ||||
| 3612 | // Emitted when the widget state changes. | 3692 | // Emitted when the widget state changes. | ||
| 3613 | // | 3693 | // | ||
| 3614 | // See [method@Gtk.Widget.get_state_flags]. | 3694 | // See [method@Gtk.Widget.get_state_flags]. | ||
| 3615 | - | func (x *Widget) ConnectStateFlagsChanged(cb func(Widget, StateFlags)) uint32 { | 3695 | + | func (x *Widget) ConnectStateFlagsChanged(cb *func(Widget, StateFlags)) uint32 { |
| 3696 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 3697 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 3698 | + | return gobject.SignalConnect(x.GoPointer(), "state-flags-changed", cbRefPtr) | |||
| 3699 | + | } | |||
| 3700 | + | ||||
| 3616 | fcb := func(clsPtr uintptr, FlagsVarp StateFlags) { | 3701 | fcb := func(clsPtr uintptr, FlagsVarp StateFlags) { | ||
| 3617 | fa := Widget{} | 3702 | fa := Widget{} | ||
| 3618 | fa.Ptr = clsPtr | 3703 | fa.Ptr = clsPtr | ||
| 3704 | + | cbFn := *cb | |||
| 3619 | 3705 | ||||
| 3620 | - | cb(fa, FlagsVarp) | 3706 | + | cbFn(fa, FlagsVarp) |
| 3621 | 3707 | ||||
| 3622 | } | 3708 | } | ||
| 3623 | - | return gobject.SignalConnect(x.GoPointer(), "state-flags-changed", purego.NewCallback(fcb)) | 3709 | + | cbRefPtr := purego.NewCallback(fcb) |
| 3710 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 3711 | + | return gobject.SignalConnect(x.GoPointer(), "state-flags-changed", cbRefPtr) | |||
| 3624 | } | 3712 | } | ||
| 3625 | 3713 | ||||
| 3626 | // Emitted when @widget is going to be unmapped. | 3714 | // Emitted when @widget is going to be unmapped. | ||
| @@ -3630,30 +3718,46 @@ func (x *Widget) ConnectStateFlagsChanged(cb func(Widget, StateFlags)) uint32 { | |||||
| 3630 | // | 3718 | // | ||
| 3631 | // As ::unmap indicates that a widget will not be shown any longer, | 3719 | // As ::unmap indicates that a widget will not be shown any longer, | ||
| 3632 | // it can be used to, for example, stop an animation on the widget. | 3720 | // it can be used to, for example, stop an animation on the widget. | ||
| 3633 | - | func (x *Widget) ConnectUnmap(cb func(Widget)) uint32 { | 3721 | + | func (x *Widget) ConnectUnmap(cb *func(Widget)) uint32 { |
| 3722 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 3723 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 3724 | + | return gobject.SignalConnect(x.GoPointer(), "unmap", cbRefPtr) | |||
| 3725 | + | } | |||
| 3726 | + | ||||
| 3634 | fcb := func(clsPtr uintptr) { | 3727 | fcb := func(clsPtr uintptr) { | ||
| 3635 | fa := Widget{} | 3728 | fa := Widget{} | ||
| 3636 | fa.Ptr = clsPtr | 3729 | fa.Ptr = clsPtr | ||
| 3730 | + | cbFn := *cb | |||
| 3637 | 3731 | ||||
| 3638 | - | cb(fa) | 3732 | + | cbFn(fa) |
| 3639 | 3733 | ||||
| 3640 | } | 3734 | } | ||
| 3641 | - | return gobject.SignalConnect(x.GoPointer(), "unmap", purego.NewCallback(fcb)) | 3735 | + | cbRefPtr := purego.NewCallback(fcb) |
| 3736 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 3737 | + | return gobject.SignalConnect(x.GoPointer(), "unmap", cbRefPtr) | |||
| 3642 | } | 3738 | } | ||
| 3643 | 3739 | ||||
| 3644 | // Emitted when the `GdkSurface` associated with @widget is destroyed. | 3740 | // Emitted when the `GdkSurface` associated with @widget is destroyed. | ||
| 3645 | // | 3741 | // | ||
| 3646 | // This means that [method@Gtk.Widget.unrealize] has been called | 3742 | // This means that [method@Gtk.Widget.unrealize] has been called | ||
| 3647 | // or the widget has been unmapped (that is, it is going to be hidden). | 3743 | // or the widget has been unmapped (that is, it is going to be hidden). | ||
| 3648 | - | func (x *Widget) ConnectUnrealize(cb func(Widget)) uint32 { | 3744 | + | func (x *Widget) ConnectUnrealize(cb *func(Widget)) uint32 { |
| 3745 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 3746 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 3747 | + | return gobject.SignalConnect(x.GoPointer(), "unrealize", cbRefPtr) | |||
| 3748 | + | } | |||
| 3749 | + | ||||
| 3649 | fcb := func(clsPtr uintptr) { | 3750 | fcb := func(clsPtr uintptr) { | ||
| 3650 | fa := Widget{} | 3751 | fa := Widget{} | ||
| 3651 | fa.Ptr = clsPtr | 3752 | fa.Ptr = clsPtr | ||
| 3753 | + | cbFn := *cb | |||
| 3652 | 3754 | ||||
| 3653 | - | cb(fa) | 3755 | + | cbFn(fa) |
| 3654 | 3756 | ||||
| 3655 | } | 3757 | } | ||
| 3656 | - | return gobject.SignalConnect(x.GoPointer(), "unrealize", purego.NewCallback(fcb)) | 3758 | + | cbRefPtr := purego.NewCallback(fcb) |
| 3759 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 3760 | + | return gobject.SignalConnect(x.GoPointer(), "unrealize", cbRefPtr) | |||
| 3657 | } | 3761 | } | ||
| 3658 | 3762 | ||||
| 3659 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 3763 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/gtk/gtkwindow.go +55 -15
| @@ -950,42 +950,66 @@ func (c *Window) SetGoPointer(ptr uintptr) { | |||||
| 950 | // of @window. | 950 | // of @window. | ||
| 951 | // | 951 | // | ||
| 952 | // This is a [keybinding signal](class.SignalAction.html). | 952 | // This is a [keybinding signal](class.SignalAction.html). | ||
| 953 | - | func (x *Window) ConnectActivateDefault(cb func(Window)) uint32 { | 953 | + | func (x *Window) ConnectActivateDefault(cb *func(Window)) uint32 { |
| 954 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 955 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 956 | + | return gobject.SignalConnect(x.GoPointer(), "activate-default", cbRefPtr) | |||
| 957 | + | } | |||
| 958 | + | ||||
| 954 | fcb := func(clsPtr uintptr) { | 959 | fcb := func(clsPtr uintptr) { | ||
| 955 | fa := Window{} | 960 | fa := Window{} | ||
| 956 | fa.Ptr = clsPtr | 961 | fa.Ptr = clsPtr | ||
| 962 | + | cbFn := *cb | |||
| 957 | 963 | ||||
| 958 | - | cb(fa) | 964 | + | cbFn(fa) |
| 959 | 965 | ||||
| 960 | } | 966 | } | ||
| 961 | - | return gobject.SignalConnect(x.GoPointer(), "activate-default", purego.NewCallback(fcb)) | 967 | + | cbRefPtr := purego.NewCallback(fcb) |
| 968 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 969 | + | return gobject.SignalConnect(x.GoPointer(), "activate-default", cbRefPtr) | |||
| 962 | } | 970 | } | ||
| 963 | 971 | ||||
| 964 | // Emitted when the user activates the currently focused | 972 | // Emitted when the user activates the currently focused | ||
| 965 | // widget of @window. | 973 | // widget of @window. | ||
| 966 | // | 974 | // | ||
| 967 | // This is a [keybinding signal](class.SignalAction.html). | 975 | // This is a [keybinding signal](class.SignalAction.html). | ||
| 968 | - | func (x *Window) ConnectActivateFocus(cb func(Window)) uint32 { | 976 | + | func (x *Window) ConnectActivateFocus(cb *func(Window)) uint32 { |
| 977 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 978 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 979 | + | return gobject.SignalConnect(x.GoPointer(), "activate-focus", cbRefPtr) | |||
| 980 | + | } | |||
| 981 | + | ||||
| 969 | fcb := func(clsPtr uintptr) { | 982 | fcb := func(clsPtr uintptr) { | ||
| 970 | fa := Window{} | 983 | fa := Window{} | ||
| 971 | fa.Ptr = clsPtr | 984 | fa.Ptr = clsPtr | ||
| 985 | + | cbFn := *cb | |||
| 972 | 986 | ||||
| 973 | - | cb(fa) | 987 | + | cbFn(fa) |
| 974 | 988 | ||||
| 975 | } | 989 | } | ||
| 976 | - | return gobject.SignalConnect(x.GoPointer(), "activate-focus", purego.NewCallback(fcb)) | 990 | + | cbRefPtr := purego.NewCallback(fcb) |
| 991 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 992 | + | return gobject.SignalConnect(x.GoPointer(), "activate-focus", cbRefPtr) | |||
| 977 | } | 993 | } | ||
| 978 | 994 | ||||
| 979 | // Emitted when the user clicks on the close button of the window. | 995 | // Emitted when the user clicks on the close button of the window. | ||
| 980 | - | func (x *Window) ConnectCloseRequest(cb func(Window) bool) uint32 { | 996 | + | func (x *Window) ConnectCloseRequest(cb *func(Window) bool) uint32 { |
| 997 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 998 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 999 | + | return gobject.SignalConnect(x.GoPointer(), "close-request", cbRefPtr) | |||
| 1000 | + | } | |||
| 1001 | + | ||||
| 981 | fcb := func(clsPtr uintptr) bool { | 1002 | fcb := func(clsPtr uintptr) bool { | ||
| 982 | fa := Window{} | 1003 | fa := Window{} | ||
| 983 | fa.Ptr = clsPtr | 1004 | fa.Ptr = clsPtr | ||
| 1005 | + | cbFn := *cb | |||
| 984 | 1006 | ||||
| 985 | - | return cb(fa) | 1007 | + | return cbFn(fa) |
| 986 | 1008 | ||||
| 987 | } | 1009 | } | ||
| 988 | - | return gobject.SignalConnect(x.GoPointer(), "close-request", purego.NewCallback(fcb)) | 1010 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1011 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1012 | + | return gobject.SignalConnect(x.GoPointer(), "close-request", cbRefPtr) | |||
| 989 | } | 1013 | } | ||
| 990 | 1014 | ||||
| 991 | // Emitted when the user enables or disables interactive debugging. | 1015 | // Emitted when the user enables or disables interactive debugging. | ||
| @@ -998,28 +1022,44 @@ func (x *Window) ConnectCloseRequest(cb func(Window) bool) uint32 { | |||||
| 998 | // | 1022 | // | ||
| 999 | // The default bindings for this signal are Ctrl-Shift-I | 1023 | // The default bindings for this signal are Ctrl-Shift-I | ||
| 1000 | // and Ctrl-Shift-D. | 1024 | // and Ctrl-Shift-D. | ||
| 1001 | - | func (x *Window) ConnectEnableDebugging(cb func(Window, bool) bool) uint32 { | 1025 | + | func (x *Window) ConnectEnableDebugging(cb *func(Window, bool) bool) uint32 { |
| 1026 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1027 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1028 | + | return gobject.SignalConnect(x.GoPointer(), "enable-debugging", cbRefPtr) | |||
| 1029 | + | } | |||
| 1030 | + | ||||
| 1002 | fcb := func(clsPtr uintptr, ToggleVarp bool) bool { | 1031 | fcb := func(clsPtr uintptr, ToggleVarp bool) bool { | ||
| 1003 | fa := Window{} | 1032 | fa := Window{} | ||
| 1004 | fa.Ptr = clsPtr | 1033 | fa.Ptr = clsPtr | ||
| 1034 | + | cbFn := *cb | |||
| 1005 | 1035 | ||||
| 1006 | - | return cb(fa, ToggleVarp) | 1036 | + | return cbFn(fa, ToggleVarp) |
| 1007 | 1037 | ||||
| 1008 | } | 1038 | } | ||
| 1009 | - | return gobject.SignalConnect(x.GoPointer(), "enable-debugging", purego.NewCallback(fcb)) | 1039 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1040 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1041 | + | return gobject.SignalConnect(x.GoPointer(), "enable-debugging", cbRefPtr) | |||
| 1010 | } | 1042 | } | ||
| 1011 | 1043 | ||||
| 1012 | // emitted when the set of accelerators or mnemonics that | 1044 | // emitted when the set of accelerators or mnemonics that | ||
| 1013 | // are associated with @window changes. | 1045 | // are associated with @window changes. | ||
| 1014 | - | func (x *Window) ConnectKeysChanged(cb func(Window)) uint32 { | 1046 | + | func (x *Window) ConnectKeysChanged(cb *func(Window)) uint32 { |
| 1047 | + | cbPtr := uintptr(unsafe.Pointer(cb)) | |||
| 1048 | + | if cbRefPtr, ok := glib.GetCallback(cbPtr); ok { | |||
| 1049 | + | return gobject.SignalConnect(x.GoPointer(), "keys-changed", cbRefPtr) | |||
| 1050 | + | } | |||
| 1051 | + | ||||
| 1015 | fcb := func(clsPtr uintptr) { | 1052 | fcb := func(clsPtr uintptr) { | ||
| 1016 | fa := Window{} | 1053 | fa := Window{} | ||
| 1017 | fa.Ptr = clsPtr | 1054 | fa.Ptr = clsPtr | ||
| 1055 | + | cbFn := *cb | |||
| 1018 | 1056 | ||||
| 1019 | - | cb(fa) | 1057 | + | cbFn(fa) |
| 1020 | 1058 | ||||
| 1021 | } | 1059 | } | ||
| 1022 | - | return gobject.SignalConnect(x.GoPointer(), "keys-changed", purego.NewCallback(fcb)) | 1060 | + | cbRefPtr := purego.NewCallback(fcb) |
| 1061 | + | glib.SaveCallback(cbPtr, cbRefPtr) | |||
| 1062 | + | return gobject.SignalConnect(x.GoPointer(), "keys-changed", cbRefPtr) | |||
| 1023 | } | 1063 | } | ||
| 1024 | 1064 | ||||
| 1025 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | 1065 | // Retrieves the `GtkAccessibleRole` for the given `GtkAccessible`. | ||
M v4/pango/pango-attributes.go +4 -4
| @@ -265,9 +265,9 @@ var xAttrListFilter func(uintptr, uintptr, uintptr) *AttrList | |||||
| 265 | // Given a `PangoAttrList` and callback function, removes | 265 | // Given a `PangoAttrList` and callback function, removes | ||
| 266 | // any elements of @list for which @func returns %TRUE and | 266 | // any elements of @list for which @func returns %TRUE and | ||
| 267 | // inserts them into a new list. | 267 | // inserts them into a new list. | ||
| 268 | - | func (x *AttrList) Filter(FuncVar AttrFilterFunc, DataVar uintptr) *AttrList { | 268 | + | func (x *AttrList) Filter(FuncVar *AttrFilterFunc, DataVar uintptr) *AttrList { |
| 269 | 269 | ||||
| 270 | - | cret := xAttrListFilter(x.GoPointer(), purego.NewCallback(FuncVar), DataVar) | 270 | + | cret := xAttrListFilter(x.GoPointer(), glib.NewCallback(FuncVar), DataVar) |
| 271 | return cret | 271 | return cret | ||
| 272 | } | 272 | } | ||
| 273 | 273 | ||||
| @@ -1110,9 +1110,9 @@ var xAttrShapeNewWithData func(*Rectangle, *Rectangle, uintptr, uintptr, uintptr | |||||
| 1110 | // Like [func@Pango.AttrShape.new], but a user data pointer | 1110 | // Like [func@Pango.AttrShape.new], but a user data pointer | ||
| 1111 | // is also provided; this pointer can be accessed when later | 1111 | // is also provided; this pointer can be accessed when later | ||
| 1112 | // rendering the glyph. | 1112 | // rendering the glyph. | ||
| 1113 | - | func AttrShapeNewWithData(InkRectVar *Rectangle, LogicalRectVar *Rectangle, DataVar uintptr, CopyFuncVar AttrDataCopyFunc, DestroyFuncVar glib.DestroyNotify) *Attribute { | 1113 | + | func AttrShapeNewWithData(InkRectVar *Rectangle, LogicalRectVar *Rectangle, DataVar uintptr, CopyFuncVar *AttrDataCopyFunc, DestroyFuncVar *glib.DestroyNotify) *Attribute { |
| 1114 | 1114 | ||||
| 1115 | - | cret := xAttrShapeNewWithData(InkRectVar, LogicalRectVar, DataVar, purego.NewCallback(CopyFuncVar), purego.NewCallback(DestroyFuncVar)) | 1115 | + | cret := xAttrShapeNewWithData(InkRectVar, LogicalRectVar, DataVar, glib.NewCallback(CopyFuncVar), glib.NewCallback(DestroyFuncVar)) |
| 1116 | return cret | 1116 | return cret | ||
| 1117 | } | 1117 | } | ||
| 1118 | 1118 | ||||
M v4/pango/pango-fontset.go +3 -2
| @@ -6,6 +6,7 @@ import ( | |||||
| 6 | 6 | ||||
| 7 | "github.com/jwijenbergh/purego" | 7 | "github.com/jwijenbergh/purego" | ||
| 8 | "github.com/jwijenbergh/puregotk/internal/core" | 8 | "github.com/jwijenbergh/puregotk/internal/core" | ||
| 9 | + | "github.com/jwijenbergh/puregotk/v4/glib" | |||
| 9 | "github.com/jwijenbergh/puregotk/v4/gobject" | 10 | "github.com/jwijenbergh/puregotk/v4/gobject" | ||
| 10 | ) | 11 | ) | ||
| 11 | 12 | ||||
| @@ -52,9 +53,9 @@ var xFontsetForeach func(uintptr, uintptr, uintptr) | |||||
| 52 | // each one. | 53 | // each one. | ||
| 53 | // | 54 | // | ||
| 54 | // If @func returns %TRUE, that stops the iteration. | 55 | // If @func returns %TRUE, that stops the iteration. | ||
| 55 | - | func (x *Fontset) Foreach(FuncVar FontsetForeachFunc, DataVar uintptr) { | 56 | + | func (x *Fontset) Foreach(FuncVar *FontsetForeachFunc, DataVar uintptr) { |
| 56 | 57 | ||||
| 57 | - | xFontsetForeach(x.GoPointer(), purego.NewCallback(FuncVar), DataVar) | 58 | + | xFontsetForeach(x.GoPointer(), glib.NewCallback(FuncVar), DataVar) |
| 58 | 59 | ||||
| 59 | } | 60 | } | ||
| 60 | 61 | ||||
M v4/pangocairo/pangocairo.go +2 -2
| @@ -213,9 +213,9 @@ var xContextSetShapeRenderer func(uintptr, uintptr, uintptr, uintptr) | |||||
| 213 | // of type %PANGO_ATTR_SHAPE. | 213 | // of type %PANGO_ATTR_SHAPE. | ||
| 214 | // | 214 | // | ||
| 215 | // See `PangoCairoShapeRendererFunc` for details. | 215 | // See `PangoCairoShapeRendererFunc` for details. | ||
| 216 | - | func ContextSetShapeRenderer(ContextVar *pango.Context, FuncVar ShapeRendererFunc, DataVar uintptr, DnotifyVar glib.DestroyNotify) { | 216 | + | func ContextSetShapeRenderer(ContextVar *pango.Context, FuncVar *ShapeRendererFunc, DataVar uintptr, DnotifyVar *glib.DestroyNotify) { |
| 217 | 217 | ||||
| 218 | - | xContextSetShapeRenderer(ContextVar.GoPointer(), purego.NewCallback(FuncVar), DataVar, purego.NewCallback(DnotifyVar)) | 218 | + | xContextSetShapeRenderer(ContextVar.GoPointer(), glib.NewCallback(FuncVar), DataVar, glib.NewCallback(DnotifyVar)) |
| 219 | 219 | ||||
| 220 | } | 220 | } | ||
| 221 | 221 | ||||